summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_exit.c
diff options
context:
space:
mode:
authorkettenis <kettenis@openbsd.org>2012-04-14 14:26:39 +0000
committerkettenis <kettenis@openbsd.org>2012-04-14 14:26:39 +0000
commit7fe0d7e14638ec1d6d6be15049c530f911c02e93 (patch)
treebc2c6f9b079bb455c26ae814ec2ff5cf68dce5eb /sys/kern/kern_exit.c
parentclean-out ALL generated files (diff)
downloadwireguard-openbsd-7fe0d7e14638ec1d6d6be15049c530f911c02e93.tar.xz
wireguard-openbsd-7fe0d7e14638ec1d6d6be15049c530f911c02e93.zip
If single threading is active, drirect the SIGKILL signal we send to orphaned
traced processes to the active thread, otherwise we will deadlock resulting in an unkillable stopped process. ok guenther@
Diffstat (limited to 'sys/kern/kern_exit.c')
-rw-r--r--sys/kern/kern_exit.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c
index dc34131959f..57c88ff8aca 100644
--- a/sys/kern/kern_exit.c
+++ b/sys/kern/kern_exit.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_exit.c,v 1.114 2012/04/13 19:18:24 kettenis Exp $ */
+/* $OpenBSD: kern_exit.c,v 1.115 2012/04/14 14:26:39 kettenis Exp $ */
/* $NetBSD: kern_exit.c,v 1.39 1996/04/22 01:38:25 christos Exp $ */
/*
@@ -276,7 +276,16 @@ exit1(struct proc *p, int rv, int flags)
*/
if (qr->ps_flags & PS_TRACED) {
atomic_clearbits_int(&qr->ps_flags, PS_TRACED);
- prsignal(qr, SIGKILL);
+ /*
+ * If single threading is active,
+ * direct the signal to the active
+ * thread to avoid deadlock.
+ */
+ if (qr->ps_single)
+ ptsignal(qr->ps_single, SIGKILL,
+ STHREAD);
+ else
+ prsignal(qr, SIGKILL);
}
}
}