Gdb, PIE and scan_dyntag(DT_DEBUG)

Robert Jarzmik robert.jarzmik@free.fr
Tue Mar 25 20:43:00 GMT 2014


Hello,

I'm pretty sure this was already covered somewhere, so a pointer would be great.

I have a problem with gdb not finding the shared library list when analyzing a
core dump of an ELF-X86-64 binary on Linux.
After putting traces here and there, it boils down to :
 - the executable is placed at a random address (ASLR in linux)
 - the displacement is correctly input in AUXV
 - the linker base is not correctly computed

The trouble lies in the scan_dyntag(DT_DEBUG) called by elf_locate_base() for me
:
 - it tries first target_ops=core_ops, and looks at non-displaced address of
.dynamic => failure => that's great
 - it then tries target_ops=exec_ops, and looks at non-displaced address of
.dynamic => it succeeds, returning 0 => that's my problem
   As the call succeeded, elf_locate_base() won't call scan_dyntag_auxv()

I manually "forced" elf_locate_base() to call scan_dyntag_aux() and then all my
shared libraries appear.

Could somebody tell me what's wrong in my core/executable/whatever, and why GDB
is looking at the executable file .dynamic section before attempting AUXV
AT_BASE reading and memory read accordingly ?

Cheers.

--
Robert

PS: I'm using GDB 7.6. If it was fixed later I'll happily cherry-pick the patch.



More information about the Gdb mailing list