Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern pserialize(9): Fix buggy assertion inside assertion.



details:   https://anonhg.NetBSD.org/src/rev/eee2bf1e4184
branches:  trunk
changeset: 374270:eee2bf1e4184
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Apr 16 04:52:19 2023 +0000

description:
pserialize(9): Fix buggy assertion inside assertion.

If there has been a context switch, then we can't be in a pserialize
read section -- _and_ whatever we read out of curcpu() is stale, so
we can't assert anything based on it.  So just delete the assertion.

Reported-by: syzbot+d7065ab16d7cd9cc09af%syzkaller.appspotmail.com@localhost
https://syzkaller.appspot.com/bug?id=0c63db890575d29c6a51fb24b003d3bab1f7f04b

diffstat:

 sys/kern/subr_pserialize.c |  8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

diffs (30 lines):

diff -r 84bc43aa5d31 -r eee2bf1e4184 sys/kern/subr_pserialize.c
--- a/sys/kern/subr_pserialize.c        Sat Apr 15 18:16:28 2023 +0000
+++ b/sys/kern/subr_pserialize.c        Sun Apr 16 04:52:19 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_pserialize.c,v 1.22 2023/04/14 16:51:46 riastradh Exp $   */
+/*     $NetBSD: subr_pserialize.c,v 1.23 2023/04/16 04:52:19 riastradh Exp $   */
 
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_pserialize.c,v 1.22 2023/04/14 16:51:46 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_pserialize.c,v 1.23 2023/04/16 04:52:19 riastradh Exp $");
 
 #include <sys/param.h>
 
@@ -188,10 +188,8 @@ pserialize_not_in_read_section(void)
         * pserialize read section because pserialize read sections
         * block preemption.
         */
-       if (__predict_false(ncsw != l->l_ncsw)) {
-               KDASSERT(notin);
+       if (__predict_false(ncsw != l->l_ncsw))
                notin = true;
-       }
 
        return notin;
 }



Home | Main Index | Thread Index | Old Index