Re: [RFC] Proposal for ptrace improvements

From: Tejun Heo
Date: Wed Mar 02 2011 - 06:28:55 EST


On Wed, Mar 02, 2011 at 12:21:28PM +0100, Denys Vlasenko wrote:
> > I think WSTOPSIG should be SIGTRAP as the tracee left group stop and
> > entered ptrace trap.
>
> This would be, by my count, 13th kind of SIGTRAP use by ptrace.
> Which makes multi-level if's in debuggers even more complex
> and more error-prone.

Of course, all ptrace traps are SIGTRAPs.

> Why not SIGCONT? This event is, after all, caused by SIGCONT.
> It would be so much nicer to be able to detect it with single if()
> in the debugger...

I disagree. It's a ptrace trap. It should use SIGTRAP. We just need
well defined siginfo output to distinguish between them. It's not
like we can avoid siginfo anyway.

> > No, it's not a signal delivery notification.  It's a ptrace trap
> > notification.  SIGCONT may not be delivered to this task.  Please
> > remember that it's the emission of SIGCONT which ends a group stop,
> > not delivery.
>
> From userspace POV it's really a kernel's implementation detail.

Not really. This is actually a visible difference. Roland wrote in
the previous discussion. One visible difference is that ptrace can
veto job control stop but it can't veto the end of job control. Job
control actions happen before SIGCONT hits the signal delivery path
which is visible through ptrace.

> >> (b) does PTRACE_CONT(<other_sig>)? or
> >> (c) does PTRACE_CONT(0)?
> >
> > See above.
>
> This means that SIGCONT handler will be executed in the tracee
> after debugger does PTRACE_CONT(<any_signo>) at this point.
>
> Which makes SIGCONT special: debugger can suppress execution
> of other signal handlers in tracee, but not SIGCONT handler.
> Another special case. Can we avoid having it?

Hmmm.... I think you're confused about how SIGCONT is handled or maybe
I am. Either way, please elaborate. I can't really follow.

Thanks.

--
tejun
--
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/