This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Dummy pthread functions in libc considered harmful


On 09/03/2015 08:45 PM, OndÅej BÃlka wrote:
> On Thu, Sep 03, 2015 at 09:14:14AM +0200, Andreas Schwab wrote:
>> "Carlos O'Donell" <carlos@redhat.com> writes:
>>
>>> Is there ever a safe way to transition from running unthreaded to
>>> threaded if you are not using a full implementation of locks in libc.so?
>>
>> As long as you have no "locked" mutexes while libpthread is being loaded
>> (which installs the real pthread_mutex functions), there is no danger,
>> since you cannot create new threads without libpthread being fully
>> active.
>>
> A requirement for no locked mutex isn't necessary. It simplifies things
> as with it a functions could be nop.

No-op locks aren't possible if you want to support lock upgrades with a
delayed loading of libpthread.  You either need to keep them consistent
with future libpthread usage all the time (without using atomics), or
keep them in some sort of data structure so that you can find them at
libpthread loading time to switch them to a libpthread-supported state.

-- 
Florian Weimer / Red Hat Product Security


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]