diff options
author | Michael Shalayeff <mickey@cvs.openbsd.org> | 2002-04-25 04:36:44 +0000 |
---|---|---|
committer | Michael Shalayeff <mickey@cvs.openbsd.org> | 2002-04-25 04:36:44 +0000 |
commit | 111a4e9f838d2bedb71d72db200520ccf3360f7c (patch) | |
tree | 493b4f124e63e9a5bbcabece992ad04649373fb0 /sys | |
parent | 1298a977d9d37dac395bd826f4b223ab468ec96e (diff) |
do not map memory for malloc w/ execute perms.
this prevents i-cache preload on some archs,
but does not hurt on others anyway.
art looked all over all the pmaps,
miod and mickey tested it on all possible archs,
deraadt made a lesson out of it for the rest of the folks.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/uvm/uvm_km.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/uvm/uvm_km.c b/sys/uvm/uvm_km.c index 99367a74feb..42321f2e5f7 100644 --- a/sys/uvm/uvm_km.c +++ b/sys/uvm/uvm_km.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_km.c,v 1.30 2002/04/22 16:25:46 deraadt Exp $ */ +/* $OpenBSD: uvm_km.c,v 1.31 2002/04/25 04:36:43 mickey Exp $ */ /* $NetBSD: uvm_km.c,v 1.42 2001/01/14 02:10:01 thorpej Exp $ */ /* @@ -507,7 +507,7 @@ uvm_km_kmemalloc(map, obj, size, flags) */ if (__predict_false(uvm_map(map, &kva, size, obj, UVM_UNKNOWN_OFFSET, - 0, UVM_MAPFLAG(UVM_PROT_ALL, UVM_PROT_ALL, UVM_INH_NONE, + 0, UVM_MAPFLAG(UVM_PROT_RW, UVM_PROT_RW, UVM_INH_NONE, UVM_ADV_RANDOM, (flags & UVM_KMF_TRYLOCK))) != KERN_SUCCESS)) { UVMHIST_LOG(maphist, "<- done (no VM)",0,0,0,0); @@ -569,10 +569,10 @@ uvm_km_kmemalloc(map, obj, size, flags) if (UVM_OBJ_IS_INTRSAFE_OBJECT(obj)) { pmap_kenter_pa(loopva, VM_PAGE_TO_PHYS(pg), - VM_PROT_ALL); + UVM_PROT_RW); } else { pmap_enter(map->pmap, loopva, VM_PAGE_TO_PHYS(pg), - UVM_PROT_ALL, + UVM_PROT_RW, PMAP_WIRED | VM_PROT_READ | VM_PROT_WRITE); } loopva += PAGE_SIZE; |