Re: [RFC] Proposal for ptrace improvements

From: Denys Vlasenko
Date: Wed Mar 02 2011 - 20:30:39 EST


On Thursday 03 March 2011 01:47, Indan Zupancic wrote:
> On Wed, March 2, 2011 14:32, Oleg Nesterov wrote:
> > On 03/02, Tejun Heo wrote:
> >> On Wed, Mar 02, 2011 at 06:07:35AM +0100, Indan Zupancic wrote:
> >> > I'm not sure what Denys is talking about: Currently it's impossible to
> >> > pass along SIGSTOP to traced processes. Quoting the ptrace manpage:
> >> >
> >> > PTRACE_CONT
> >> > Restarts the stopped child process. If data is nonzero and not
> >> > SIGSTOP, it is interpreted as a signal to be delivered to the
> >> > child; otherwise, no signal is delivered.
> >>
> >> AFAICS, that's not true. SIGSTOP isn't treated differently from other
> >> signals in the ptrace signal delivery path. Maybe it was true in the
> >> past.
> >
> > Yes, this is not true. And it seems this was never true.
> >
> > This is the second time this manpage confuses people in this discussion,
> > probably it should be fixed...
>
> Passing SIGSTOP does not actually stop the traced task, which is in line
> with what the manpage says. All it does is generating that second SIGSTOP
> notification, but when the task is continued it's running, not stopped.

It can be argued that after this the task is running _precisely_
because it was continued by the debugger.

> So ptraced tasks can't be stopped with SIGSTOP and continued with SIGCONT.

It can be stopped - just do not PTRACE_CONT it after second SIGSTOP
notification.

The bug is that it can't be continued with SIGCONT after that.

That's the gist of Tejun Heo's proposal.

Oleg's proposal is a bit different. It proposes that we do need
to do PTRACE_CONT after second SIGSTOP notification too,
but task will be indeed stopped after this, and resumed
when SIGCONT arrives.

--
vda
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/