Source-Changes-HG archive

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

[src/trunk]: src/sys/uvm Add missing lock around pmap_protect.



details:   https://anonhg.NetBSD.org/src/rev/ced5c26954fc
branches:  trunk
changeset: 457683:ced5c26954fc
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Fri Jul 12 06:27:13 2019 +0000

description:
Add missing lock around pmap_protect.
ok, chs@

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

diffstat:

 sys/uvm/uvm_map.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (30 lines):

diff -r cf96b9f74dac -r ced5c26954fc sys/uvm/uvm_map.c
--- a/sys/uvm/uvm_map.c Fri Jul 12 03:57:50 2019 +0000
+++ b/sys/uvm/uvm_map.c Fri Jul 12 06:27:13 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_map.c,v 1.361 2019/07/11 17:07:10 maxv Exp $       */
+/*     $NetBSD: uvm_map.c,v 1.362 2019/07/12 06:27:13 mlelstv Exp $    */
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -66,7 +66,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.361 2019/07/11 17:07:10 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.362 2019/07/12 06:27:13 mlelstv Exp $");
 
 #include "opt_ddb.h"
 #include "opt_pax.h"
@@ -4446,9 +4446,11 @@
                if (old_entry->aref.ar_amap &&
                    !UVM_ET_ISNEEDSCOPY(old_entry)) {
                        if (old_entry->max_protection & VM_PROT_WRITE) {
+                               uvm_map_lock_entry(old_entry);
                                pmap_protect(old_map->pmap,
                                    old_entry->start, old_entry->end,
                                    old_entry->protection & ~VM_PROT_WRITE);
+                               uvm_map_unlock_entry(old_entry);
                        }
                        old_entry->etype |= UVM_ET_NEEDSCOPY;
                }



Home | Main Index | Thread Index | Old Index