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 Reported-by: syzbot+fd9be59aa613bbf4eba8@sy...



details:   https://anonhg.NetBSD.org/src/rev/c854fee14f2b
branches:  trunk
changeset: 933734:c854fee14f2b
user:      ad <ad%NetBSD.org@localhost>
date:      Fri May 29 22:40:15 2020 +0000

description:
Reported-by: syzbot+fd9be59aa613bbf4eba8%syzkaller.appspotmail.com@localhost
Reported-by: syzbot+15dd4dbac6ed159faa4a%syzkaller.appspotmail.com@localhost
Reported-by: syzbot+38fa02d3b0e46e57c156%syzkaller.appspotmail.com@localhost

pmap_remove_all(): need to drain PV pages only after the PTEs are unmapped,
otherwise there can be a context switch with them mapped in.  XXX amd64
should use the direct map.

diffstat:

 sys/arch/x86/x86/pmap.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (34 lines):

diff -r 2438279c7a1b -r c854fee14f2b sys/arch/x86/x86/pmap.c
--- a/sys/arch/x86/x86/pmap.c   Fri May 29 20:56:27 2020 +0000
+++ b/sys/arch/x86/x86/pmap.c   Fri May 29 22:40:15 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.c,v 1.396 2020/05/27 19:33:40 ad Exp $    */
+/*     $NetBSD: pmap.c,v 1.397 2020/05/29 22:40:15 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.396 2020/05/27 19:33:40 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.397 2020/05/29 22:40:15 ad Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -3145,7 +3145,6 @@
 #ifdef DIAGNOSTIC
        rb_tree_init(tree, &pmap_rbtree_ops);
 #endif
-       pmap_drain_pv(pmap);
 #else  /* !XENPV */
        /*
         * XXXAD For XEN, it's not clear to me that we can do this, because
@@ -3216,6 +3215,7 @@
                        pmap_free_ptp(pmap, ptps[i], va, ptes, pdes);
                }
                pmap_unmap_ptes(pmap, pmap2);
+               pmap_drain_pv(pmap);
                pmap_tlb_shootdown(pmap, -1L, 0, TLBSHOOT_REMOVE_ALL);
                mutex_exit(&pmap->pm_lock);
 



Home | Main Index | Thread Index | Old Index