summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorPhilip Guenther <guenther@cvs.openbsd.org>2014-01-23 00:33:37 +0000
committerPhilip Guenther <guenther@cvs.openbsd.org>2014-01-23 00:33:37 +0000
commitedd93c1fbe6ce5e74fadbc9ae486dab01c0c9943 (patch)
treef7f10f3ccb071fdb3fde75d8ab9c5da063f81a68 /sys
parent74c10b6e84a0aeb023610068b5a490e4c4fb830f (diff)
Waiting on a condition without a lock is an error: you need *some* lock
to guarantee there isn't a window in which you can lose a wakeup. The exception for tsleep() is when it's just being used to sleep for a period of time, so permit that too. ok jsing@ deraadt@
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/kern_synch.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c
index c480e46f80f..e268d107e44 100644
--- a/sys/kern/kern_synch.c
+++ b/sys/kern/kern_synch.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_synch.c,v 1.112 2013/12/24 01:11:04 dlg Exp $ */
+/* $OpenBSD: kern_synch.c,v 1.113 2014/01/23 00:33:36 guenther Exp $ */
/* $NetBSD: kern_synch.c,v 1.37 1996/04/22 01:38:37 christos Exp $ */
/*
@@ -109,6 +109,10 @@ tsleep(const volatile void *ident, int priority, const char *wmesg, int timo)
KASSERT((priority & ~(PRIMASK | PCATCH)) == 0);
+#ifdef MULTIPROCESSOR
+ KASSERT(timo || __mp_lock_held(&kernel_lock));
+#endif
+
if (cold || panicstr) {
int s;
/*