Re: [RFC] Proposal for ptrace improvements

From: Tejun Heo
Date: Wed Mar 02 2011 - 02:32:44 EST


Hey,

On Tue, Mar 01, 2011 at 11:59:02PM +0100, Denys Vlasenko wrote:
> Currently strace has to keep precise track on the alternating sequence
> of syscall enter/syscall exit stops. Which gets even trickier
> with extra magic SIGTRAP thrown in by execve and such.

I see. Yeah, it would be a good idea to make sure each trap condition
can be uniquely identified by siginfo and this should definitely be
documented in the man page.

> There were (and I suspect will be) hard to debug bugs when strace
> was getting out-of sync and printing garbage.
>
> Defining the PTRACE_GETSIGINFO's si_code so that each of these stops
> can be easily distinguished would be useful. I propose using values
> of SI_KERNEL + 1, SI_KERNEL + 2 etc, suitably #defined of course.
>
>
> We also have magic SIGSTOPs (magic in a sense they aren't
> real signals sent by other processes):
> * at PTRACE_ATTACH
> * in child (if PTRACE_O_TRACE[V]FORK or PTRACE_O_TRACECLONE opt is on)
>
> For example, flagging PTRACE_ATTACH SIGSTOP so that it can be
> uniquely identified would solve some problems gdb is having with it.

This, I don't agree with. All we need is a better attach call without
the implied SIGSTOP, there's no reason to diddle with PTRACE_ATTACH
further.

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/