[PATCH v4] Also use l_tls_dtor_count to decide on object unload (BZ #18657)
Ondřej Bílka
neleai@seznam.cz
Thu Jul 16 20:15:00 GMT 2015
On Wed, Jul 15, 2015 at 04:40:25PM +0530, Siddhesh Poyarekar wrote:
> v4: Take the big lock for a longer duration during destructor
> registration.
>
> When an TLS destructor is registered, we set the DF_1_NODELETE flag to
> signal that the object should not be destroyed. We then clear the
> DF_1_NODELETE flag when all destructors are called, which is wrong -
> the flag could have been set by other means too.
>
> This patch replaces this use of the flag by using l_tls_dtor_count
> directly to determine whether it is safe to unload the object. This
> change has the added advantage of eliminating the lock taking when
> calling the destructors, which could result in a deadlock. The patch
> also fixes the test case tst-tls-atexit - it was making an invalid
> dlclose call, which would just return an error silently.
>
> Change verified on x86_64; the test suite does not show any
> regressions due to the patch.
>
Now this looks ok for me.
More information about the Libc-alpha
mailing list