diff options
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/exec_elf.c | 24 | ||||
-rw-r--r-- | sys/kern/kern_exec.c | 3 | ||||
-rw-r--r-- | sys/kern/kern_malloc.c | 11 | ||||
-rw-r--r-- | sys/kern/sysv_shm.c | 5 |
4 files changed, 20 insertions, 23 deletions
diff --git a/sys/kern/exec_elf.c b/sys/kern/exec_elf.c index d4bdfd1ba7e..542d9295839 100644 --- a/sys/kern/exec_elf.c +++ b/sys/kern/exec_elf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exec_elf.c,v 1.82 2011/05/24 15:27:36 ariane Exp $ */ +/* $OpenBSD: exec_elf.c,v 1.83 2011/06/06 17:10:23 ariane Exp $ */ /* * Copyright (c) 1996 Per Fogelstrom @@ -333,7 +333,6 @@ ELFNAME(load_file)(struct proc *p, char *path, struct exec_package *epp, int nload, idx = 0; Elf_Addr pos = *last; int file_align; - int loop; NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, path, p); if ((error = namei(&nd)) != 0) { @@ -390,7 +389,6 @@ ELFNAME(load_file)(struct proc *p, char *path, struct exec_package *epp, pos = ELF_ROUND(pos, file_align); *last = epp->ep_interp_pos = pos; - loop = 0; for (i = 0; i < nload;/**/) { vaddr_t addr; struct uvm_object *uobj; @@ -418,17 +416,17 @@ ELFNAME(load_file)(struct proc *p, char *path, struct exec_package *epp, addr = round_page((vaddr_t)p->p_vmspace->vm_daddr + BRKSIZ); - if (uvm_map_mquery(&p->p_vmspace->vm_map, &addr, size, - (i == 0 ? uoff : UVM_UNKNOWN_OFFSET), 0) != 0) { - if (loop == 0) { - loop = 1; - i = 0; - *last = epp->ep_interp_pos = pos = 0; - continue; + 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; } - error = ENOMEM; - 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/kern/kern_exec.c b/sys/kern/kern_exec.c index 5518cf41929..92db43a6f3b 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_exec.c,v 1.118 2011/05/24 15:27:36 ariane Exp $ */ +/* $OpenBSD: kern_exec.c,v 1.119 2011/06/06 17:10:23 ariane Exp $ */ /* $NetBSD: kern_exec.c,v 1.75 1996/02/09 18:59:28 christos Exp $ */ /*- @@ -810,6 +810,7 @@ exec_sigcode_map(struct proc *p, struct emul *e) } /* Just a hint to uvm_mmap where to put it. */ + p->p_sigcode = uvm_map_hint(p, VM_PROT_READ|VM_PROT_EXECUTE); uao_reference(e->e_sigobject); if (uvm_map(&p->p_vmspace->vm_map, &p->p_sigcode, round_page(sz), e->e_sigobject, 0, 0, UVM_MAPFLAG(UVM_PROT_RX, UVM_PROT_RX, diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c index 2912fd97c4c..adce9cc787d 100644 --- a/sys/kern/kern_malloc.c +++ b/sys/kern/kern_malloc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_malloc.c,v 1.88 2011/06/06 17:05:46 deraadt Exp $ */ +/* $OpenBSD: kern_malloc.c,v 1.89 2011/06/06 17:10:23 ariane Exp $ */ /* $NetBSD: kern_malloc.c,v 1.15.4.2 1996/06/13 17:10:56 cgd Exp $ */ /* @@ -576,13 +576,8 @@ kmeminit(void) kmeminit_nkmempages(); base = vm_map_min(kernel_map); kmem_map = uvm_km_suballoc(kernel_map, &base, &limit, - (vsize_t)(nkmempages * PAGE_SIZE), -#ifdef KVA_GUARDPAGES - VM_MAP_INTRSAFE | VM_MAP_GUARDPAGES, -#else - VM_MAP_INTRSAFE, -#endif - FALSE, &kmem_map_store); + (vsize_t)(nkmempages * PAGE_SIZE), VM_MAP_INTRSAFE, FALSE, + &kmem_map_store); kmembase = (char *)base; kmemlimit = (char *)limit; kmemusage = (struct kmemusage *) uvm_km_zalloc(kernel_map, diff --git a/sys/kern/sysv_shm.c b/sys/kern/sysv_shm.c index 228e1da7654..18535cb9320 100644 --- a/sys/kern/sysv_shm.c +++ b/sys/kern/sysv_shm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sysv_shm.c,v 1.52 2011/05/24 15:27:36 ariane Exp $ */ +/* $OpenBSD: sysv_shm.c,v 1.53 2011/06/06 17:10:23 ariane Exp $ */ /* $NetBSD: sysv_shm.c,v 1.50 1998/10/21 22:24:29 tron Exp $ */ /* @@ -264,6 +264,9 @@ sys_shmat(struct proc *p, void *v, register_t *retval) attach_va = (vaddr_t)SCARG(uap, shmaddr); else return (EINVAL); + } else { + /* This is just a hint to uvm_map() about where to put it. */ + attach_va = uvm_map_hint(p, prot); } shm_handle = shmseg->shm_internal; uao_reference(shm_handle->shm_object); |