This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Execve() again


I need to modify how programs are loaded for Linux (x86).

I am planning on putting tags in the symbol table, and then
using them as pointers into the code to change the code
at run-time.

I already have the symbol table setup, now I just need
to modify the application's code when it loads.
All I need to do is change values passed to a pushl instruction,
which are tagged by my symbols I have added to the symbol table.

For example:

pushl $12345678
call    foo

could be changed to

pushl $87654321
call     foo

at run-time

I am using the symbol table, because it seems like a good place to
store the locations of these instructions.  Then, when the program loads,
I will run through the symbols, and change the correct bytes as needed.

I am assuming I need to modify execve() to do this, or
can this be done otherwise?


System: Redhat Linux 9 x86 arch

Regards,
Brian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]