Source-Changes-HG archive

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

[src/netbsd-9]: src/sys/uvm Pull up following revision(s) (requested by chs i...



details:   https://anonhg.NetBSD.org/src/rev/2e3fdb711995
branches:  netbsd-9
changeset: 963686:2e3fdb711995
user:      martin <martin%NetBSD.org@localhost>
date:      Sun Mar 08 11:01:22 2020 +0000

description:
Pull up following revision(s) (requested by chs in ticket #764):

        sys/uvm/uvm_fault.c: revision 1.207

fix two bugs reported in
https://syzkaller.appspot.com/bug?id=8840dce484094a926e1ec388ffb83acb2fa291c9

 - in uvm_fault_check(), if the map entry is wired, handle the fault the same way
   that we would handle UVM_FAULT_WIRE.  faulting on wired mappings is valid
   if the mapped object was truncated and then later grown again.

 - in uvm_fault_unwire_locked(), we must hold the locks for the vm_map_entry
   while calling pmap_extract() in order to avoid races with the mapped object
   being truncated while we are unwiring it.

diffstat:

 sys/uvm/uvm_fault.c |  14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diffs (50 lines):

diff -r 6734492afc98 -r 2e3fdb711995 sys/uvm/uvm_fault.c
--- a/sys/uvm/uvm_fault.c       Sun Mar 08 10:57:15 2020 +0000
+++ b/sys/uvm/uvm_fault.c       Sun Mar 08 11:01:22 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_fault.c,v 1.206.2.1 2019/11/11 17:13:28 martin Exp $       */
+/*     $NetBSD: uvm_fault.c,v 1.206.2.2 2020/03/08 11:01:22 martin Exp $       */
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.206.2.1 2019/11/11 17:13:28 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.206.2.2 2020/03/08 11:01:22 martin Exp $");
 
 #include "opt_uvmhist.h"
 
@@ -996,8 +996,11 @@
         */
 
        flt->enter_prot = ufi->entry->protection;
-       if (VM_MAPENT_ISWIRED(ufi->entry))
+       if (VM_MAPENT_ISWIRED(ufi->entry)) {
                flt->wire_mapping = true;
+               flt->wire_paging = true;
+               flt->narrow = true;
+       }
 
        if (flt->wire_mapping) {
                flt->access_type = flt->enter_prot; /* full access for wired */
@@ -2442,8 +2445,6 @@
 
        oentry = NULL;
        for (va = start; va < end; va += PAGE_SIZE) {
-               if (pmap_extract(pmap, va, &pa) == false)
-                       continue;
 
                /*
                 * find the map entry for the current address.
@@ -2474,6 +2475,9 @@
                 * if the entry is no longer wired, tell the pmap.
                 */
 
+               if (!pmap_extract(pmap, va, &pa))
+                       continue;
+
                if (VM_MAPENT_ISWIRED(entry) == 0)
                        pmap_unwire(pmap, va);
 



Home | Main Index | Thread Index | Old Index