From: claudio Date: Mon, 30 Oct 2023 07:04:36 +0000 (+0000) Subject: Adjust KERNEL_ASSERT_UNLOCKED() to not assert during a panic. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=6d6c8141fa4d5762fdb4d433770e1c00c368708e;p=openbsd Adjust KERNEL_ASSERT_UNLOCKED() to not assert during a panic. 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@ --- diff --git a/sys/sys/systm.h b/sys/sys/systm.h index dfea5999881..d831a461c41 100644 --- a/sys/sys/systm.h +++ b/sys/sys/systm.h @@ -1,4 +1,4 @@ -/* $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 $ */ /*- @@ -420,7 +420,7 @@ int _kernel_lock_held(void); #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 */