summaryrefslogtreecommitdiff
path: root/sys/uvm/uvm_unix.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/uvm/uvm_unix.c')
-rw-r--r--sys/uvm/uvm_unix.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sys/uvm/uvm_unix.c b/sys/uvm/uvm_unix.c
index 0506b6fd81d..8f7ce154295 100644
--- a/sys/uvm/uvm_unix.c
+++ b/sys/uvm/uvm_unix.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_unix.c,v 1.69 2020/10/13 08:47:59 mpi Exp $ */
+/* $OpenBSD: uvm_unix.c,v 1.70 2020/10/19 08:19:46 mpi Exp $ */
/* $NetBSD: uvm_unix.c,v 1.18 2000/09/13 15:00:25 thorpej Exp $ */
/*
@@ -108,19 +108,22 @@ void
uvm_grow(struct proc *p, vaddr_t sp)
{
struct vmspace *vm = p->p_vmspace;
+ vm_map_t map = &vm->vm_map;
int si;
/* For user defined stacks (from sendsig). */
if (sp < (vaddr_t)vm->vm_maxsaddr)
return;
+ vm_map_lock(map);
+
/* For common case of already allocated (from trap). */
#ifdef MACHINE_STACK_GROWS_UP
if (sp < (vaddr_t)vm->vm_maxsaddr + ptoa(vm->vm_ssize))
#else
if (sp >= (vaddr_t)vm->vm_minsaddr - ptoa(vm->vm_ssize))
#endif
- return;
+ goto out;
/* Really need to check vs limit and increment stack size if ok. */
#ifdef MACHINE_STACK_GROWS_UP
@@ -130,6 +133,8 @@ uvm_grow(struct proc *p, vaddr_t sp)
#endif
if (vm->vm_ssize + si <= atop(lim_cur(RLIMIT_STACK)))
vm->vm_ssize += si;
+out:
+ vm_map_unlock(map);
}
#ifndef SMALL_KERNEL