Source-Changes-HG archive

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

[src/trunk]: src/sys/uvm allow KMSAN to work again by restoring the limiting ...



details:   https://anonhg.NetBSD.org/src/rev/e0867bd1b89a
branches:  trunk
changeset: 368797:e0867bd1b89a
user:      chs <chs%NetBSD.org@localhost>
date:      Sat Aug 06 05:55:37 2022 +0000

description:
allow KMSAN to work again by restoring the limiting of kva even with
NKMEMPAGES_MAX_UNLIMITED.  we used to limit kva to 1/8 of physmem
but limiting to 1/4 should be enough, and 1/4 still gives the kernel
enough kva to map all of the RAM that KMSAN has not stolen.

Reported-by: syzbot+ca3710b4c40cdd61aa72%syzkaller.appspotmail.com@localhost

diffstat:

 sys/uvm/uvm_km.c |  11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diffs (46 lines):

diff -r af50255955c6 -r e0867bd1b89a sys/uvm/uvm_km.c
--- a/sys/uvm/uvm_km.c  Fri Aug 05 23:43:46 2022 +0000
+++ b/sys/uvm/uvm_km.c  Sat Aug 06 05:55:37 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_km.c,v 1.161 2022/08/03 01:52:11 chs Exp $ */
+/*     $NetBSD: uvm_km.c,v 1.162 2022/08/06 05:55:37 chs Exp $ */
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -152,7 +152,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_km.c,v 1.161 2022/08/03 01:52:11 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_km.c,v 1.162 2022/08/06 05:55:37 chs Exp $");
 
 #include "opt_uvmhist.h"
 
@@ -226,22 +226,25 @@
                return;
        }
 
-#ifdef NKMEMPAGES_MAX_UNLIMITED
+#if defined(NKMEMPAGES_MAX_UNLIMITED) && !defined(KMSAN)
        npages = physmem;
 #else
 
 #if defined(KMSAN)
-       npages = (physmem / 8);
+       npages = (physmem / 4);
 #elif defined(PMAP_MAP_POOLPAGE)
        npages = (physmem / 4);
 #else
        npages = (physmem / 3) * 2;
 #endif /* defined(PMAP_MAP_POOLPAGE) */
 
+#if !defined(NKMEMPAGES_MAX_UNLIMITED)
        if (npages > NKMEMPAGES_MAX)
                npages = NKMEMPAGES_MAX;
 #endif
 
+#endif
+
        if (npages < NKMEMPAGES_MIN)
                npages = NKMEMPAGES_MIN;
 



Home | Main Index | Thread Index | Old Index