Messages in this thread | | | Date | Sun, 20 Feb 2011 22:19:13 +0100 | From | Oleg Nesterov <> | Subject | Re: `(T) stopped' preservation after _exit() [Re: [PATCH 1/1] ptrace: make sure do_wait() won't hang after PTRACE_ATTACH] |
| |
On 02/20, Jan Kratochvil wrote: > > On Sun, 20 Feb 2011 21:38:19 +0100, Oleg Nesterov wrote: > > > > This doesn't explain why the kernel should restore TASK_STOPPED. > > Suppose the tracee creates the file when it was run under debugger, > > should the kernel remove this file after detach? > > No, opening such file is like writing data into a file.
OK, let it be writing data into a file. But in this case the kernel shouldn't truncate the file after detach or if the tracer crashes ;)
> > And, if SIGCONT comes in between, the tracee is no longer stopped. It needs > > another SIGSTOP, gdb can do this via ptrace(DETACH, SIGSTOP). > > It cannot if it crashes in between.
Yes,
> It would be OK if it can do so right > after the inferior call. Which I realize now it can, after the inferior call > returns (wait->SIGTRAP) GDB can do PTRACE_CONT(SIGSTOP), wait->SIGSTOP and now > it can do PTRACE_GETREGS etc. while after _exit() it will be like after > PTRACE_DETACH(0) and the debuggee still remains `(T) stopped', doesn't it?
Yes. Or gdb can just send SIGSTOP to the tracee.
Modulo other bugs we have, but these bugs should be fixed anyway.
For example, once again, PTRACE_DETACH/PTRACE_CONT can ignore SIGXXX. I never knew if it was designed this way or this should be fixed, but there is one particular case which looks like the oversight to me: If the tracee reports SIGTRAP after it steps into the signal handler, then SIGXXX is ignored after PTRACE_CONT/DETACH (and this btw affects gdb).
Oleg.
| |