Skip to content

Commit

Permalink
Adjust KERNEL_ASSERT_UNLOCKED() to not assert during a panic.
Browse files Browse the repository at this point in the history
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@
  • Loading branch information
cjeker committed Oct 30, 2023
1 parent 6e56204 commit 6d6c814
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions 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 $ */

/*-
Expand Down Expand Up @@ -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 */

Expand Down

0 comments on commit 6d6c814

Please sign in to comment.