Re: [PATCH 08/14] ptrace: make do_signal_stop() use ptrace_stop() ifthe task is being ptraced

From: Jan Kratochvil
Date: Sun Nov 28 2010 - 15:31:01 EST


On Sun, 28 Nov 2010 20:54:42 +0100, Oleg Nesterov wrote:
> To simplify, suppose that we have a single-thread tracee, and
> debugger "acks" SIGSTOP, say, it does ptrace(PTRACE_CONT, SIGSTOP).

I do not find this case useful. It happens with current GDB:
(gdb) handle SIGSTOP
Signal Stop Print Pass to program Description
SIGSTOP Yes Yes Yes Stopped (signal)
^^^
But it behaves weird anyway:

ptrace(PTRACE_CONT, 11799, 0x1, SIGSTOP) = 0
wait4(-1, [{WIFSTOPPED(s) && WSTOPSIG(s) == SIGSTOP}], WNOHANG, NULL) = 11799
[...]
ptrace(PTRACE_CONT, 11799, 0x1, SIGSTOP) = 0
<no new signal received>:
State: S (sleeping)
TracerPid: 11797

So the first time it immediately gets reported and the second time it gets
lost. (kernel-2.6.35.6-48.fc14.x86_64)


> Before this patch, the tracee stops in TASK_STOPPED, now it calls
> ptrace_stop() and goes to TASK_TRACED state.
>
> Add Jan. I hope this is OK, but this might break the tracer if
> it looks into fs/proc (probably only test-cases do this).

ptrace(PTRACE_CONT, SIGSTOP) should just work somehow so that current GDB does
not break as it calls it sometimes. The behavior of it may change I guess.

I find only interesting that (PTRACE_DETACH, SIGSTOP) should really keep it
stopped and also the attaching to `T (stopped)' should work with all the
issues of waited-for/unwaited-for SIGSTOP. Those cases are not being
discussed here.


Thanks,
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/