summaryrefslogtreecommitdiff
path: root/sys/kern/kern_event.c
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2019-05-04 14:42:45 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2019-05-04 14:42:45 +0000
commit7bddc27fe807bb69fa179117b8c986e9e6f19378 (patch)
treeabdf41a42baea7a47717c1d7b0c4fd5f4a76e731 /sys/kern/kern_event.c
parent3dac1d06aeef8b59a4e8f6a50f17d74228850eb5 (diff)
Relax the check in knote_{de,en}queue: don't panic w/o KERNEL_LOCK().
Use splassert_fail() instead, please set kern.splassert to 2 and report the corresponding stack trace if you see a warning. ok dlg@
Diffstat (limited to 'sys/kern/kern_event.c')
-rw-r--r--sys/kern/kern_event.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c
index 57b508d46f7..ea7622cd05f 100644
--- a/sys/kern/kern_event.c
+++ b/sys/kern/kern_event.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_event.c,v 1.102 2019/05/01 06:22:39 dlg Exp $ */
+/* $OpenBSD: kern_event.c,v 1.103 2019/05/04 14:42:44 mpi Exp $ */
/*-
* Copyright (c) 1999,2000,2001 Jonathan Lemon <jlemon@FreeBSD.org>
@@ -1073,7 +1073,10 @@ knote_enqueue(struct knote *kn)
int s = splhigh();
KASSERT((kn->kn_status & KN_QUEUED) == 0);
- KERNEL_ASSERT_LOCKED();
+#ifdef DIAGNOSTIC
+ if (!_kernel_lock_held() && (splassert_ctl > 0))
+ splassert_fail(42, 0, __func__);
+#endif
TAILQ_INSERT_TAIL(&kq->kq_head, kn, kn_tqe);
kn->kn_status |= KN_QUEUED;
@@ -1089,7 +1092,10 @@ knote_dequeue(struct knote *kn)
int s = splhigh();
KASSERT(kn->kn_status & KN_QUEUED);
- KERNEL_ASSERT_LOCKED();
+#ifdef DIAGNOSTIC
+ if (!_kernel_lock_held() && (splassert_ctl > 0))
+ splassert_fail(42, 0, __func__);
+#endif
TAILQ_REMOVE(&kq->kq_head, kn, kn_tqe);
kn->kn_status &= ~KN_QUEUED;