lkml.org 
[lkml]   [2011]   [Sep]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2] Make PTRACE_SEIZE set ptrace options specified in 'data' parameter
Hello,

On Thu, Sep 08, 2011 at 08:17:47PM +0200, Oleg Nesterov wrote:
> > There are places which assume ->ptrace is protected by siglock.
>
> Really? Once again, I agree. But _afaics_ currently this is not strictly
> needed. PT_PTRACED/PT_SEIZED should not go away under ->siglock, yes, but
> it seems that it is fine to set them.

Hmmm.... I haven't checked each direction. Maybe we don't strictly
need it on setting it but I definitely was assuming that ->ptrace was
protected by siglock while coding recent ptrace changes. Can't the
following happen?

* ptracer seizes child, sets PT_PTRACED and then OR PT_SEIZED.

* ptracee enters signal delivery path with group stop scheduled.
PT_PTRACED is visible and group stop is transformed into
JOBCTL_TRAP_STOP.

* ptracee enters do_jobct_trap(). PT_SEIZED is still not visible and
it takes the path for the old behavior.

* ptracer SEIZE'd and expects PTRACE_EVENT_STOP but it gets the old
no-siginfo trap.

> > and linking are protected by siglock
>
> Hmm. Could you explain this? Why do want __ptrace_link under ->siglock ?

Because it's much simpler to assume that w/ siglock locked, everything
including ->parent is set up properly w.r.t. ->ptrace.

Thanks.

--
tejun


\
 
 \ /
  Last update: 2011-09-11 04:07    [W:0.052 / U:0.368 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site