summaryrefslogtreecommitdiffstats
path: root/sys/vm
diff options
context:
space:
mode:
authorzont <zont@FreeBSD.org>2012-09-03 09:34:46 +0000
committerzont <zont@FreeBSD.org>2012-09-03 09:34:46 +0000
commitf93fc1d7195e06a52ec2829e72969185b87aa86b (patch)
treeeef0bff476e94712de9de424f0654faed25c2a86 /sys/vm
parent867f7e9a1267bc9f51f1019e4b6c5f31b4c41f58 (diff)
downloadFreeBSD-src-f93fc1d7195e06a52ec2829e72969185b87aa86b.zip
FreeBSD-src-f93fc1d7195e06a52ec2829e72969185b87aa86b.tar.gz
- After r240026 sgrowsiz should be used in a safer maner.
Approved by: kib (mentor) MCF after: 1 week
Diffstat (limited to 'sys/vm')
-rw-r--r--sys/vm/vm_map.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c
index aefed47..da96bab 100644
--- a/sys/vm/vm_map.c
+++ b/sys/vm/vm_map.c
@@ -3245,7 +3245,7 @@ vm_map_stack(vm_map_t map, vm_offset_t addrbos, vm_size_t max_ssize,
{
vm_map_entry_t new_entry, prev_entry;
vm_offset_t bot, top;
- vm_size_t init_ssize;
+ vm_size_t growsize, init_ssize;
int orient, rv;
rlim_t vmemlim;
@@ -3264,7 +3264,8 @@ vm_map_stack(vm_map_t map, vm_offset_t addrbos, vm_size_t max_ssize,
addrbos + max_ssize < addrbos)
return (KERN_NO_SPACE);
- init_ssize = (max_ssize < sgrowsiz) ? max_ssize : sgrowsiz;
+ growsize = sgrowsiz;
+ init_ssize = (max_ssize < growsize) ? max_ssize : growsize;
PROC_LOCK(curthread->td_proc);
vmemlim = lim_cur(curthread->td_proc, RLIMIT_VMEM);
@@ -3357,6 +3358,7 @@ vm_map_growstack(struct proc *p, vm_offset_t addr)
struct vmspace *vm = p->p_vmspace;
vm_map_t map = &vm->vm_map;
vm_offset_t end;
+ vm_size_t growsize;
size_t grow_amount, max_grow;
rlim_t stacklim, vmemlim;
int is_procstack, rv;
@@ -3476,8 +3478,9 @@ Retry:
PROC_UNLOCK(p);
#endif
- /* Round up the grow amount modulo SGROWSIZ */
- grow_amount = roundup (grow_amount, sgrowsiz);
+ /* Round up the grow amount modulo sgrowsiz */
+ growsize = sgrowsiz;
+ grow_amount = roundup(grow_amount, growsize);
if (grow_amount > stack_entry->avail_ssize)
grow_amount = stack_entry->avail_ssize;
if (is_procstack && (ctob(vm->vm_ssize) + grow_amount > stacklim)) {
OpenPOWER on IntegriCloud