summaryrefslogtreecommitdiff
path: root/sys/uvm/uvm_addr.c
diff options
context:
space:
mode:
authorMatthew Dempsky <matthew@cvs.openbsd.org>2012-06-06 04:54:37 +0000
committerMatthew Dempsky <matthew@cvs.openbsd.org>2012-06-06 04:54:37 +0000
commit210494c853f9987e8b7a4dd61cb184e48c1c32c1 (patch)
treea1963627052928e3dfce359fb77067de15582aea /sys/uvm/uvm_addr.c
parent26ff5f629cee273823a79d7f9b10b44fddd18ee5 (diff)
Fix address-space randomization that was accidentally disabled in
uvm_addr.c r1.3. ok deraadt, tedu
Diffstat (limited to 'sys/uvm/uvm_addr.c')
-rw-r--r--sys/uvm/uvm_addr.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/uvm/uvm_addr.c b/sys/uvm/uvm_addr.c
index 82c10a350a5..298c24aa2a8 100644
--- a/sys/uvm/uvm_addr.c
+++ b/sys/uvm/uvm_addr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_addr.c,v 1.3 2012/04/11 11:23:22 ariane Exp $ */
+/* $OpenBSD: uvm_addr.c,v 1.4 2012/06/06 04:54:36 matthew Exp $ */
/*
* Copyright (c) 2011 Ariane van der Steldt <ariane@stack.nl>
@@ -629,7 +629,10 @@ uaddr_rnd_select(struct vm_map *map, struct uvm_addr_state *uaddr,
MIN(uaddr->uaddr_maxaddr, VMMAP_FREE_END(entry)),
sz, align, offset, before_gap, after_gap) == 0) {
*entry_out = entry;
- *addr_out = low_addr;
+ if (hint >= low_addr && hint <= high_addr)
+ *addr_out = hint;
+ else
+ *addr_out = low_addr;
return 0;
}