When uvm_io reserves kernel address space, make sure it's starts with the

same color as the user address space being copied.
This commit is contained in:
matt 2012-11-02 16:43:16 +00:00
parent 4050c976c3
commit abccd7c658
1 changed files with 7 additions and 4 deletions

View File

@ -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 @@ uvm_map_reserve(struct vm_map *map, vsize_t size,
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 @@ uvm_map_extract(struct vm_map *srcmap, vaddr_t start, vsize_t len,
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 {