Messages in this thread |  | | | Date | Wed, 11 May 2011 19:00:58 +0200 | | From | Oleg Nesterov <> | | Subject | Re: [PATCH 10/11] ptrace: move JOBCTL_TRAPPING wait to wait(2) and ptrace_check_attach() |
| |
On 05/11, Oleg Nesterov wrote: > > You know, I'd wish I could find the serious bugs in this patch. The > code becomes really hairy. -EAGAIN in do_wait() doesn't make it more > simple ;)
Mwahaha! I seem to see the bug ;)
bool ptrace_wait_trapping(struct task_struct *child) __releases(&child->sighand->siglock) __releases(&tasklist_lock) { if (likely(!(child->jobctl & JOBCTL_TRAPPING))) return false; spin_unlock_irq(&child->sighand->siglock); get_task_struct(child); read_unlock(&tasklist_lock);
--> WINDOW
wait_event(current->signal->wait_chldexit, !(child->jobctl & JOBCTL_TRAPPING)); put_task_struct(child); return true; } When the caller is do_wait(), we can't assume we are the tracer when we drop tasklist. Original tracer can detach, then another unrelated process can attach again and provoke JOBCTL_TRAPPING. wait_event() can hang forever.
Unfortunately, this is easy to fix :/
Oleg.
|  |