[patch] Re: dlopen() and dlclose() are not MT-safe?

joerg at britannica.bec.de joerg at britannica.bec.de
Thu Mar 23 12:08:07 UTC 2006


On Thu, Mar 23, 2006 at 12:54:40PM +0200, Kostik Belousov wrote:
> On Thu, Mar 23, 2006 at 05:57:24AM +0900, Kazuaki Oda wrote:
> > BTW do you know the reason why lock is released before calling
> > objlist_call_fini()?  If we don't release the lock, what problem will
> > occur?  deadlock?
> The reasoning behind releasing the lock is to allow calls to dl*()
> functions from constructors/destructors. This is common practice
> and shall be supported. Yes, leaving the lock taken will lead to
> deadlock.

Even worse, e.g. access to Thread Locale Storage or possible even lazily
resolved symbols can result in such calls, making it completely
unpredictable.

> Please, try the following patch and report results. I can run (modified *)
> version of your test for some time without crash with both libpthread
> and libthr.

I don't like this patch, give me some time to think of a better
solution.

Joerg


More information about the freebsd-hackers mailing list