When the tracee resumes from TASK_TRACED, context->options can be changed.
Introduce ptrace_event->ev_options. If a callback sets ->ev_options != 0, do_ptrace_resume() checks that context->options matches or discards the event. This will be used to validate PTRACE_EVENT_VFORK_DONE and SYSCALL_EXIT reports. --- kernel/ptrace.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) --- PU/kernel/ptrace.c~37_EV_OPTIONS 2009-09-15 18:05:42.000000000 +0200 +++ PU/kernel/ptrace.c 2009-09-15 18:06:53.000000000 +0200 @@ -31,6 +31,8 @@ struct ptrace_event { int ev_code; unsigned long ev_message; resume_func_t ev_resume; + + int ev_options; }; struct ptrace_context { @@ -1007,9 +1009,13 @@ static void do_ptrace_resume(struct utra if (ev->ev_resume) ev->ev_resume(engine, tracee, data); - if (!ev_empty(context)) { - do_ptrace_notify_stop(context, tracee); - return; + while (!ev_empty(context)) { + int ev_o = ev_current(context)->ev_options; + if (!ev_o || (ev_o & context->options)) { + do_ptrace_notify_stop(context, tracee); + return; + } + ev_pop(context); } }