From 5f72c5bcf149787507e857650171c8dfdd99a01c Mon Sep 17 00:00:00 2001 From: Mark Kettenis Date: Sat, 8 Sep 2012 14:52:01 +0000 Subject: Plug a race where we're trying to kill a traced process while it is aleady exiting. At that point ps_single may point to a proc that's already freed. Since there is no point in killing a process that's already exiting, just skip this step. ok guenther@ --- sys/kern/kern_exit.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index f5f1ad1debc..c3db9084ed0 100644 --- a/sys/kern/kern_exit.c +++ b/sys/kern/kern_exit.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_exit.c,v 1.118 2012/08/02 03:18:48 guenther Exp $ */ +/* $OpenBSD: kern_exit.c,v 1.119 2012/09/08 14:52:00 kettenis Exp $ */ /* $NetBSD: kern_exit.c,v 1.39 1996/04/22 01:38:25 christos Exp $ */ /* @@ -280,10 +280,11 @@ exit1(struct proc *p, int rv, int flags) nqr = LIST_NEXT(qr, ps_sibling); proc_reparent(qr, initproc->p_p); /* - * Traced processes are killed - * since their existence means someone is screwing up. + * Traced processes are killed since their + * existence means someone is screwing up. */ - if (qr->ps_flags & PS_TRACED) { + if (qr->ps_flags & PS_TRACED && + !(qr->ps_flags & PS_EXITING)) { atomic_clearbits_int(&qr->ps_flags, PS_TRACED); /* * If single threading is active, -- cgit v1.2.3