summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Dillon <dillon@FreeBSD.org>2002-06-26 03:13:46 +0000
committerMatthew Dillon <dillon@FreeBSD.org>2002-06-26 03:13:46 +0000
commita69ac1740f6bec31807f659f9f7d76e7a0387c98 (patch)
tree566bf91857942198ee88c0f8ddba3a32e5cc176d
parentfa98e2d56e2f2b7c4a7a965f2d510c8e4c541be6 (diff)
Notes
-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 656858e2885d..50fc1b9bad75 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;