[PATCH] Also use l_tls_dtor_count to decide on object unload

Roland McGrath roland@hack.frob.com
Thu Jul 9 20:43:00 GMT 2015


> 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.

That sounds like a user-visible bug, which should have both a BZ# and a
concrete test case for a -z nodelete object or some such case that would
demonstrate the bug.

> --- a/stdlib/tst-tls-atexit.c
> +++ b/stdlib/tst-tls-atexit.c
> @@ -82,7 +82,14 @@ do_test (void)
>    if (thr_ret != NULL)
>      return 1;
>  
> -  /* Now this should unload the DSO.  */
> +  /* Now this sequence should unload the DSO.  */
> +  handle = dlopen ("$ORIGIN/tst-tls-atexit-lib.so", RTLD_LAZY);
> +  if (!handle)

No implicit Boolean coercion.



More information about the Libc-alpha mailing list