I have an ELF
shared object, and I want to modify it so that calls to the system function memcpy
are actually routed through to a custom version of memcpy
.
I've been researching and I have read about PLT
Redirection and ELF
Infection, but I'm still not sure how I can accomplish my goal.
Can anyone give me some hint and tips, or elaborate on the PLT
Redirection and ELF
Infection?
Regards,
Paul
Have you tried the -wrap
option to ld when you link your executable? It should redirect the symbol so that all calls to the original function, including those inside libraries, will go to your replacement.
See this example.
[Edit: The above commenter is correct in pointing out that if the library inlined calls to memcpy, you have no recourse short of rebuilding the library.]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With