summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortobiasu <tobiasu@openbsd.org>2014-06-13 00:02:37 +0000
committertobiasu <tobiasu@openbsd.org>2014-06-13 00:02:37 +0000
commitd48416acea92b2f490fec4e93f33b26e6dbb7a48 (patch)
tree2e684adb119e0dc93dacb865d84e5803e1cf13ba
parentAdd regress test for explicit_bzero. (diff)
downloadwireguard-openbsd-d48416acea92b2f490fec4e93f33b26e6dbb7a48.tar.xz
wireguard-openbsd-d48416acea92b2f490fec4e93f33b26e6dbb7a48.zip
Fix ptrace() hanging hppa MP systems
Fiddling with uvm, registers and breakpoints requires taking the kernel lock Problem spotted by tedu@ ok kettenis@ deraadt@ miod@
-rw-r--r--sys/arch/hppa/hppa/trap.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/arch/hppa/hppa/trap.c b/sys/arch/hppa/hppa/trap.c
index 72f261b43b4..ce286ba6466 100644
--- a/sys/arch/hppa/hppa/trap.c
+++ b/sys/arch/hppa/hppa/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.134 2014/05/11 00:12:44 guenther Exp $ */
+/* $OpenBSD: trap.c,v 1.135 2014/06/13 00:02:37 tobiasu Exp $ */
/*
* Copyright (c) 1998-2004 Michael Shalayeff
@@ -264,13 +264,14 @@ trap(int type, struct trapframe *frame)
case T_IBREAK | T_USER:
case T_DBREAK | T_USER: {
int code = TRAP_BRKPT;
+
+ KERNEL_LOCK();
#ifdef PTRACE
ss_clear_breakpoints(p);
if (opcode == SSBREAKPOINT)
code = TRAP_TRACE;
#endif
/* pass to user debugger */
- KERNEL_LOCK();
trapsignal(p, SIGTRAP, type & ~T_USER, code, sv);
KERNEL_UNLOCK();
}
@@ -278,10 +279,9 @@ trap(int type, struct trapframe *frame)
#ifdef PTRACE
case T_TAKENBR | T_USER:
+ KERNEL_LOCK();
ss_clear_breakpoints(p);
-
/* pass to user debugger */
- KERNEL_LOCK();
trapsignal(p, SIGTRAP, type & ~T_USER, TRAP_TRACE, sv);
KERNEL_UNLOCK();
break;