Re: dlopen() and dlclose() are not MT-safe?
- From: Kazuaki Oda <kaakun@xxxxxxxxxxxxx>
- Date: Thu, 23 Mar 2006 05:57:24 +0900
Kostik Belousov wrote:
Oops. Completely reversed condition in the if. :(. Also, I don't think it
shall returns the error in this situation. New take:
Index: libexec/rtld-elf/rtld.c
===================================================================
RCS file: /usr/local/arch/ncvs/src/libexec/rtld-elf/rtld.c,v
retrieving revision 1.112
diff -u -r1.112 rtld.c
--- libexec/rtld-elf/rtld.c 24 Dec 2005 15:37:30 -0000 1.112
+++ libexec/rtld-elf/rtld.c 22 Mar 2006 19:03:12 -0000
@@ -1688,6 +1688,11 @@
wlock_release(rtld_bind_lock, lockstate);
objlist_call_fini(&list_fini);
lockstate = wlock_acquire(rtld_bind_lock);
+ if (root->refcount != 0) {
+ wlock_release(rtld_bind_lock, lockstate);
+ return 0;
+ }
+
objlist_remove_unref(&list_fini);
/* Finish cleaning up the newly-unreferenced objects. */
Thanks. I applied your patch and ran the test program once more.
When linked with libpthread:
% ./dltest
Segmentation fault (core dumped)
When linked with libthr:
% ./dltest
ld-elf.so.1: assert failed: /usr/src/libexec/rtld-elf/rtld.c:1728
In libpthread case, the result was changed. I got no "assert failed"
message, and it took longer time to crash than before. In libthr
case, I could not find any difference.
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?
--
Kazuaki Oda
_______________________________________________
freebsd-hackers@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@xxxxxxxxxxx"
- Follow-Ups:
- [patch] Re: dlopen() and dlclose() are not MT-safe?
- From: Kostik Belousov
- [patch] Re: dlopen() and dlclose() are not MT-safe?
- References:
- dlopen() and dlclose() are not MT-safe?
- From: Kazuaki Oda
- Re: dlopen() and dlclose() are not MT-safe?
- From: Kostik Belousov
- Re: dlopen() and dlclose() are not MT-safe?
- From: Kostik Belousov
- dlopen() and dlclose() are not MT-safe?
- Prev by Date: Re: newbus questions
- Next by Date: Re: newbus questions
- Previous by thread: Re: dlopen() and dlclose() are not MT-safe?
- Next by thread: [patch] Re: dlopen() and dlclose() are not MT-safe?
- Index(es):
Relevant Pages
|