Source-Changes-HG archive

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

[src/trunk]: src/sys/uvm in uvm_fault_lower_io(), fetch all the map entry val...



details:   https://anonhg.NetBSD.org/src/rev/f8ef656ffe7e
branches:  trunk
changeset: 966667:f8ef656ffe7e
user:      chs <chs%NetBSD.org@localhost>
date:      Sun Nov 10 20:38:33 2019 +0000

description:
in uvm_fault_lower_io(), fetch all the map entry values that we need
before we unlock everything.

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

diffstat:

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

diffs (49 lines):

diff -r 45e6b40a7de7 -r f8ef656ffe7e sys/uvm/uvm_fault.c
--- a/sys/uvm/uvm_fault.c       Sun Nov 10 18:47:13 2019 +0000
+++ b/sys/uvm/uvm_fault.c       Sun Nov 10 20:38:33 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_fault.c,v 1.207 2019/08/05 17:36:42 chs Exp $      */
+/*     $NetBSD: uvm_fault.c,v 1.208 2019/11/10 20:38:33 chs 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.207 2019/08/05 17:36:42 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.208 2019/11/10 20:38:33 chs Exp $");
 
 #include "opt_uvmhist.h"
 
@@ -1904,11 +1904,18 @@
        int gotpages;
        int error;
        voff_t uoff;
+       vm_prot_t access_type;
+       int advice;
        UVMHIST_FUNC("uvm_fault_lower_io"); UVMHIST_CALLED(maphist);
 
        /* update rusage counters */
        curlwp->l_ru.ru_majflt++;
 
+       /* grab everything we need from the entry before we unlock */
+       uoff = (ufi->orig_rvaddr - ufi->entry->start) + ufi->entry->offset;
+       access_type = flt->access_type & MASK(ufi->entry);
+       advice = ufi->entry->advice;
+
        /* Locked: maps(read), amap(if there), uobj */
        uvmfault_unlockall(ufi, amap, NULL);
 
@@ -1918,10 +1925,8 @@
        uvmexp.fltget++;
        gotpages = 1;
        pg = NULL;
-       uoff = (ufi->orig_rvaddr - ufi->entry->start) + ufi->entry->offset;
        error = uobj->pgops->pgo_get(uobj, uoff, &pg, &gotpages,
-           0, flt->access_type & MASK(ufi->entry), ufi->entry->advice,
-           PGO_SYNCIO);
+           0, access_type, advice, PGO_SYNCIO);
        /* locked: pg(if no error) */
 
        /*



Home | Main Index | Thread Index | Old Index