Source-Changes-HG archive

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

[src/trunk]: src/sys/uvm When uvm_io reserves kernel address space, make sure...



details:   https://anonhg.NetBSD.org/src/rev/c45c8652b74f
branches:  trunk
changeset: 782422:c45c8652b74f
user:      matt <matt%NetBSD.org@localhost>
date:      Fri Nov 02 16:43:16 2012 +0000

description:
When uvm_io reserves kernel address space, make sure it's starts with the
same color as the user address space being copied.

diffstat:

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

diffs (40 lines):

diff -r 5bf7a4e96647 -r c45c8652b74f sys/uvm/uvm_map.c
--- a/sys/uvm/uvm_map.c Fri Nov 02 16:32:35 2012 +0000
+++ b/sys/uvm/uvm_map.c Fri Nov 02 16:43:16 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_map.c,v 1.323 2012/10/29 16:00:05 para Exp $       */
+/*     $NetBSD: uvm_map.c,v 1.324 2012/11/02 16:43:16 matt 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.323 2012/10/29 16:00:05 para Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.324 2012/11/02 16:43:16 matt Exp $");
 
 #include "opt_ddb.h"
 #include "opt_uvmhist.h"
@@ -2369,7 +2369,7 @@
     vaddr_t offset     /* hint for pmap_prefer */,
     vsize_t align      /* alignment */,
     vaddr_t *raddr     /* IN:hint, OUT: reserved VA */,
-    uvm_flag_t flags   /* UVM_FLAG_FIXED or 0 */)
+    uvm_flag_t flags   /* UVM_FLAG_FIXED or UVM_FLAG_COLORMATCH or 0 */)
 {
        UVMHIST_FUNC("uvm_map_reserve"); UVMHIST_CALLED(maphist);
 
@@ -2576,8 +2576,11 @@
 
        if ((flags & UVM_EXTRACT_RESERVED) == 0) {
                dstaddr = vm_map_min(dstmap);
-               if (!uvm_map_reserve(dstmap, len, start, 0, &dstaddr, 0))
+               if (!uvm_map_reserve(dstmap, len, start, 
+                   atop(start) & uvmexp.colormask, &dstaddr,
+                   UVM_FLAG_COLORMATCH))
                        return (ENOMEM);
+               KASSERT((atop(start ^ dstaddr) & uvmexp.colormask) == 0);
                *dstaddrp = dstaddr;    /* pass address back to caller */
                UVMHIST_LOG(maphist, "  dstaddr=0x%x", dstaddr,0,0,0);
        } else {



Home | Main Index | Thread Index | Old Index