[Lldb-commits] [lldb] [lldb][test] Fix TestMinidumpSizeOfImage.py with glibc >= 2.41 (PR #212972)
David Spickett via lldb-commits
lldb-commits at lists.llvm.org
Thu Jul 30 02:31:30 PDT 2026
https://github.com/DavidSpickett created https://github.com/llvm/llvm-project/pull/212972
Test added by #188363.
In glibc 2.41:
> * 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.
https://lists.gnu.org/archive/html/info-gnu/2025-01/msg00014.html
The test program used for this test provides all the PHDRS itself, but did not include a PT_GNU_STACK entry.
So the loader would assume it wanted exectuable stack. The main program was not using an executable stack and so the loader refused to change that, so loading the object fails.
> dlopen failed: lldb-test-build/functionalities/process_save_core_minidump_size_of_image/TestMinidumpSizeOfImage/libtestlib.so: cannot enable executable stack as shared object requires: Invalid argument
To fix this provide a PT_GNU_STACK with value 6 aka read and write but not execute.
>From 3319a9605073568f6efb18853a4ee2599ee1c80d Mon Sep 17 00:00:00 2001
From: David Spickett <david.spickett at arm.com>
Date: Thu, 30 Jul 2026 09:25:34 +0000
Subject: [PATCH] [lldb][test] Fix TestMinidumpSizeOfImage.py with glibc >=
2.41
In glibc 2.41:
> * 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.
https://lists.gnu.org/archive/html/info-gnu/2025-01/msg00014.html
The test program used for this test provides all the PHDRS itself,
but did not include a PT_GNU_STACK entry.
So the loader would assume it wanted exectuable stack. The main
program was not using an executable stack and so the loader
refused to change that, so loading the object fails.
> dlopen failed: lldb-test-build/functionalities/process_save_core_minidump_size_of_image/TestMinidumpSizeOfImage/libtestlib.so: cannot enable executable stack as shared object requires: Invalid argument
To fix this provide a PT_GNU_STACK with value 6 aka read and
write but not execute.
---
.../TestMinidumpSizeOfImage.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lldb/test/API/functionalities/process_save_core_minidump_size_of_image/TestMinidumpSizeOfImage.py b/lldb/test/API/functionalities/process_save_core_minidump_size_of_image/TestMinidumpSizeOfImage.py
index 81f799dd4c655..c029f4ad36aaf 100644
--- a/lldb/test/API/functionalities/process_save_core_minidump_size_of_image/TestMinidumpSizeOfImage.py
+++ b/lldb/test/API/functionalities/process_save_core_minidump_size_of_image/TestMinidumpSizeOfImage.py
@@ -24,7 +24,7 @@ def build_shared_lib(self):
with open(lds, "w") as f:
f.write(
"PHDRS { ro PT_LOAD FLAGS(5); rw PT_LOAD FLAGS(6);"
- " dyn PT_DYNAMIC FLAGS(6); }\n"
+ " dyn PT_DYNAMIC FLAGS(6); stack PT_GNU_STACK FLAGS(6); }\n"
"SECTIONS {\n"
" . = SIZEOF_HEADERS;\n"
" .hash : { *(.hash) } :ro\n"
More information about the lldb-commits
mailing list