| Issue |
174191
|
| Summary |
[BOLT] -use-gnu-stack removes the PT_GNU_STACK segment, preventing dlopen from working
|
| Labels |
BOLT
|
| Assignees |
|
| Reporter |
glandium
|
In glibc 2.41 this change occurred:
> dlopen and dlmopen no longer make the stack executable if a shared library requires it, either implicitly because of a missing GNU_STACK ELF header (and default ABI permission having the executable bit set) or explicitly because of the executable bit in GNU_STACK, and the stack is not already executable. Instead, loading such objects will fail.
(source: https://lists.gnu.org/archive/html/info-gnu/2025-01/msg00014.html)
The default ABI permission for GNU_STACK is executable on at least x86_64 Linux, which means that without the GNU_STACK segment without the executable bit, glibc will assume the binary wants an executable stack. And if that binary is dlopen'ed, dlopen may fail with the error: "cannot enable executable stack as shared object requires: Invalid argument".
The problem is that when a PT_GNU_STACK segment exists in the pre-bolt binary, bolt removes it if `-use-gnu-stack` is used, because it replaces the PT_GNU_STACK segment with a new PT_LOAD segment.
For the record, this was detected by building clang itself with BOLT, and using the resulting clang to build Firefox, which, during its configure, checks symbols in the libclang.so dynamic library. The dlopen complains about libLLVM.so.21.1 having the executable stack.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs