summaryrefslogtreecommitdiffstats
path: root/sys/kern/sched_bsd.c
diff options
context:
space:
mode:
authormatthew <matthew@openbsd.org>2010-09-24 13:21:30 +0000
committermatthew <matthew@openbsd.org>2010-09-24 13:21:30 +0000
commit521499f757d386f396b252cd66294c4d5edfca3a (patch)
tree5653e58a8172f61dafec5a6e3e4a11c601e02d2e /sys/kern/sched_bsd.c
parenthook iscsid and iscsictl into the build. (diff)
downloadwireguard-openbsd-521499f757d386f396b252cd66294c4d5edfca3a.tar.xz
wireguard-openbsd-521499f757d386f396b252cd66294c4d5edfca3a.zip
Add stricter asserts to DIAGNOSTIC kernels to help catch mutex and
rwlock misuse. In particular, this commit makes the following changes: 1. i386 and amd64 now count the number of active mutexes so that assertwaitok(9) can detect attempts to sleep while holding a mutex. 2. i386 and amd64 check that we actually hold mutexes when passed to mtx_leave(). 3. Calls to rw_exit*() now call rw_assert_{rd,wr}lock() as appropriate. ok krw@, oga@; "sounds good to me" deraadt@; assembly bits double checked by pirofti@
Diffstat (limited to 'sys/kern/sched_bsd.c')
-rw-r--r--sys/kern/sched_bsd.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/kern/sched_bsd.c b/sys/kern/sched_bsd.c
index 9c4361ebc0a..c67171203ab 100644
--- a/sys/kern/sched_bsd.c
+++ b/sys/kern/sched_bsd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sched_bsd.c,v 1.23 2010/06/30 22:38:17 art Exp $ */
+/* $OpenBSD: sched_bsd.c,v 1.24 2010/09/24 13:21:30 matthew Exp $ */
/* $NetBSD: kern_synch.c,v 1.37 1996/04/22 01:38:37 christos Exp $ */
/*-
@@ -356,6 +356,7 @@ mi_switch(void)
int sched_count;
#endif
+ assertwaitok();
KASSERT(p->p_stat != SONPROC);
SCHED_ASSERT_LOCKED();