Re: [PATCHSET ptrace] ptrace: implement PTRACE_SEIZE/INTERRUPT andgroup stop notification, take#4

From: Tejun Heo
Date: Thu Jun 02 2011 - 21:34:35 EST


Hello, Oleg, Denys.

On Thu, Jun 02, 2011 at 11:09:44PM +0200, Denys Vlasenko wrote:
> > and signr is roughly calculated as
> >
> > if (group_stop_count || SIGNAL_STOP_STOPPED)
> > signr = jobctl & JOBCTL_STOP_SIGMASK;
> > else if (JOBCTL_TRAP_NOTIFY)
> > signr = SIGCONT;
> > else
> > signr = SIGTRAP; // PTRACE_INTERRUPT
> >
> > In this case we can avoid all siginfo changes. The tracer does wait(status)
> > anyway, it can see the state without GETSIGINFO. The only problem, the tracer
> > should be careful to avoid the confusion with ptrace_signal(), it should
> > check status & (PTRACE_EVENT_STOP << 16).
> >
> > What do you think?

Yeap, it makes sense.

> This should alleviate Linus' concerns that we are suffering from unnecessary
> featuritis - that we invent API which is significantly different
> from existing one, and as such users will not use it.
>
> Existing API doesn't use GETSIGINFO data per se to distinguish group-stop from
> signal-delivery-stop, it uses the fact that GETSIGINFO fails on group-stop.
> (Well, arguably it's not a "designed" API, more like "accidentally created API",
> but nevertheless it exists right now). Oleg's proposal means that the new way
> may be makde to work very similarly.

Okay, you want to preserve %NULL SIGINFO on all STOP traps. Dropping
si_pt_flags and using exit_code makes sense but I think we'll be
better off enabling GETSIGINFO. The affected part of code has to be
changed anyway and with %NULL GETSIGINFO we effectively would have
driven ourselves into corner if more information needs to be added
later on. Don't current users unconditionally issue CONT(sig) anyway?

> The less we deverge in handling of group-stop from existing API while fixing it,
> the better. If the only thing strace needs to change is to issue PTRACE_LISTEN
> instead of PTRACE_CONT on group-stop, then it's wonderful.
>
> I understand that this patchset doesn't do exactly that yet, but it appears
> it can be achieved relatively easy by a future change. Don't take this
> as a request to respin the patchset yet again.

Heh, don't worry about re-spinning. It's only take#4 now after all. :)

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/