Open R3x opened 4 years ago
We will be using pin/source/tools/Replay/call_function_natively.cpp as a reference to build the tool. Most of the API Calls this tool uses are useful in building the final ptrace patch tool. I will be pushing the skeleton code for hooking the ptrace function soon.
@R3x I would like to know how we would be proceeding with the tool. Will it be used for on the fly patching during runtime(by integrating into another tool)?
@adityavardhanpadala I would prefer to see things patched using Intel pin itself. But if that's not possible please - dump the addresses that need to be patched and write a wrapper that does the patching.
Understood.
I will go through 'call_function_natively.cpp' . @R3x about dumping the addresses, how will we know that these addresses can't be patched, are there any exceptions that we need to handle?
@masterugwee All you need to make sure is that you are not trying to patch a library function since we are not sure what all library functions may be using ptrace internally. However we need to patch all calls to ptrace@plt. There might be cases where the return value of ptrace is used but we can't do anything about that.
Other targets for patching would be calls to sleep, SIGALRM and also int3 instructions in the code. These may lead to issues in the code but its a risk we have to take.
That makes sense. Thanks @R3x
Basic ptrace patcher