summaryrefslogtreecommitdiff
path: root/sys/miscfs/procfs
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2005-05-31 11:35:34 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2005-05-31 11:35:34 +0000
commite6af43d029c656a54048c0aec9e1e10eb04ecdc4 (patch)
tree7798d5d20193d4262511dff5d2e7c9646dc59471 /sys/miscfs/procfs
parent1825d89c3ab07b143659087032099479f5c9353c (diff)
Protect the run queues with SCHED_LOCK, not just spl (ot nothing at all in
one case fixed here). miod@ "appears to be harmless" markus@ ok
Diffstat (limited to 'sys/miscfs/procfs')
-rw-r--r--sys/miscfs/procfs/procfs_ctl.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/miscfs/procfs/procfs_ctl.c b/sys/miscfs/procfs/procfs_ctl.c
index 7f7be3b522b..9f4cf99ef36 100644
--- a/sys/miscfs/procfs/procfs_ctl.c
+++ b/sys/miscfs/procfs/procfs_ctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: procfs_ctl.c,v 1.15 2005/05/29 03:20:35 deraadt Exp $ */
+/* $OpenBSD: procfs_ctl.c,v 1.16 2005/05/31 11:35:33 art Exp $ */
/* $NetBSD: procfs_ctl.c,v 1.14 1996/02/09 22:40:48 christos Exp $ */
/*
@@ -48,6 +48,7 @@
#include <sys/resourcevar.h>
#include <sys/signalvar.h>
#include <sys/ptrace.h>
+#include <sys/sched.h>
#include <miscfs/procfs/procfs.h>
/*
@@ -110,6 +111,7 @@ procfs_control(curp, p, op)
int op;
{
int error;
+ int s;
/*
* Attach - attaches the target process for debugging
@@ -248,8 +250,10 @@ procfs_control(curp, p, op)
#endif
}
+ SCHED_LOCK(s);
if (p->p_stat == SSTOP)
setrunnable(p);
+ SCHED_UNLOCK(s);
return (0);
}
#endif
@@ -265,6 +269,7 @@ procfs_doctl(curp, p, pfs, uio)
int error;
char msg[PROCFS_CTLLEN+1];
const vfs_namemap_t *nm;
+ int s;
if (uio->uio_rw != UIO_WRITE)
return (EOPNOTSUPP);
@@ -297,7 +302,9 @@ procfs_doctl(curp, p, pfs, uio)
if (TRACE_WAIT_P(curp, p)) {
p->p_xstat = nm->nm_val;
FIX_SSTEP(p);
+ SCHED_LOCK(s);
setrunnable(p);
+ SCHED_UNLOCK(s);
} else {
psignal(p, nm->nm_val);
}