summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormpi <mpi@openbsd.org>2018-03-27 08:22:41 +0000
committermpi <mpi@openbsd.org>2018-03-27 08:22:41 +0000
commite45e9f2c580f138c7d7393f7a6061d89b5d1bd7a (patch)
tree3178940fb059c159e15d89f5a8a0d9198dfc8d3e
parentsync supported hardware (diff)
downloadwireguard-openbsd-e45e9f2c580f138c7d7393f7a6061d89b5d1bd7a.tar.xz
wireguard-openbsd-e45e9f2c580f138c7d7393f7a6061d89b5d1bd7a.zip
Exclude SIGKILL from ptrace(2) interception.
This can lead to a deadlock where the parent waits infinitely for the traced process. Original problem reported by tb@ and worked around by visa@ for release by not calling CURSIG() twice in userret(). ok tb@, visa@
-rw-r--r--sys/kern/kern_sig.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c
index 1d0cab7b1d2..c6ed90cc214 100644
--- a/sys/kern/kern_sig.c
+++ b/sys/kern/kern_sig.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_sig.c,v 1.217 2018/03/24 04:13:59 visa Exp $ */
+/* $OpenBSD: kern_sig.c,v 1.218 2018/03/27 08:22:41 mpi Exp $ */
/* $NetBSD: kern_sig.c,v 1.54 1996/04/22 01:38:32 christos Exp $ */
/*
@@ -1167,11 +1167,13 @@ issignal(struct proc *p)
(pr->ps_flags & PS_TRACED) == 0)
continue;
- if ((pr->ps_flags & (PS_TRACED | PS_PPWAIT)) == PS_TRACED) {
- /*
- * If traced, always stop, and stay
- * stopped until released by the debugger.
- */
+ /*
+ * If traced, always stop, and stay stopped until released
+ * by the debugger. If our parent process is waiting for
+ * us, don't hang as we could deadlock.
+ */
+ if (((pr->ps_flags & (PS_TRACED | PS_PPWAIT)) == PS_TRACED) &&
+ signum != SIGKILL) {
p->p_xstat = signum;
if (dolock)