[Ltrace-devel] PIE support

Petr Machata pmachata at redhat.com
Fri Nov 24 17:02:45 CET 2006


Hi

I've written a PIE (position independent executables) support for 
ltrace.  It does its thing the following way:
  a) it reads relative entry point from elf
  b) it reads absolute entry point from auxv, once the binary starts
  c) it adds the difference between these two to the breakpoint addresses

New functions move_breakpoint and dict_delete_entry had to be written to 
support breakpoint moving.

Testsuite was expanded to test all programs also in pie mode, except 
where it can't be done (print_instruction_pointer.exp).  I tested this 
on i386 and x64 (btw, our trunk fails there because of argument handling 
additions).  I did the development on ppc, and am reasonably confident 
it works here, even for ppc64 ltrace vs. ppc32 binary, but never 
actually got around to run the testsuite there.

There is one glitch here in that it might happen that auxv is read 
during dynamic linking.  I've artificially added a delay, which is 
necessary to wait for /proc/pid/auxv to appear anyway, and never hit 
that problem again.  Better ideas welcome.

This is open for comments.

Thanks,
PM
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ltrace-0.5-pie.patch
Type: text/x-patch
Size: 24312 bytes
Desc: not available
Url : http://lists.alioth.debian.org/pipermail/ltrace-devel/attachments/20061124/29d9e37d/ltrace-0.5-pie-0001.bin


More information about the Ltrace-devel mailing list