[Bug corefiles/31814] gdb >=10 does not load PIE executables correctly for coredumps without mappings and ELF headers
jhb at FreeBSD dot org
sourceware-bugzilla@sourceware.org
Tue May 5 20:14:58 GMT 2026
https://sourceware.org/bugzilla/show_bug.cgi?id=31814
jhb at FreeBSD dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jhb at FreeBSD dot org
--- Comment #2 from jhb at FreeBSD dot org ---
I have a somewhat related (but different) case which is that core dumps on
FreeBSD do not include read-only segments from executables, and currently
FreeBSD doesn't have equivalent support for mapped files ala NT_FILE (though
there is a coredump note that could perhaps function similarly). Normally for
"small" executables when svr4_exec_displacement() runs, it fails to read from
the memory and trusts the displacement from AT_ENTRY. However, if the
executable is "large", then the attempt to read the phdrs at the relocated
address will read some random data from the middle of the executable and try to
use those as PHdrs which results in the comparison failing and the displacement
being ignored. Ideally during svr4_relocate_main_executable() we would not
permit target_read_memory() to read data from the exec target to avoid reading
unrelocated data from the executable, but that doesn't seem easy to fix.
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the Gdb-prs
mailing list