diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2012-09-08 14:52:01 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2012-09-08 14:52:01 +0000 |
commit | 5f72c5bcf149787507e857650171c8dfdd99a01c (patch) | |
tree | a4ef089724390dec9b658128bd382dde55574108 /sys | |
parent | e82a0dc585ded53e1d6a2a4fc57e686d35831335 (diff) |
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@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/kern_exit.c | 9 |
1 files 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, |