Check if all possible to implement within a library, or if we need ptrace at all
rbertran opened this issue · 0 comments
rbertran commented
One day we were discussing if it'd be possible to implement everything in a library (no need of ptrace)
- library init: register SIGILL and SIGSEGV handlers. Write ILLEGAL code into the entry points of the region of interest.
- SEGILL handler:
- entry point: gets the context (it receives it), restores illegal instruction, write illegal code to the exit point, protects memory
- exit point: restores illegal instruction, wirtes illegal code to the entry point, unprotects memory.
- SEGSEGV handler:
- in charge of getting memory addresses, contents, and origin code and unprotecting memory (if needed)
Is this implementable? If so, we'll avoid the ptrace 'hacks' ...
Pros: simple (all in one library), maybe less overhead?
Cons: less control of the target process (e.g. unable to track system calls)