From 55b5f2a20289e2d06935a4898534e0b51d5b7b5f Mon Sep 17 00:00:00 2001 From: Don Lewis Date: Wed, 11 Feb 2004 22:06:02 +0000 Subject: [PATCH] When reparenting a process to init, make sure that p_sigparent is set to SIGCHLD. This avoids the creation of orphaned Linux-threaded zombies that init is unable to reap. This can occur when the parent process sets its SIGCHLD to SIG_IGN. Fix a similar situation in the PT_DETACH code. Tested by: "Steven Hartland" --- sys/kern/kern_exit.c | 1 + sys/kern/sys_process.c | 1 + 2 files changed, 2 insertions(+) diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index f332e6bf6744..419c4b2e9217 100644 --- a/sys/kern/kern_exit.c +++ b/sys/kern/kern_exit.c @@ -458,6 +458,7 @@ exit1(struct thread *td, int rv) pp = p->p_pptr; PROC_UNLOCK(pp); proc_reparent(p, initproc); + p->p_sigparent = SIGCHLD; PROC_LOCK(p->p_pptr); /* * If this was the last child of our parent, notify diff --git a/sys/kern/sys_process.c b/sys/kern/sys_process.c index 9e49d9da8bad..9a79551ed988 100644 --- a/sys/kern/sys_process.c +++ b/sys/kern/sys_process.c @@ -561,6 +561,7 @@ kern_ptrace(struct thread *td, int req, pid_t pid, void *addr, int data) PROC_UNLOCK(pp); PROC_LOCK(p); proc_reparent(p, pp); + p->p_sigparent = SIGCHLD; } p->p_flag &= ~(P_TRACED | P_WAITED); p->p_oppid = 0;