Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190326162334.GF17481@joraj-alpa>
Date: Tue, 26 Mar 2019 12:23:34 -0400
From: Jonathan Rajotte-Julien <jonathan.rajotte-julien@...icios.com>
To: musl@...ts.openwall.com, Michael Jeanson <mjeanson@...icios.com>,
	Richard Purdie <richard.purdie@...uxfoundation.org>,
	Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
Subject: Re: sysconf(_SC_NPROCESSORS_CONF) returns the wrong value

Hi Szabolcs,

> i think we need to know why does a process care if musl returns
> the wrong number? or what are the valid uses of such a number?
> (there are heterogeous systems like arm big-little, numa systems
> with many sockets, containers, virtualization,.. how deep may a
> user process need to go down in this rabbit hole?)

Does the answers from Mathieu Desnoyers [1] and Florian Weimer [2] fit the bill?

[1] https://www.openwall.com/lists/musl/2019/03/16/3
[2] https://www.openwall.com/lists/musl/2019/03/19/1
> 
> note that most of /sys/devices/system/cpu/* is documented under
> Documentation/ABI/testing in linux, not in Documentation/ABI/stable
> and the format is not detailed, and some apis (e.g. /proc/cpuinfo)
> are known to be different on android (and grsec?) kernels it may
> be unmounted during early boot or in chroots, so sysfs parsing is
> only done when really necessary.

For what it's worth, uclibc and uclibc-ng seem to iterate over
/sys/devices/system/cpu/* and fallback on online calculation if necessary.

https://cgit.uclibc-ng.org/cgi/cgit/uclibc-ng.git/tree/libc/unistd/sysconf.c#n102

In the mean time, we implemented a fallback similar to this when we do not "know"
the libc used (since musl does not come with __musl__, I read the reasons why,
no need to discuss this).

Not sure of the direction musl should take but I strongly believe that the
behaviour regarding _SC_NPROCESSORS_CONF is not the appropriate one.

Cheers

-- 
Jonathan Rajotte-Julien
EfficiOS

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.