This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug nptl/24776] pthread_key_create, pthread_setspecific are incompatible with dlmopen


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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]