process.plt.return probes

Stan Cox scox@redhat.com
Tue Jul 1 18:12:00 GMT 2014


This patch (not fully tested but complete enough to spur discussion) 
adds plt.return.  First, a brief discussion of what the plt (program 
linkage table) and got (global offset table do:

.text
  1. foo@plt jumps to .got.plt entry via .plt entry
    callq 0x1,foo@plt

.plt
  1a. first here
    0x0  jmpq 0xN(%rip) # 0x10
  3. which pushes foo's entry #
    0x4  pushq 0x4c
  4. then jumps to rtld which puts address of foo into .got.plt entry
    0x8  jmpq <rtld>

.got.plt
  1b. second here
  2. then jumps to insn after plt entry jump
  5. so going forward jumps will be here to target
    0x10 jmpq 0x4

The current process.plt mechanism works by setting a probe at the 
.got.plt address.  To allow for process.plt.return probes this mechanism 
has been enhanced as follows:
iterate_over_plt
->query_one_plt
   ->iterate_over_libraries
     has been changed to iterate if there is no .interp; in which case
     each interpreter is tried until success.  (The ldd command uses
     ld-linux --verify; but posix_spawn cannot check errno,
                        so it cannot do something similar, can it?)
     ->pltreturn_library_callback
       looks for entry in the elf symbol table
   if entry found in a library
   then handle as process.function[.return]
   else handle via existing process.plt.statement



-------------- next part --------------
A non-text attachment was scrubbed...
Name: stap-plt.patch
Type: text/x-patch
Size: 10388 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/systemtap/attachments/20140701/1706c534/attachment.bin>


More information about the Systemtap mailing list