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

David Xu davidxu at freebsd.org
Sun Mar 26 02:01:03 UTC 2006


在 Saturday 25 March 2006 23:07,Alexander Kabaev 写道:

>  The thread mask only makes sense when flags are per-thread. I meant
> to use it to detect PLT recursions from locking primitives exported to
> rtld by the threads library as those are not allowed and threads
> implementations are required to take special care to provide only
> self-contained locks. 
> 
>  The 'default' lock implementation will not work with any library
> other than libc_r, and even that holds true only for some definition of
> "work". The dynamic loader never had a reliable locking and
> furthermore, there was no way to make it work better without threading
> library cooperation. This is why we came up with a set of callbacks
> rtld expects every threading library to provide. libpthread was the
> first where these callbacks were implemented. It comes as a surprise
> that libthr did not have them, because David Xu was the one who did
> most of the work on rtld locking callbacks in libpthread.
> 
> The def_thread_set_flag function use is racy and should be fixed.
> 
> -- 
> Alexander Kabaev

I have fixed it in libthr yesterday, I think I must forgot to do it in the
past.

Regards,
David Xu


More information about the freebsd-hackers mailing list