Kostik Belousov wrote:
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.

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.

[* You need to allow for errors in dlopen and just continue the loop.]

Patch protects access to the list of unloading objects by bind lock,
and marks the objects that are running finalizers to prevent
simultaneous loading of them.

Also, it comments out code that is completely incomprehensible by my sloppy
brain. Namely, the thread_mask_set stuff seems to allow for the thread
to run as-is if another thread taken the lock. As result, lock is
effectively ignored. I cannot understand purpose of this fragments.
Hope, kan@ describe the reasons.

Thanks. I tried your patch, and the test program did not crash any more. But I needed to modify it as you say. IMHO there are probably programs in the world that don't retry in case of errors in dlopen(), so they still have problems in such case..

--
Kazuaki Oda
_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to