summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2008-05-02 21:44:47 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2008-05-02 21:44:47 +0000
commit74178fc77559c4b0761051dc420b658feaaf10bb (patch)
treee3b2673ac1628c723c71672d932b4c3939f1a875 /sys
parenta7563e3178c9b52bdfa7a38419d8b35c703a0964 (diff)
Grab the biglock unconditionnaly when system calls go through systrace;
spotted by drahn
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/m88k/m88k/trap.c54
1 files changed, 31 insertions, 23 deletions
diff --git a/sys/arch/m88k/m88k/trap.c b/sys/arch/m88k/m88k/trap.c
index c8a0551bc0a..b8f35945129 100644
--- a/sys/arch/m88k/m88k/trap.c
+++ b/sys/arch/m88k/m88k/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.62 2008/04/01 21:10:18 miod Exp $ */
+/* $OpenBSD: trap.c,v 1.63 2008/05/02 21:44:46 miod Exp $ */
/*
* Copyright (c) 2004, Miodrag Vallat.
* Copyright (c) 1998 Steve Murphree, Jr.
@@ -1167,31 +1167,37 @@ m88100_syscall(register_t code, struct trapframe *tf)
if (error != 0)
goto bad;
+
#ifdef SYSCALL_DEBUG
KERNEL_PROC_LOCK(p);
scdebug_call(p, code, args);
KERNEL_PROC_UNLOCK(p);
#endif
- nolock = (callp->sy_flags & SY_NOLOCK);
- if (!nolock)
- KERNEL_PROC_LOCK(p);
#ifdef KTRACE
if (KTRPOINT(p, KTR_SYSCALL)) {
- if (nolock)
- KERNEL_PROC_LOCK(p);
+ KERNEL_PROC_LOCK(p);
ktrsyscall(p, code, callp->sy_argsize, args);
- if (nolock)
- KERNEL_PROC_UNLOCK(p);
+ KERNEL_PROC_UNLOCK(p);
}
#endif
rval[0] = 0;
rval[1] = tf->tf_r[3];
#if NSYSTRACE > 0
- if (ISSET(p->p_flag, P_SYSTRACE))
+ if (ISSET(p->p_flag, P_SYSTRACE)) {
+ KERNEL_PROC_LOCK(p);
error = systrace_redirect(code, p, args, rval);
- else
+ KERNEL_PROC_UNLOCK(p);
+ } else
#endif
+ {
+ nolock = (callp->sy_flags & SY_NOLOCK);
+ if (!nolock)
+ KERNEL_PROC_LOCK(p);
error = (*callp->sy_call)(p, args, rval);
+ if (!nolock)
+ KERNEL_PROC_UNLOCK(p);
+ }
+
/*
* system call will look like:
* or r13, r0, <code>
@@ -1221,8 +1227,6 @@ m88100_syscall(register_t code, struct trapframe *tf)
* any pointers.
*/
- if (!nolock)
- KERNEL_PROC_UNLOCK(p);
switch (error) {
case 0:
tf->tf_r[2] = rval[0];
@@ -1327,31 +1331,37 @@ m88110_syscall(register_t code, struct trapframe *tf)
if (error != 0)
goto bad;
+
#ifdef SYSCALL_DEBUG
KERNEL_PROC_LOCK(p);
scdebug_call(p, code, args);
KERNEL_PROC_UNLOCK(p);
#endif
- nolock = (callp->sy_flags & SY_NOLOCK);
- if (!nolock)
- KERNEL_PROC_LOCK(p);
#ifdef KTRACE
if (KTRPOINT(p, KTR_SYSCALL)) {
- if (nolock)
- KERNEL_PROC_LOCK(p);
+ KERNEL_PROC_LOCK(p);
ktrsyscall(p, code, callp->sy_argsize, args);
- if (nolock)
- KERNEL_PROC_UNLOCK(p);
+ KERNEL_PROC_UNLOCK(p);
}
#endif
rval[0] = 0;
rval[1] = tf->tf_r[3];
#if NSYSTRACE > 0
- if (ISSET(p->p_flag, P_SYSTRACE))
+ if (ISSET(p->p_flag, P_SYSTRACE)) {
+ KERNEL_PROC_LOCK(p);
error = systrace_redirect(code, p, args, rval);
- else
+ KERNEL_PROC_UNLOCK(p);
+ } else
#endif
+ {
+ nolock = (callp->sy_flags & SY_NOLOCK);
+ if (!nolock)
+ KERNEL_PROC_LOCK(p);
error = (*callp->sy_call)(p, args, rval);
+ if (!nolock)
+ KERNEL_PROC_UNLOCK(p);
+ }
+
/*
* system call will look like:
* or r13, r0, <code>
@@ -1377,8 +1387,6 @@ m88110_syscall(register_t code, struct trapframe *tf)
* exip += 4
*/
- if (!nolock)
- KERNEL_PROC_UNLOCK(p);
switch (error) {
case 0:
tf->tf_r[2] = rval[0];