summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/vm/vm_map.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c
index 656858e..50fc1b9 100644
--- a/sys/vm/vm_map.c
+++ b/sys/vm/vm_map.c
@@ -2375,6 +2375,13 @@ vm_map_stack (vm_map_t map, vm_offset_t addrbos, vm_size_t max_ssize,
return (KERN_NO_SPACE);
}
+ /* If we would blow our VMEM resource limit, no go */
+ if (map->size + init_ssize >
+ curthread->td_proc->p_rlimit[RLIMIT_VMEM].rlim_cur) {
+ vm_map_unlock(map);
+ return (KERN_NO_SPACE);
+ }
+
/* If we can't accomodate max_ssize in the current mapping,
* no go. However, we need to be aware that subsequent user
* mappings might map into the space we have reserved for
@@ -2518,6 +2525,13 @@ Retry:
ctob(vm->vm_ssize);
}
+ /* If we would blow our VMEM resource limit, no go */
+ if (map->size + grow_amount >
+ curthread->td_proc->p_rlimit[RLIMIT_VMEM].rlim_cur) {
+ vm_map_unlock_read(map);
+ return (KERN_NO_SPACE);
+ }
+
if (vm_map_lock_upgrade(map))
goto Retry;
OpenPOWER on IntegriCloud