[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20110511170058.GB26383@redhat.com>
Date: Wed, 11 May 2011 19:00:58 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: Tejun Heo <tj@...nel.org>
Cc: jan.kratochvil@...hat.com, vda.linux@...glemail.com,
linux-kernel@...r.kernel.org, torvalds@...ux-foundation.org,
akpm@...ux-foundation.org, indan@....nu
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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists