diff options
author | Ted Unangst <tedu@cvs.openbsd.org> | 2003-10-08 22:23:57 +0000 |
---|---|---|
committer | Ted Unangst <tedu@cvs.openbsd.org> | 2003-10-08 22:23:57 +0000 |
commit | 7da81f4d735ebfa8eaa079e932ea338d7b8bd1e6 (patch) | |
tree | 572ecf07db9d55a1fb488377b888933528b052c3 /sys/uvm/uvm_map.c | |
parent | 397ece6612ffd1e5d9d1df960c10133dfa6adfaa (diff) |
randomize return from uvm_map_hint. the random increment is limited
to prevent fragmentation.
this has the effect of randomizing unhinted mmap()s, sysV mem, and
position of ld.so.
tested on many archs by many developers for quite some time.
use of MIN to allow m68k to play from miod@.
vax is not included.
ok deraadt@ miod@
Diffstat (limited to 'sys/uvm/uvm_map.c')
-rw-r--r-- | sys/uvm/uvm_map.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/uvm/uvm_map.c b/sys/uvm/uvm_map.c index e5240144f1c..220674d2a1e 100644 --- a/sys/uvm/uvm_map.c +++ b/sys/uvm/uvm_map.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_map.c,v 1.62 2003/09/03 22:52:47 tedu Exp $ */ +/* $OpenBSD: uvm_map.c,v 1.63 2003/10/08 22:23:56 tedu Exp $ */ /* $NetBSD: uvm_map.c,v 1.86 2000/11/27 08:40:03 chs Exp $ */ /* @@ -1095,8 +1095,8 @@ uvm_map_hint(struct proc *p, vm_prot_t prot) } #endif addr = (vaddr_t)p->p_vmspace->vm_daddr + MAXDSIZ; -#if 0 - addr += arc4random() & (256 * 1024 * 1024 - 1); +#if !defined(__vax__) + addr += arc4random() & (MIN((256 * 1024 * 1024), MAXDSIZ) - 1); #endif return (round_page(addr)); } |