diff options
| author | 2015-01-20 19:43:20 +0000 | |
|---|---|---|
| committer | 2015-01-20 19:43:20 +0000 | |
| commit | a78264c4e9c84e56b13e967228e9e8fcf5e087ff (patch) | |
| tree | 9fa75b55b79da83f4f990388d32b33f769420bf4 /sys/kern/sys_process.c | |
| parent | one more "center"; tedu forgot to use -i, i think... (diff) | |
| download | wireguard-openbsd-a78264c4e9c84e56b13e967228e9e8fcf5e087ff.tar.xz wireguard-openbsd-a78264c4e9c84e56b13e967228e9e8fcf5e087ff.zip | |
Move ps_strings "after" the random stackgap. This makes its location a
per-process value, and therefpore turns the VM_PSSTRINGS sysctl into a
per-process one as well. This gets rid of a pointer to the bottom of the
stack at a fixed location. Also clears the road for unmapping the stackgap.
ok deraadt@
Diffstat (limited to 'sys/kern/sys_process.c')
| -rw-r--r-- | sys/kern/sys_process.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/sys/kern/sys_process.c b/sys/kern/sys_process.c index 31de7a1d2de..67866a24551 100644 --- a/sys/kern/sys_process.c +++ b/sys/kern/sys_process.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sys_process.c,v 1.66 2014/12/12 07:45:46 tedu Exp $ */ +/* $OpenBSD: sys_process.c,v 1.67 2015/01/20 19:43:21 kettenis Exp $ */ /* $NetBSD: sys_process.c,v 1.55 1996/05/15 06:17:47 tls Exp $ */ /*- @@ -748,6 +748,7 @@ process_domem(struct proc *curp, struct proc *p, struct uio *uio, int req) int process_auxv_offset(struct proc *curp, struct proc *p, struct uio *uiop) { + struct process *pr = p->p_p; struct ps_strings pss; struct iovec iov; struct uio uio; @@ -757,7 +758,7 @@ process_auxv_offset(struct proc *curp, struct proc *p, struct uio *uiop) iov.iov_len = sizeof(pss); uio.uio_iov = &iov; uio.uio_iovcnt = 1; - uio.uio_offset = (off_t)(vaddr_t)PS_STRINGS; + uio.uio_offset = (off_t)pr->ps_strings; uio.uio_resid = sizeof(pss); uio.uio_segflg = UIO_SYSSPACE; uio.uio_rw = UIO_READ; @@ -771,13 +772,13 @@ process_auxv_offset(struct proc *curp, struct proc *p, struct uio *uiop) uiop->uio_offset += (off_t)(vaddr_t)(pss.ps_envstr + pss.ps_nenvstr + 1); #ifdef MACHINE_STACK_GROWS_UP - if (uiop->uio_offset < (off_t)(vaddr_t)PS_STRINGS) + if (uiop->uio_offset < (off_t)pr->ps_strings) return (EIO); #else - if (uiop->uio_offset > (off_t)(vaddr_t)PS_STRINGS) + if (uiop->uio_offset > (off_t)pr->ps_strings) return (EIO); - if ((uiop->uio_offset + uiop->uio_resid) > (off_t)(vaddr_t)PS_STRINGS) - uiop->uio_resid = (off_t)(vaddr_t)PS_STRINGS - uiop->uio_offset; + if ((uiop->uio_offset + uiop->uio_resid) > (off_t)pr->ps_strings) + uiop->uio_resid = (off_t)pr->ps_strings - uiop->uio_offset; #endif return (0); |
