[patch] Re: dlopen() and dlclose() are not MT-safe? YES, esp. for libthr

Kostik Belousov kostikbel at gmail.com
Fri Mar 24 12:32:33 UTC 2006


On Fri, Mar 24, 2006 at 08:54:34PM +0900, Kazuaki Oda wrote:
> Kostik Belousov wrote:
> > I did understand the purpose of the thread mask code in
> > libexec/rtld/rtld_lock.c, or, more precisely, the condition where this code
> > works (for the context, see the mails with same subject on freebsd-hackers).
> > 
> > Look, that code assumes that blocking async signals would stop thread
> > scheduler from doing preemption of the current thread. This works
> > for libc_r, but fails in libpthread and libthr cases. libpthread provides
> > implementation of the locks for rtld. But libthr does not !
> > 
> > As result, rtld exhibit races when used with libthr. In other words,
> > libthr needs code to do proper locking.
> > 
> > Do you agree ? Does somebody already planned to do this work ?
> > 
> > Best regards,
> > Kostik Belousov
> 
> I'm a bit confused.  Do you mean the following?
> 
> * The current implementation of rtld has a problem both with
>   libpthread and libthr.  It works only with libc_r.
It does not work correctly with libc_r too.
> * In libpthread case, the problem goes away if we modify rtld code.
Yes.
> * In libthr case, in addition to above, we must modify libthr code to
>   provide implementation of the locks for rtld.
Yes.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20060324/e861312a/attachment.pgp


More information about the freebsd-hackers mailing list