moving instructions to another address
Sebastian Wick
sebastian@sebastianwick.net
Sat May 18 14:18:00 GMT 2013
Hi,
I'm not sure if this is the right place to ask but I'll do it
nevertheless.
Currently I try to write a library which can hook into any function you
know the address of. That means that the lib overwrites to first few
instructions of the function with a jmp (or something similar) to
another function. If you want to call the original function you need to
execute the instructions which are overwritten by the jmp instruction.
The lib currently mmaps memory and writes them there (trampoline). This
somehow worked well but I'm sure that moving instruction to another
address may cause undefined behavior. Is there something in binutils I
can use to make it safe? And is it even possible?
I'd love to hear your thoughts about it.
Regards,
Sebastian
More information about the Binutils
mailing list