diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2019-05-01 06:22:40 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2019-05-01 06:22:40 +0000 |
commit | 439b645d179139c8d6280b50b444e523dc454eb0 (patch) | |
tree | 722b6f7b015c2bf477dd75b12abaa191bb46c375 /sys/kern/kern_event.c | |
parent | 04a31e5424c73b06d2df33edcb0a32b8853ba888 (diff) |
sprinkle some KERNEL_ASSERT_LOCKED()
operations that tweak the kq_head and kq_count need to be serialised
against the kevent syscall which also fumbles with the list and
count too.
these asserts would have made it extremely obvious where the tun(4)
bug was. for half the time of the bug report about it we werent
even sure it was tun(4)
discussed with mpi@ jmatthew@
Diffstat (limited to 'sys/kern/kern_event.c')
-rw-r--r-- | sys/kern/kern_event.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c index 755c53ec86c..57b508d46f7 100644 --- a/sys/kern/kern_event.c +++ b/sys/kern/kern_event.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_event.c,v 1.101 2018/11/27 15:52:50 cheloha Exp $ */ +/* $OpenBSD: kern_event.c,v 1.102 2019/05/01 06:22:39 dlg Exp $ */ /*- * Copyright (c) 1999,2000,2001 Jonathan Lemon <jlemon@FreeBSD.org> @@ -1073,6 +1073,7 @@ knote_enqueue(struct knote *kn) int s = splhigh(); KASSERT((kn->kn_status & KN_QUEUED) == 0); + KERNEL_ASSERT_LOCKED(); TAILQ_INSERT_TAIL(&kq->kq_head, kn, kn_tqe); kn->kn_status |= KN_QUEUED; @@ -1088,6 +1089,7 @@ knote_dequeue(struct knote *kn) int s = splhigh(); KASSERT(kn->kn_status & KN_QUEUED); + KERNEL_ASSERT_LOCKED(); TAILQ_REMOVE(&kq->kq_head, kn, kn_tqe); kn->kn_status &= ~KN_QUEUED; |