summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoroga <oga@openbsd.org>2010-05-26 15:16:57 +0000
committeroga <oga@openbsd.org>2010-05-26 15:16:57 +0000
commit13625d760c379095c3ad7285699d1b926c60c38f (patch)
tree79f83ea72f03d5cc2c66b0ec178dc2502a79940d
parentSwitch amd64 and sparc64 over to gcc4; bump libc major to deal with the ABI (diff)
downloadwireguard-openbsd-13625d760c379095c3ad7285699d1b926c60c38f.tar.xz
wireguard-openbsd-13625d760c379095c3ad7285699d1b926c60c38f.zip
Bad tedu, no cookie.
Don't set SDEAD on the process in exit1 untile we have grabbed the allproclk. allproclk is a rwlock and thus we may sleep to grab hold of it. This is a big of a bugger when we just set a flag that means we panic if we sleep. ok art@. turns Tom Murphy's fstat panic into a deadlock instead *sigh*, this is being looked into.
-rw-r--r--sys/kern/kern_exit.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c
index 347bf0a0f8e..19e4d30d70f 100644
--- a/sys/kern/kern_exit.c
+++ b/sys/kern/kern_exit.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_exit.c,v 1.91 2010/05/18 22:26:10 tedu Exp $ */
+/* $OpenBSD: kern_exit.c,v 1.92 2010/05/26 15:16:57 oga Exp $ */
/* $NetBSD: kern_exit.c,v 1.39 1996/04/22 01:38:25 christos Exp $ */
/*
@@ -236,11 +236,6 @@ exit1(struct proc *p, int rv, int flags)
if (ISSET(p->p_flag, P_SYSTRACE))
systrace_exit(p);
#endif
- /*
- * NOTE: WE ARE NO LONGER ALLOWED TO SLEEP!
- */
- p->p_stat = SDEAD;
-
/*
* Remove proc from pidhash chain so looking it up won't
* work. Move it from allproc to zombproc, but do not yet
@@ -249,6 +244,11 @@ exit1(struct proc *p, int rv, int flags)
* wake up the reaper when we do.
*/
rw_enter_write(&allproclk);
+ /*
+ * NOTE: WE ARE NO LONGER ALLOWED TO SLEEP!
+ */
+ p->p_stat = SDEAD;
+
LIST_REMOVE(p, p_hash);
LIST_REMOVE(p, p_list);
LIST_INSERT_HEAD(&zombproc, p, p_list);