From 1472f4f4b951c99cc7d0e978749aa9dabb42e052 Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Sat, 21 Apr 2012 18:36:53 +0000 Subject: [PATCH] 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 Reviewed by: alc MFC after: 1 week --- sys/vm/vm_mmap.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/vm/vm_mmap.c b/sys/vm/vm_mmap.c index 2588c8573728..3fccd9e02c10 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