Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/x86/x86 PR port-amd64/55083 (assertion "pmap->pm_st...



details:   https://anonhg.NetBSD.org/src/rev/cf3b874aeadc
branches:  trunk
changeset: 849930:cf3b874aeadc
user:      ad <ad%NetBSD.org@localhost>
date:      Thu Mar 19 18:58:14 2020 +0000

description:
PR port-amd64/55083 (assertion "pmap->pm_stats.resident_count == PDP_SIZE" failed)

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

Don't screw up resident_count in failure path.

diffstat:

 sys/arch/x86/x86/pmap.c |  9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diffs (40 lines):

diff -r ebabaf93cac7 -r cf3b874aeadc sys/arch/x86/x86/pmap.c
--- a/sys/arch/x86/x86/pmap.c   Thu Mar 19 15:19:13 2020 +0000
+++ b/sys/arch/x86/x86/pmap.c   Thu Mar 19 18:58:14 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.c,v 1.377 2020/03/18 18:54:28 ad Exp $    */
+/*     $NetBSD: pmap.c,v 1.378 2020/03/19 18:58:14 ad Exp $    */
 
 /*
  * Copyright (c) 2008, 2010, 2016, 2017, 2019, 2020 The NetBSD Foundation, Inc.
@@ -130,7 +130,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.377 2020/03/18 18:54:28 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.378 2020/03/19 18:58:14 ad Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -2229,11 +2229,11 @@
 {
        int lidx;
 
-       KASSERT(ptp->wire_count == 1);
+       KASSERT(ptp->wire_count <= 1);
        PMAP_CHECK_PP(VM_PAGE_TO_PP(ptp));
 
        lidx = level - 1;
-       pmap_stats_update(pmap, -1, 0);
+       pmap_stats_update(pmap, -ptp->wire_count, 0);
        if (pmap->pm_ptphint[lidx] == ptp)
                pmap->pm_ptphint[lidx] = NULL;
        ptp->wire_count = 0;
@@ -2450,7 +2450,6 @@
                        continue;
                }
                KASSERT(pt->pg[i]->wire_count == 0);
-               pt->pg[i]->wire_count = 1;
                PMAP_CHECK_PP(VM_PAGE_TO_PP(pt->pg[i]));
                pmap_freepage(pmap, pt->pg[i], i - 1);
        }



Home | Main Index | Thread Index | Old Index