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
This commit is contained in:
Konstantin Belousov 2012-04-21 18:36:53 +00:00
parent 2aa163dc57
commit 1472f4f4b9

View File

@ -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