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 24 Aug 2015 18:26, Samuel Thibault wrote:
> Rich Felker, le Mon 24 Aug 2015 12:22:50 -0400, a Ãcrit :
> > On Mon, Aug 24, 2015 at 05:38:16PM +0200, Samuel Thibault wrote:
> > > Andreas Schwab, le Mon 24 Aug 2015 17:30:40 +0200, a Ãcrit :
> > > > BZ #18853 shows how the use of the dummy pthread functions in libc can
> > > > be harmful if dlopen brings in libpthread by dependency.
> > > 
> > > I have to admit I've always wondered about this case, and never took
> > > the time to report the issue, partly because I guessed people wouldn't
> > > dlopen() while "owning" a mutex.  This can be fixed by making the mutex
> > > stubs really modify the mutex, possibly optimized into just not using
> > > lock prefixes etc.
> > > 
> > > Not having proper stubs in libc makes applications write their own stubs
> > > (see libpthread-stubs in freedesktop for instance), which will suffer
> > > from the same issue.
> > 
> > I agree that removing them would be a bad idea, but why not just put
> > the actual code (real locking) in the ones in libc.so?
> 
> That would be simpler, yes.
> 
> > (for programs doing dubious stuff to begin with)
> 
> It's usually not programs which call pthread_mutex, but libraries which
> want to be thread-safe without actually bringing the libpthread
> dependencye.

right, and a quick scan of packages i have installed on my system show a number
utilizing that mechanism; many are "core" libs.  like libxml2 and X11 packages,
and a number of multimedia libs.  i'm not sure deleting the stubs from glibc is
a viable option.
-mike

Attachment: signature.asc
Description: Digital signature


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