When a tracer exits without detaching from the traced process, the
tracee may be at a tracer notification stop and will thus interpret
the value in task->exit_code (SIGTRAP | 0x80) as the signal to be
delivered.
This patch fixes the problem by clearing exit_code when detaching
the traced process from a dying tracer.
Signed-off-by: Petr Tesarik <ptesarik@suse.cz>
---
exit.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -642,8 +642,10 @@ reparent_thread(struct task_struct *p, s
/*
* If it was at a trace stop, turn it into
* a normal stop since it's no longer being
- * traced.
+ * traced. Cancel the notification signal,
+ * or the tracee may get a SIGTRAP.
*/
+ p->exit_code = 0;
ptrace_untrace(p);
}
}
@@ -713,6 +715,10 @@ static void forget_original_parent(struc
p->real_parent = reaper;
reparent_thread(p, father, 0);
} else {
+ /* cancel the notification signal at a trace stop */
+ if (p->state == TASK_TRACED)
+ p->exit_code = 0;
+
/* reparent ptraced task to its real parent */
__ptrace_unlink (p);
if (p->exit_state == EXIT_ZOMBIE && p->exit_signal != -1 &&
--
| Lee Revell | Re: [RFC][PATCH] cpuidle: avoid singing capacitors |
| Ingo Molnar | [bug] latest -git boot hang |
| Greg Kroah-Hartman | [PATCH 001/196] Chinese: Add the known_regression URI to the HOWTO |
| Christoph Hellwig | Re: 2.6.24-rc6-mm1 |
git: | |
| Imran M Yousuf | Re: [kernel.org users] [RFD] On deprecating "git-foo" for builtins |
| Dan Zwell | [PATCH] Color support added to git-add--interactive. |
| Kyle Moffett | Using GIT to store /etc (Or: How to make GIT store all file permission bits) |
| Petr Vandrovec | Re: Fwd: [OT] Re: Git via a proxy server? |
| Lars Hansson | Re: Code signing in OpenBSD |
| Richard Stallman | Real men don't attack straw men |
| Pau | acer aspire one dmesg? |
| Henning Brauer | Re: About Xen: maybe a reiterative question but .. |
| Jarek Poplawski | Re: loaded router, excessive getnstimeofday in oprofile |
| Julius Volz | [PATCH RFC 20/24] IPVS: Add validity checks when adding/editing v6 services |
| Bruno | [PATCH 1/2] r8169: WoL fixes |
| Corey Hickey | [PATCH 01/10] Preparatory refactoring part 1. |
