'how to detach a tracee and a new tracer takes over the tracee using ptrace
I want to detach a tracee while traced by PTRACE_SEIZE, and let a new tracer to trace the free tracee.
My steps as below:
1. ptrace(PTRACE_SEIZE, pid, ...)
// this stop is not a signal_delivery_stop, a PTRACE_EVENT stop by PTRACE_O_CLONE
2. waitpid(pid, NULL, 0)
3. ptrace(PTRACE_DETACH, pid, ...)
4. new tracer calls:ptrace(PTRACE_SEIZE, pid, ...)
However, the tracee is resume while detaching it. How to detach tracee and keep it stopped, then let new tracer to attach it?
Otherwise, shall change the stopping state of tracee to singal_delivery_stop and then we can inject SIGSTOP signal? how to implement that?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
