[jmc@netbsd.org: CVS commit: [netbsd-1-6] src/sys/kern]

Pawel Jakub Dawidek pjd at FreeBSD.org
Sun Mar 28 01:25:28 PST 2004


Hi.

I think this fix is also related to us, isn't it?

----- Forwarded message from James Chacon <jmc at netbsd.org> -----

X-Original-To: nick at garage.freebsd.pl
Delivered-To: pjd at darkness.comp.waw.pl
Delivered-To: source-changes at netbsd.org
From: James Chacon <jmc at netbsd.org>
Subject: CVS commit: [netbsd-1-6] src/sys/kern
To: source-changes at NetBSD.org
Reply-To: jmc at netbsd.org
Date: Sun, 28 Mar 2004 08:02:36 +0000 (UTC)
Precedence: list

Commiter:	James Chacon <jmc at netbsd.org>
Branch:		netbsd-1-6

Files:
	1.93.6.3   src/sys/kern/kern_exit.c  

Log Message:
Pullup rev 1.104-1.106 (requested by junyoung in ticket #1615)

Make sure that, if orphaned child is being traced, it's reparented back
to the original parent before it's killed.


Diffs:
COMMAND: cvs -d:pserver:anoncvs at anoncvs.netbsd.org:/cvsroot rdiff -u -r1.93.6.2 -r1.93.6.3 src/sys/kern/kern_exit.c
Index: src/sys/kern/kern_exit.c
diff -u src/sys/kern/kern_exit.c:1.93.6.2 src/sys/kern/kern_exit.c:1.93.6.3
--- src/sys/kern/kern_exit.c:1.93.6.2	Wed Oct 22 06:15:50 2003
+++ src/sys/kern/kern_exit.c	Sun Mar 28 08:02:36 2004
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_exit.c,v 1.93.6.2 2003/10/22 06:15:50 jmc Exp $	*/
+/*	$NetBSD: kern_exit.c,v 1.93.6.3 2004/03/28 08:02:36 jmc Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -78,7 +78,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_exit.c,v 1.93.6.2 2003/10/22 06:15:50 jmc Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_exit.c,v 1.93.6.3 2004/03/28 08:02:36 jmc Exp $");
 
 #include "opt_ktrace.h"
 #include "opt_sysv.h"
@@ -240,14 +240,25 @@
 		wakeup((caddr_t)initproc);
 	for (; q != 0; q = nq) {
 		nq = q->p_sibling.le_next;
-		proc_reparent(q, initproc);
+
 		/*
-		 * Traced processes are killed
-		 * since their existence means someone is screwing up.
+		 * Traced processes are killed since their existence
+		 * means someone is screwing up. Since we reset the
+		 * trace flags, the logic in sys_wait4() would not be
+		 * triggered to reparent the process to its
+		 * original parent, so we must do this here.
 		 */
 		if (q->p_flag & P_TRACED) {
+			if (q->p_opptr != q->p_pptr) {
+				struct proc *t = q->p_opptr;
+				proc_reparent(q, t ? t : initproc);
+				q->p_opptr = NULL;
+			} else
+				proc_reparent(q, initproc);
 			q->p_flag &= ~(P_TRACED|P_WAITED|P_FSTRACE);
 			psignal(q, SIGKILL);
+		} else {
+			proc_reparent(q, initproc);
 		}
 	}
 
----- End forwarded message -----


-- 
Pawel Jakub Dawidek                       http://www.FreeBSD.org
pjd at FreeBSD.org                           http://garage.freebsd.pl
FreeBSD committer                         Am I Evil? Yes, I Am!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-current/attachments/20040328/2d5e07aa/attachment.bin


More information about the freebsd-current mailing list