[DynInst_API:] Instrumenting/rewriting position independent binaries


Date: Tue, 29 Dec 2015 18:29:46 +0100
From: Aleksandar Nikolich <anikolich@xxxxxxxxxxxxxx>
Subject: [DynInst_API:] Instrumenting/rewriting position independent binaries
Hi list,

I've been in the process of updating my code to work with new releasesÂ
of Dyninst and noticed one problem in a specific test.Â

Namely, when trying to rewrite binaries compiled as position independent
(for example with gcc -fPIC -pie) the rewritten binary seems to have some sectionsÂ
broken and crashes while starting up. It crashes during load time, doesn't even reach
point of execution.Â

I've attached a minimal test that reproduces the issue.Â
After compiling, running the "test_instrumentation" just rewrites the binary toÂ
the disk as "test_ins". Trying to run "test_ins" crashes during dl_main in ld.so.Â

Curious thing is that if the binary is run with ld.so (like so: /lib64/ld-linux.so ./test_ins) itÂ
executes without problems. This leads me to believe that the problem is in some of theÂ
rewritten sections.Â

Instrumenting PIE binaries does/did work in previous version (at least 8.2 as I was using itÂ
as stable release) but I was unable to pinpoint where it stopped working.Â

So far, I've tested this with 9.0.3 , 9.1 as well as with the latest git tree on Fedora 23/22 x64 and x86.Â

Before I start digging into it, any obvious reasons why this would be happening?Â


Cheers,
Aleks

Attachment: tests.tgz
Description: GNU Zip compressed data

[← Prev in Thread] Current Thread [Next in Thread→]
  • [DynInst_API:] Instrumenting/rewriting position independent binaries, Aleksandar Nikolich <=