According to the ptrace
documentation.
Stop the tracee at the next
clone(2)
and automatically start tracing the newly cloned process, which will start with aSIGSTOP
, orPTRACE_EVENT_STOP
ifPTRACE_SEIZE
was used.
The problem is that SIGSTOP
may not be caused by ptrace
at all - even the user can send this signal to the process. Child process being stopped by PTRACE_EVENT_STOP
would be more than perfect in this case.
I'm spawning a child process myself so using PTRACE_TRACEME
is the best way to start tracing it - it's free of race conditions. If I insist on using PTRACE_SEIZE
instead, the child process may have already exited before I call PTRACE_SEIZE
in the parent process.
Is there any way to prevent the child process from receiving a plain SIGSTOP
when tracing with PTRACE_TRACEME
?