Re: [RFC] Proposal for ptrace improvements

From: Jan Kratochvil
Date: Tue Mar 01 2011 - 14:07:13 EST


On Tue, 01 Mar 2011 16:24:57 +0100, Tejun Heo wrote:
> P4. PTRACE_SEIZE
[...]
> Completion notification is delivered in the usual way via wait(2). If
> the task was in jctl stop, it would report the stop signal with the
> matching siginfo. If the task hits an existing ptrace trap condition,
> the matching SIGTRAP will be reported; otherwise, SIGTRAP will be
> reported with siginfo indicating PTRACE_SEIZE trap.

This is a change from the Roland's proposed PTRACE_ATTACH_NOSTOP.
Currently it is already a problem that apps did not / do not expect the first
waitpid after PTRACE_ATTACH may not be SIGSTOP. And in the racy case of
a pending signal during PTRACE_ATTACH which gets delivered by first waidpid
the tracer either crashes or loses the signal etc. (It was a problem for
older GDB, it is fixed in recent GDBs, there exist other ptrace using tools.)

And after all it gets complicated to call PTRACE_ATTACH and then postpone the
reception of SIGSTOP while other signals are being delivered first.


> WAY FORWARD (yeah, I'm feeling some marketing vibe)
> -----------
[...]
> What someone would want if one could start from the scratch is interesting
> but ultimately irrelevant.

The ugdb project provides unified debugging facility for both local and remote
debugging. With the ptrace extensions a network protocol server needs to be
developed/used anyway and it will be just a thin userland layer mapping
read/write calls to the ptrace calls on the server side in an ineffective way.

OTOH one can look at the similar case of TUX/khttpd (also) has never been
merged into the kernel.


Regards,
Jan
--
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/