Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 28 Mar 2004 11:25:26 +0200
From:      Pawel Jakub Dawidek <pjd@FreeBSD.org>
To:        freebsd-current@freebsd.org
Subject:   [jmc@netbsd.org: CVS commit: [netbsd-1-6] src/sys/kern]
Message-ID:  <20040328092526.GX8930@darkness.comp.waw.pl>

next in thread | raw e-mail | index | archive | help

--W0fIhK6DANimrc4b
Content-Type: text/plain; charset=iso-8859-2
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hi.

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

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

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

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

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

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@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 $	*/
=20
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -78,7 +78,7 @@
  */
=20
 #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 $");
=20
 #include "opt_ktrace.h"
 #include "opt_sysv.h"
@@ -240,14 +240,25 @@
 		wakeup((caddr_t)initproc);
 	for (; q !=3D 0; q =3D nq) {
 		nq =3D 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 !=3D q->p_pptr) {
+				struct proc *t =3D q->p_opptr;
+				proc_reparent(q, t ? t : initproc);
+				q->p_opptr =3D NULL;
+			} else
+				proc_reparent(q, initproc);
 			q->p_flag &=3D ~(P_TRACED|P_WAITED|P_FSTRACE);
 			psignal(q, SIGKILL);
+		} else {
+			proc_reparent(q, initproc);
 		}
 	}
=20
----- End forwarded message -----


--=20
Pawel Jakub Dawidek                       http://www.FreeBSD.org
pjd@FreeBSD.org                           http://garage.freebsd.pl
FreeBSD committer                         Am I Evil? Yes, I Am!

--W0fIhK6DANimrc4b
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (FreeBSD)

iD8DBQFAZpoGForvXbEpPzQRAsJ5AJ90FCc2hY9mRDwmee1HhLiLA5sk1ACeMxzI
3xtXc7GTqaGRaELBlsrn0ro=
=Uhh7
-----END PGP SIGNATURE-----

--W0fIhK6DANimrc4b--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040328092526.GX8930>