moving instructions to another address
Sebastian Wick
sebastian@sebastianwick.net
Fri Jun 7 16:48:00 GMT 2013
>> Is there something in binutils I
>> can use to make it safe?
>
> Sorry no.
Well, thanks anyway.
>> And is it even possible?
>
> Possible yes. But to do it in a clean portable way that will
> continue to work as operating systems evolve - probably not.
Good to know. I should search another way, then.
> There are similar sorts of things that you might want to consider -
> overlays for example, or ifuncs, or even the breakpoint mechanism
> used
> by debuggers.
AFAIK the breakpoint mechanism uses system calls and signals. I'd guess
that it's slow and that's why I'd like to avoid it if possible.
I took a look at ifuncs and overlays and I think that you need controll
over the startup process to use it (e.g. you can't do it on the fly).
Maybe it's better if I just tell why I need this kind of functionality:
I want to be able to hook a few OpenGL functions to record a video.
This is easy with LD_PRELOAD but the problem is the usability.
Some games reset LD_PRELOAD in their start scripts so you'd have to
edit those scripts and you can only record games which are started with
LD_PRELOAD set but not the ones started before. I could simply use
ld.so.preload config file but it's too intrusive.
I also tried to modify the relocation entries but some OpenGL functions
don't seem to have those and if a program uses dlsym this doesn't work,
too.
More information about the Binutils
mailing list