summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2008-11-10 03:56:17 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2008-11-10 03:56:17 +0000
commitce8919e4d085d3f90fc7037adb6f792b1a2b284c (patch)
tree629c4caa82d17d18b83309209c0ce2c41ac4d90a /sys
parent6a814f32b6f5a12b2709efe7eb472f82e8b082cc (diff)
vm_map_lock() around calls to uvm_map_findspace(); ok tedu
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/exec_elf.c5
-rw-r--r--sys/uvm/uvm_mmap.c6
2 files changed, 8 insertions, 3 deletions
diff --git a/sys/kern/exec_elf.c b/sys/kern/exec_elf.c
index bfff39083f3..2a0083906db 100644
--- a/sys/kern/exec_elf.c
+++ b/sys/kern/exec_elf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: exec_elf.c,v 1.66 2008/07/18 16:58:06 kurt Exp $ */
+/* $OpenBSD: exec_elf.c,v 1.67 2008/11/10 03:56:16 deraadt Exp $ */
/*
* Copyright (c) 1996 Per Fogelstrom
@@ -384,14 +384,17 @@ ELFNAME(load_file)(struct proc *p, char *path, struct exec_package *epp,
addr = round_page((vaddr_t)p->p_vmspace->vm_daddr +
MAXDSIZ);
+ vm_map_lock(&p->p_vmspace->vm_map);
if (uvm_map_findspace(&p->p_vmspace->vm_map, addr, size,
&addr, uobj, uoff, 0, UVM_FLAG_FIXED) == NULL) {
if (uvm_map_findspace(&p->p_vmspace->vm_map, addr, size,
&addr, uobj, uoff, 0, 0) == NULL) {
error = ENOMEM; /* XXX */
+ vm_map_unlock(&p->p_vmspace->vm_map);
goto bad1;
}
}
+ vm_map_unlock(&p->p_vmspace->vm_map);
if (addr != pos + loadmap[i].vaddr) {
/* base changed. */
pos = addr - trunc_page(loadmap[i].vaddr);
diff --git a/sys/uvm/uvm_mmap.c b/sys/uvm/uvm_mmap.c
index 54abd240713..b409c5a3ab0 100644
--- a/sys/uvm/uvm_mmap.c
+++ b/sys/uvm/uvm_mmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_mmap.c,v 1.70 2007/09/01 15:14:44 martin Exp $ */
+/* $OpenBSD: uvm_mmap.c,v 1.71 2008/11/10 03:56:16 deraadt Exp $ */
/* $NetBSD: uvm_mmap.c,v 1.49 2001/02/18 21:19:08 chs Exp $ */
/*
@@ -205,8 +205,9 @@ sys_mquery(p, v, retval)
}
vaddr = round_page((vaddr_t)p->p_vmspace->vm_daddr + MAXDSIZ);
}
-again:
+ vm_map_lock(&p->p_vmspace->vm_map);
+again:
if (uvm_map_findspace(&p->p_vmspace->vm_map, vaddr, size,
&vaddr, uobj, uoff, 0, flags) == NULL) {
if (flags & UVM_FLAG_FIXED)
@@ -224,6 +225,7 @@ again:
error = 0;
*retval = (register_t)(vaddr);
}
+ vm_map_unlock(&p->p_vmspace->vm_map);
done:
if (fp != NULL)
FRELE(fp);