I think that's wrong. When the tracer dies unceremoniously, the tracee should continue as if it had not been traced. Your change makes it swallow a normal signal waiting to be delivered, and then resume as if noone had ever sent a signal. There is indeed a longstanding problem for tracing-induced signals (e.g. SIGTRAP for single-step or exec). One can be queued but not yet delivered while the tracer detaches or dies, and then it gets delivered to the unsuspecting process without any debugger to intercept it. I plan to address that eventually, but there is no quick fix for it. In the non-signal (ptrace_notify) cases, we don't have the queuing issue. But it's still not as simple as checking current->ptrace to decide whether to follow current->exit_code or clear it. When PTRACE_DETACH is called with a parting signal (nonzero data argument), the tracee will wake up to see current->ptrace = 0 and current->exit_code = signo and it is explicitly intended to act on signo rather than ignore it. The particular case you mentioned could be addressed by something like this: --- a/kernel/signal.c +++ b/kernel/signal.c @@ -1654,6 +1654,9 @@ static void ptrace_stop(int exit_code, i spin_lock_irq(¤t->sighand->siglock); current->last_siginfo = NULL; + if (current->exit_code & ~0x7f) + current->exit_code = 0; + /* * Queued signals ignored us while we were stopped for tracing. * So check for any that we should take before resuming user mode. But that only catches the PTRACE_O_TRACESYSGOOD cases, and not bare SIGTRAP. To be clean, there is no way to distinguish a left-over SIGTRAP that ought to be ignored from an intentional SIGTRAP placed there by the debugger for the tracee to deliver. (Granted passing SIGTRAP through after a syscall is rarely or never done. But that doesn't make a special-case kludge right.) I do very much appreciate the concerns that motivated your change, and share them. But you can see that this is a small part of a large can of worms. It has been this way for a long time. I am working steadily towards new ways to clean up the entire picture. In the meantime, I don't really favor any marginal changes like this that complicate the behavior with more special cases that address only a tiny corner of the whole set of problems. Thanks, Roland --
| Ingo Molnar | Re: [patch] paravirt: VDSO page is essential |
| Johannes Weiner | Re: Versioning file system |
| Matt Mackall | [PATCH 1/13] maps: Uninline some functions in the page walker |
| Greg KH | [patch 00/49] 2.6.25-stable review |
git: | |
| Johannes Schindelin | Re: [PATCH 1/4] Move redo merge code in a function |
| Dmitry Potapov | Re: [RFC] Git User's Survey 2008 |
| Johannes Schindelin | Re: [PATCH] Teach 'git apply' to look at $GIT_DIR/config |
| Shawn O. Pearce | Re: [kernel.org users] [RFD] On deprecating "git-foo" for builtins |
| Brian A. Seklecki | sshd_config(5) PermitRootLogin yes |
| Richard Stallman | Real men don't attack straw men |
| ropers | Re: low-MHz server |
| Diego Fernando Nieto Moreno | Intel DG33 Support |
| Holger Schurig | Re: Linux Wireless Mini-Summit -- Ottawa -- July 22, 2008 |
| Tilman Schmidt | Re: 2.6.25-rc8: FTP transfer errors |
| Eric Dumazet | Re: [rfc][patch 3/3] use SLAB_ALIGN_SMP |
| Lennert Buytenhek | [PATCH 21/39] mv643xx_eth: move port_receive() into its only caller |
| high memory | 14 hours ago | Linux kernel |
| semaphore access speed | 16 hours ago | Applications and Utilities |
| the kernel how to power off the machine | 17 hours ago | Linux kernel |
| Easter Eggs in windows XP | 20 hours ago | Windows |
| Shared swap partition | 21 hours ago | Linux general |
| Root password | 21 hours ago | Linux general |
| Where/when DNOTIFY is used? | 23 hours ago | Linux kernel |
| How to convert Linux Kernel built-in module into a loadable module | 1 day ago | Linux kernel |
| Linux 2.6.24 and I/O schedulers | 1 day ago | Linux kernel |
| USB Driver -- Interrupt Polling -- A Little Help Please | 1 day ago | Linux general |
