Re: [DynInst_API:] Is DynInst_API the right tool for a simple binary rewriting task? If not, what is?


Date: Wed, 8 Jan 2014 12:20:33 +0000
From: "E.Robbins" <er209@xxxxxxxxxx>
Subject: Re: [DynInst_API:] Is DynInst_API the right tool for a simple binary rewriting task? If not, what is?
Have you considered using LD_PRELOAD to override the called functions, insert your own code, then call the real function?

Ed

________________________________________
From: Dyninst-api [dyninst-api-bounces@xxxxxxxxxxx] on behalf of Chad Renton [ratehead@xxxxxxxxx]
Sent: 08 January 2014 01:02
To: dyninst-api@xxxxxxxxxxx
Subject: [DynInst_API:] Is DynInst_API the right tool for a simple binary rewriting task? If not, what is?

Hello,

This is very much a newbie question, and I apologize if this is the
incorrect forum for that.

I need to modify binary programs to insert arbitrary code before a
function is called (initially "main" would be good enough).

Well, I suppose I should take a step back.  I really wish to call a
script at that point in the binary, and am thinking the best way to do
this is to insert arbitrary code.  I'd like it if the script could
take the arguments to the function call, but it's not completely
necessary.

I've been looking at DynInst, and it appears to be the right tool.
I've also seen PatchAPI, but before I investigate further, can you
tell me whether I'm barking up the wrong tree?  I've not seen any
examples of such things after searching, so I want to be sure.

Also, if this is an easy task with Dyninst or PatchAPI, any help on
where to look (or how to do it) would be much appreciated.  An example
of the minimum (calling an arbitrary function before "main" begins
executing) would be especially useful.

Thanks,

Chad
_______________________________________________
Dyninst-api mailing list
Dyninst-api@xxxxxxxxxxx
https://lists.cs.wisc.edu/mailman/listinfo/dyninst-api

[← Prev in Thread] Current Thread [Next in Thread→]