diff options
author | Ted Unangst <tedu@cvs.openbsd.org> | 2010-12-15 04:59:54 +0000 |
---|---|---|
committer | Ted Unangst <tedu@cvs.openbsd.org> | 2010-12-15 04:59:54 +0000 |
commit | b38aff3bb464aa95b8b2f90afe716b60ec2cb942 (patch) | |
tree | c216eccadfeff6571e435c478e3bbc32d33b2c15 | |
parent | 0f3a260613b896e64171926d73bdf2f5d5eaa481 (diff) |
add a BRKSIZ define and use it for the heap gap constant, decoupling
heap gap from max data size. nothing else changes yet. ok deraadt
-rw-r--r-- | sys/arch/i386/include/vmparam.h | 5 | ||||
-rw-r--r-- | sys/compat/svr4/svr4_misc.c | 6 | ||||
-rw-r--r-- | sys/dev/pci/drm/drm_bufs.c | 2 | ||||
-rw-r--r-- | sys/kern/exec_elf.c | 8 | ||||
-rw-r--r-- | sys/uvm/uvm_map.c | 8 | ||||
-rw-r--r-- | sys/uvm/uvm_mmap.c | 10 |
6 files changed, 20 insertions, 19 deletions
diff --git a/sys/arch/i386/include/vmparam.h b/sys/arch/i386/include/vmparam.h index 293879609de..5607e914e6e 100644 --- a/sys/arch/i386/include/vmparam.h +++ b/sys/arch/i386/include/vmparam.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vmparam.h,v 1.43 2009/06/16 16:42:41 ariane Exp $ */ +/* $OpenBSD: vmparam.h,v 1.44 2010/12/15 04:59:52 tedu Exp $ */ /* $NetBSD: vmparam.h,v 1.15 1994/10/27 04:16:34 cgd Exp $ */ /*- @@ -65,6 +65,9 @@ #ifndef MAXDSIZ #define MAXDSIZ (1024*1024*1024) /* max data size */ #endif +#ifndef BRKSIZ +#define BRKSIZ (1024*1024*1024) +#endif #ifndef DFLSSIZ #define DFLSSIZ (4*1024*1024) /* initial stack size limit */ #endif diff --git a/sys/compat/svr4/svr4_misc.c b/sys/compat/svr4/svr4_misc.c index dd2130514a2..22327acbd4b 100644 --- a/sys/compat/svr4/svr4_misc.c +++ b/sys/compat/svr4/svr4_misc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: svr4_misc.c,v 1.55 2010/07/26 01:56:27 guenther Exp $ */ +/* $OpenBSD: svr4_misc.c,v 1.56 2010/12/15 04:59:52 tedu Exp $ */ /* $NetBSD: svr4_misc.c,v 1.42 1996/12/06 03:22:34 christos Exp $ */ /* @@ -370,7 +370,7 @@ svr4_sys_mmap(p, v, retval) SCARG(&mm, addr) = SCARG(uap, addr); SCARG(&mm, pos) = SCARG(uap, pos); - rp = (void *) round_page((vaddr_t)p->p_vmspace->vm_daddr + MAXDSIZ); + rp = (void *) round_page((vaddr_t)p->p_vmspace->vm_daddr + BRKSIZ); if ((SCARG(&mm, flags) & MAP_FIXED) == 0 && SCARG(&mm, addr) != 0 && SCARG(&mm, addr) < rp) SCARG(&mm, addr) = rp; @@ -404,7 +404,7 @@ svr4_sys_mmap64(p, v, retval) SCARG(&mm, addr) = SCARG(uap, addr); SCARG(&mm, pos) = SCARG(uap, pos); - rp = (void *) round_page((vaddr_t)p->p_vmspace->vm_daddr + MAXDSIZ); + rp = (void *) round_page((vaddr_t)p->p_vmspace->vm_daddr + BRKSIZ); if ((SCARG(&mm, flags) & MAP_FIXED) == 0 && SCARG(&mm, addr) != 0 && SCARG(&mm, addr) < rp) SCARG(&mm, addr) = rp; diff --git a/sys/dev/pci/drm/drm_bufs.c b/sys/dev/pci/drm/drm_bufs.c index d56644794a6..a4890cdd696 100644 --- a/sys/dev/pci/drm/drm_bufs.c +++ b/sys/dev/pci/drm/drm_bufs.c @@ -960,7 +960,7 @@ drm_mapbufs(struct drm_device *dev, void *data, struct drm_file *file_priv) foff = 0; } - vaddr = round_page((vaddr_t)vms->vm_daddr + MAXDSIZ); + vaddr = round_page((vaddr_t)vms->vm_daddr + BRKSIZ); retcode = uvm_mmap(&vms->vm_map, &vaddr, size, UVM_PROT_READ | UVM_PROT_WRITE, UVM_PROT_ALL, MAP_SHARED, (caddr_t)vn, foff, curproc->p_rlimit[RLIMIT_MEMLOCK].rlim_cur, diff --git a/sys/kern/exec_elf.c b/sys/kern/exec_elf.c index 45c82fab991..542b4e703f0 100644 --- a/sys/kern/exec_elf.c +++ b/sys/kern/exec_elf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exec_elf.c,v 1.77 2010/09/17 14:03:09 mikeb Exp $ */ +/* $OpenBSD: exec_elf.c,v 1.78 2010/12/15 04:59:52 tedu Exp $ */ /* * Copyright (c) 1996 Per Fogelstrom @@ -417,11 +417,11 @@ ELFNAME(load_file)(struct proc *p, char *path, struct exec_package *epp, addr = trunc_page(pos + loadmap[i].vaddr); size = round_page(addr + loadmap[i].memsz) - addr; - /* CRAP - map_findspace does not avoid daddr+MAXDSIZ */ + /* CRAP - map_findspace does not avoid daddr+BRKSIZ */ if ((addr + size > (vaddr_t)p->p_vmspace->vm_daddr) && - (addr < (vaddr_t)p->p_vmspace->vm_daddr + MAXDSIZ)) + (addr < (vaddr_t)p->p_vmspace->vm_daddr + BRKSIZ)) addr = round_page((vaddr_t)p->p_vmspace->vm_daddr + - MAXDSIZ); + BRKSIZ); vm_map_lock(&p->p_vmspace->vm_map); if (uvm_map_findspace(&p->p_vmspace->vm_map, addr, size, diff --git a/sys/uvm/uvm_map.c b/sys/uvm/uvm_map.c index 37bed97d9d2..53aa5c4fe7c 100644 --- a/sys/uvm/uvm_map.c +++ b/sys/uvm/uvm_map.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_map.c,v 1.129 2010/12/06 20:57:19 miod Exp $ */ +/* $OpenBSD: uvm_map.c,v 1.130 2010/12/15 04:59:52 tedu Exp $ */ /* $NetBSD: uvm_map.c,v 1.86 2000/11/27 08:40:03 chs Exp $ */ /* @@ -1257,12 +1257,10 @@ uvm_map_hint(struct proc *p, vm_prot_t prot) return (round_page(addr)); } #endif - addr = (vaddr_t)p->p_vmspace->vm_daddr + MAXDSIZ; -#if !defined(__vax__) - addr += arc4random() & (MIN((256 * 1024 * 1024), MAXDSIZ) - 1); -#else /* start malloc/mmap after the brk */ addr = (vaddr_t)p->p_vmspace->vm_daddr + BRKSIZ; +#if !defined(__vax__) + addr += arc4random() & (MIN((256 * 1024 * 1024), BRKSIZ) - 1); #endif return (round_page(addr)); } diff --git a/sys/uvm/uvm_mmap.c b/sys/uvm/uvm_mmap.c index 8ee3ed07500..4e606dbf8ae 100644 --- a/sys/uvm/uvm_mmap.c +++ b/sys/uvm/uvm_mmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_mmap.c,v 1.80 2010/05/21 23:22:33 oga Exp $ */ +/* $OpenBSD: uvm_mmap.c,v 1.81 2010/12/15 04:59:53 tedu Exp $ */ /* $NetBSD: uvm_mmap.c,v 1.49 2001/02/18 21:19:08 chs Exp $ */ /* @@ -189,12 +189,12 @@ sys_mquery(struct proc *p, void *v, register_t *retval) /* prevent a user requested address from falling in heap space */ if ((vaddr + size > (vaddr_t)p->p_vmspace->vm_daddr) && - (vaddr < (vaddr_t)p->p_vmspace->vm_daddr + MAXDSIZ)) { + (vaddr < (vaddr_t)p->p_vmspace->vm_daddr + BRKSIZ)) { if (flags & UVM_FLAG_FIXED) { error = EINVAL; goto done; } - vaddr = round_page((vaddr_t)p->p_vmspace->vm_daddr + MAXDSIZ); + vaddr = round_page((vaddr_t)p->p_vmspace->vm_daddr + BRKSIZ); } vm_map_lock(&p->p_vmspace->vm_map); @@ -208,9 +208,9 @@ again: } else { /* prevent a returned address from falling in heap space */ if ((vaddr + size > (vaddr_t)p->p_vmspace->vm_daddr) - && (vaddr < (vaddr_t)p->p_vmspace->vm_daddr + MAXDSIZ)) { + && (vaddr < (vaddr_t)p->p_vmspace->vm_daddr + BRKSIZ)) { vaddr = round_page((vaddr_t)p->p_vmspace->vm_daddr + - MAXDSIZ); + BRKSIZ); goto again; } error = 0; |