This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug nptl/24776] pthread_key_create, pthread_setspecific are incompatible with dlmopen
- From: "fweimer at redhat dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Mon, 08 Jul 2019 09:41:54 +0000
- Subject: [Bug nptl/24776] pthread_key_create, pthread_setspecific are incompatible with dlmopen
- Auto-submitted: auto-generated
- References: <bug-24776-131@http.sourceware.org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=24776
--- Comment #5 from Florian Weimer <fweimer at redhat dot com> ---
(In reply to Carlos O'Donell from comment #4)
> Back to the question at hand. If the user supplied destructor calls
> malloc/free then as long as we run it in the original namespace the objects
Note that there is no concept of “running code in a namespace”. The code *is*
the namespace (at least until we gain support for a FDPIC architecture, where
things could be different).
> will be correctly allocated and released in the right place. If the user
> supplied destructor calls a shared-rtld function (directly or indirectly)
> which returns a pointer that the destructor must free, then the underlying
> shared-rtld functions must be of the kind I describe above as "acts on
> *behalf* of another API" and so must also come from the enclosing namespace.
True, but I think we should just not add such a function that uses the generic
free. There can only be one rtld, so performing tasks in rtld in the non-base
namespace will always be problematic. See what we have to do with dlerror to
make things work properly.
> One way to solve this is:
> * Consider the space used by pthread_setspecific to be an "implementation
> detail" and use a new rtld_calloc() function to allocate it from rtld.
> * Subsequent frees in __nptl_deallocate_tsd use rtld_free().
Another approach would introduce per-link map thread destructors. Which one is
better is hard to tell. There are likely interactions between dlmopen and
threads that are much harder to solve anyway.
--
You are receiving this mail because:
You are on the CC list for the bug.