summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2012-04-21 18:36:53 +0000
committerkib <kib@FreeBSD.org>2012-04-21 18:36:53 +0000
commitbc0324054920c1be4d48b9124891155c8e1c6f5c (patch)
tree571594de34c51e399f5b504f70e1befbdc0a6a3a
parentad5c747d1de39d9fdd7096a2314b7cb2eecb3448 (diff)
downloadFreeBSD-src-bc0324054920c1be4d48b9124891155c8e1c6f5c.zip
FreeBSD-src-bc0324054920c1be4d48b9124891155c8e1c6f5c.tar.gz
When MAP_STACK mapping is created, the map entry is created only to
cover the initial stack size. For MCL_WIREFUTURE maps, the subsequent call to vm_map_wire() to wire the whole stack region fails due to VM_MAP_WIRE_NOHOLES flag. Use the VM_MAP_WIRE_HOLESOK to only wire mapped part of the stack. Reported and tested by: Sushanth Rai <sushanth_rai yahoo com> Reviewed by: alc MFC after: 1 week
-rw-r--r--sys/vm/vm_mmap.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/vm/vm_mmap.c b/sys/vm/vm_mmap.c
index 2588c85..3fccd9e 100644
--- a/sys/vm/vm_mmap.c
+++ b/sys/vm/vm_mmap.c
@@ -1561,9 +1561,11 @@ vm_mmap(vm_map_t map, vm_offset_t *addr, vm_size_t size, vm_prot_t prot,
* If the process has requested that all future mappings
* be wired, then heed this.
*/
- if (map->flags & MAP_WIREFUTURE)
+ if (map->flags & MAP_WIREFUTURE) {
vm_map_wire(map, *addr, *addr + size,
- VM_MAP_WIRE_USER | VM_MAP_WIRE_NOHOLES);
+ VM_MAP_WIRE_USER | ((flags & MAP_STACK) ?
+ VM_MAP_WIRE_HOLESOK : VM_MAP_WIRE_NOHOLES));
+ }
} else {
/*
* If this mapping was accounted for in the vnode's
OpenPOWER on IntegriCloud