[Bug dynamic-link/31168] ld.so startup segfaults if constructor does dlopen with RTLD_GLOBAL

srk31 at srcf dot ucam.org sourceware-bugzilla@sourceware.org
Wed Dec 4 05:53:46 GMT 2024


https://sourceware.org/bugzilla/show_bug.cgi?id=31168

--- Comment #2 from Stephen Kell <srk31 at srcf dot ucam.org> ---
After a bit more investigation I think this bug has been present for a long
time. It is certainly observable in 2.27, but seems to surface more easily from
around 2.30 and later, following the refactoring that split
`add_to_global_resize` from `add_to_global_update`.

However, I've learned from elsewhere
(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56393#c9) that glibc's ld.so does
not support the initfirst flag for general use, owing to its being monopolised
by libpthread (the loader's code assumes that at most one object sets the
flag).

Note that my reproducer does not use libpthread, so it should in principle
work. However, I infer that as long as libpthread doesn't need to `dlopen` in a
constructor, this bug will not be prioritised for fixing. So I will instead
find a way to initialize my runtime without the help of initfirst.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Glibc-bugs mailing list