On Thu, May 06, 2021 at 08:00:56AM -0600, Todd C. Miller wrote:
> On Thu, 06 May 2021 09:32:28 +0200, Sebastien Marie wrote:
> 
> > We already take care of such situation with __cxa_thread_atexit_impl
> > (in libc/stdlib/thread_atexit.c), by keeping an additionnal reference
> > on object loaded (it makes ld.so aware that it is still used and so
> > dlclose() doesn't unload it).
> >
> > I used the same idiom for pthread_key_create() and used dlctl(3) in
> > the same way with the destructor address.
> 
> This will set STAT_NODELETE so the DSO will never really get unloaded.
> That's not a problem for atexit() since the process is headed for
> the exit.
> 
> I'm less sure about using it here since we don't have a way to
> unreference the DSO upon pthread_key_delete().

For sure I don't fully appreciate the complexities involved here, but is
it possible to store the shared object handle along with the destructor
when the reference count is incremented in the above patch? Then we
could use that to decrement the reference.

> 
>  - todd

Thanks for looking into this.

Regards,
Anindya

Reply via email to