KERNEL_ASSERT_UNLOCKED calls _kernel_lock_held() which returns true
if panicstr || db_active which triggers this assert. Workaround this by
checking them before.
This will alter the following Syzkaller reports:
Reported-by: syzbot+169110a0815838ab5940@syzkaller.appspotmail.com
Reported-by: syzbot+3c2eced405b9de6f79c2@syzkaller.appspotmail.com
OK mpi@
-/* $OpenBSD: systm.h,v 1.169 2023/10/17 00:04:02 cheloha Exp $ */
+/* $OpenBSD: systm.h,v 1.170 2023/10/30 07:04:36 claudio Exp $ */
/* $NetBSD: systm.h,v 1.50 1996/06/09 04:55:09 briggs Exp $ */
/*-
#define KERNEL_LOCK() _kernel_lock()
#define KERNEL_UNLOCK() _kernel_unlock()
#define KERNEL_ASSERT_LOCKED() KASSERT(_kernel_lock_held())
-#define KERNEL_ASSERT_UNLOCKED() KASSERT(!_kernel_lock_held())
+#define KERNEL_ASSERT_UNLOCKED() KASSERT(panicstr || db_active || !_kernel_lock_held())
#else /* ! MULTIPROCESSOR */