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 Tue, 25 Aug 2015, Rich Felker wrote:
> > (however when libpthread is not linked in, you know that pthread_mutex_lock is
> > not operating on shared memory: you'd need pthread_mutexattr_setpshared, which
> > is not provided in libc.so.6)
> 
> This is false. The process that maps and locks the process-shared
> mutex need not be the one that called pthread_mutex_init. I ran into
> this issue when optimizing static linking; you can't omit
> process-shared code when the program doesn't reference
> pthread_mutexattr_setpshared, because it could get the mutex from
> another program -- that's the whole point of having it be
> process-shared.

As a result, a libc "stub" mutex must:

 - contain a full implementation for process-shared mutexes
 - for non-shared mutexes in single-threaded processes, modify them
   consistently with non-stub implementation (but modifications need not be
   atomic)

Does Glibc do the former? (the bug report is about Glibc not doing the latter)

Alexander


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