diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c index 40c317d93a62..b35ae100b5ce 100644 --- a/sys/vm/vm_map.c +++ b/sys/vm/vm_map.c @@ -3338,7 +3338,8 @@ vm_map_growstack(struct proc *p, vm_offset_t addr) if (grow_amount > stack_entry->avail_ssize) grow_amount = stack_entry->avail_ssize; if (is_procstack && (ctob(vm->vm_ssize) + grow_amount > stacklim)) { - grow_amount = stacklim - ctob(vm->vm_ssize); + grow_amount = trunc_page((vm_size_t)stacklim) - + ctob(vm->vm_ssize); } /* If we would blow our VMEM resource limit, no go */