[SCM] kernel ptrace bug

Dmitry V. Levin ldv at altlinux.org
Fri Mar 11 12:12:32 UTC 2011


On Fri, Mar 11, 2011 at 02:02:15AM +0300, Dmitry V. Levin wrote:
> P.S.  While testing these changes, I've spotted a bug.
> Try to run "cat > /dev/null & strace -p $!", it looks like some
> stop signals are not actually delivered to traced processes.

I believe this is a kernel bug.  The first SIGCHLD informs tracer
about a signal being sent to its tracee (si_code is CLD_TRAPPED).
The second SIGCHLD informs tracer that its tracee is being stopped
(si_code is CLD_STOPPED).
A PTRACE_SYSCALL issued after CLD_STOPPED results to the tracee being
continued instead of stopped.  And without that PTRACE_SYSCALL,
the tracee remains trapped until its tracer detached.
That is, the tracee remains trapped in both cases, and there seems to be
no way to actually place it in that stopped state reported by kernel.
As result, no job control will ever work under ptrace.


-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20110311/e8b6a373/attachment.bin>


More information about the Strace-devel mailing list