ptrace bugs and related problems
In-Reply-To: <[email protected]>
(cc: trimmed)
Quoted 16 lines · Daniel Jacobowitz
Quoted 7 lines
In
do_fork, the result offork_traceflagis assigned to the "trace" variable. Note thatPT_TRACE_VFORK_DONEdoes not cause "trace" to be non-zero.Then we hit this code:
Quoted 8 lines
if (unlikely (trace)) { current->ptrace_message = nr; ptrace_notify ((trace << 8) | SIGTRAP); }That doesn't run. The
ptrace_messageis thus not set whenptrace_notifyis called to send thePTRACE_EVENT_VFORK_DONEmessage. You get random stale data from a previous message.
Quoted 8 lines
Why do you want the message data anyway?
FORK/VFORK/CLONE events have a message: it says what the new process's PID is.
VFORK_DONEdoesn't have a message, because it only indicates that the current process is about to resume; it's an event that only has one process associated with it.I really don't think this is a bug.
Maybe not a bug, but this would be a nice enhancement. It would cost exactly one line of code. I looked at user code I had written and it assumed the message was available (it was, because I was also tracing EVENT_VFORK and it happens to be left over from that.) If we make this a part of the API, future kernel changes wouldn't break this (erroneous) assumption, which otherwise might give someone a nasty surprise in currently-working code.
Otherwise we should zero it out and see what breaks. :)
Signature · 1 line
Chuck