]> CyberLeo.Net >> Repos - FreeBSD/stable/8.git/commit
MFC r216489:
authorjh <jh@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Thu, 3 Mar 2011 17:12:24 +0000 (17:12 +0000)
committerjh <jh@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Thu, 3 Mar 2011 17:12:24 +0000 (17:12 +0000)
commitefc2fe23252979a1591a433d7844e695308fb442
tree1de05aa8e82b23e2e7b4c3211c3148c167af2715
parentd1076883a86d652939f585f2ba1b9a2a8b13cb46
MFC r216489:

If dlclose() is called recursively from a _fini() function, the inner
dlclose() call may unload the object of the outer call prematurely
because objects are unreferenced before _fini() calls.

Fix this by unreferencing objects after calling objlist_call_fini() in
dlclose(). Therefore objlist_call_fini() now calls the fini function if
the reference count of an object is 1. In addition we must restart the
list_fini traversal after every _fini() call because another dlclose()
call might have modified the reference counts.

Add an XXX comment to objlist_call_fini() about possible race with
dlopen().

PR: 133246, 149464

git-svn-id: svn://svn.freebsd.org/base/stable/8@219237 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
libexec/rtld-elf/rtld.c