summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/hppa/hppa/machdep.c4
-rw-r--r--sys/arch/hppa64/hppa64/machdep.c4
-rw-r--r--sys/arch/i386/i386/machdep.c4
-rw-r--r--sys/arch/macppc/macppc/machdep.c4
-rw-r--r--sys/arch/sh/sh/sh_machdep.c4
-rw-r--r--sys/arch/vax/vax/trap.c4
-rw-r--r--sys/kern/exec_elf.c4
-rw-r--r--sys/kern/kern_exec.c9
-rw-r--r--sys/kern/kern_sysctl.c8
-rw-r--r--sys/kern/sys_process.c13
-rw-r--r--sys/sys/proc.h3
-rw-r--r--sys/uvm/uvm_meter.c9
12 files changed, 40 insertions, 30 deletions
diff --git a/sys/arch/hppa/hppa/machdep.c b/sys/arch/hppa/hppa/machdep.c
index e80132b3091..aaf508e6fd7 100644
--- a/sys/arch/hppa/hppa/machdep.c
+++ b/sys/arch/hppa/hppa/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.240 2014/12/10 15:29:53 mikeb Exp $ */
+/* $OpenBSD: machdep.c,v 1.241 2015/01/20 19:43:20 kettenis Exp $ */
/*
* Copyright (c) 1999-2003 Michael Shalayeff
@@ -1165,7 +1165,7 @@ setregs(struct proc *p, struct exec_package *pack, u_long stack,
tf->tf_iioq_head = pack->ep_entry | HPPA_PC_PRIV_USER;
tf->tf_iioq_tail = tf->tf_iioq_head + 4;
tf->tf_iisq_head = tf->tf_iisq_tail = pcb->pcb_space;
- tf->tf_arg0 = (u_long)PS_STRINGS;
+ tf->tf_arg0 = p->p_p->ps_strings;
/* setup terminal stack frame */
setstack(tf, (stack + 0x3f) & ~0x3f, 0);
diff --git a/sys/arch/hppa64/hppa64/machdep.c b/sys/arch/hppa64/hppa64/machdep.c
index a7fc998040b..deda6e98f78 100644
--- a/sys/arch/hppa64/hppa64/machdep.c
+++ b/sys/arch/hppa64/hppa64/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.76 2014/12/10 15:29:53 mikeb Exp $ */
+/* $OpenBSD: machdep.c,v 1.77 2015/01/20 19:43:20 kettenis Exp $ */
/*
* Copyright (c) 2005 Michael Shalayeff
@@ -808,7 +808,7 @@ setregs(struct proc *p, struct exec_package *pack, u_long stack,
tf->tf_iioq[1] = 4 +
(tf->tf_iioq[0] = pack->ep_entry | HPPA_PC_PRIV_USER);
tf->tf_rp = 0;
- tf->tf_args[0] = (u_long)PS_STRINGS;
+ tf->tf_args[0] = p->p_p->ps_strings;
tf->tf_args[1] = tf->tf_args[2] = 0; /* XXX dynload stuff */
/* setup terminal stack frame */
diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c
index bb8cc6664a7..f5920e352d3 100644
--- a/sys/arch/i386/i386/machdep.c
+++ b/sys/arch/i386/i386/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.563 2015/01/19 16:01:44 jsg Exp $ */
+/* $OpenBSD: machdep.c,v 1.564 2015/01/20 19:43:21 kettenis Exp $ */
/* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */
/*-
@@ -2895,7 +2895,7 @@ setregs(struct proc *p, struct exec_package *pack, u_long stack,
tf->tf_edi = 0;
tf->tf_esi = 0;
tf->tf_ebp = 0;
- tf->tf_ebx = (int)PS_STRINGS;
+ tf->tf_ebx = (int)p->p_p->ps_strings;
tf->tf_edx = 0;
tf->tf_ecx = 0;
tf->tf_eax = 0;
diff --git a/sys/arch/macppc/macppc/machdep.c b/sys/arch/macppc/macppc/machdep.c
index 7b712b82153..69e864fed4a 100644
--- a/sys/arch/macppc/macppc/machdep.c
+++ b/sys/arch/macppc/macppc/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.166 2015/01/20 18:34:00 mpi Exp $ */
+/* $OpenBSD: machdep.c,v 1.167 2015/01/20 19:43:21 kettenis Exp $ */
/* $NetBSD: machdep.c,v 1.4 1996/10/16 19:33:11 ws Exp $ */
/*
@@ -503,7 +503,7 @@ setregs(struct proc *p, struct exec_package *pack, u_long stack,
pargs = -roundup(-stack + 8, 16);
newstack = (u_int32_t)(pargs - 32);
- copyin ((void *)(VM_MAX_ADDRESS-0x10), &args, 0x10);
+ copyin ((void *)p->p_p->ps_strings, &args, 0x10);
bzero(tf, sizeof *tf);
tf->fixreg[1] = newstack;
diff --git a/sys/arch/sh/sh/sh_machdep.c b/sys/arch/sh/sh/sh_machdep.c
index ccf4468d05c..d8eccbfccae 100644
--- a/sys/arch/sh/sh/sh_machdep.c
+++ b/sys/arch/sh/sh/sh_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sh_machdep.c,v 1.37 2014/05/08 21:43:04 miod Exp $ */
+/* $OpenBSD: sh_machdep.c,v 1.38 2015/01/20 19:43:21 kettenis Exp $ */
/* $NetBSD: sh3_machdep.c,v 1.59 2006/03/04 01:13:36 uwe Exp $ */
/*
@@ -581,7 +581,7 @@ setregs(struct proc *p, struct exec_package *pack, u_long stack,
tf->tf_r6 = stack + 4 * tf->tf_r4 + 8; /* envp */
tf->tf_r7 = 0;
tf->tf_r8 = 0;
- tf->tf_r9 = (int)PS_STRINGS;
+ tf->tf_r9 = (int)p->p_p->ps_strings;
tf->tf_r10 = 0;
tf->tf_r11 = 0;
tf->tf_r12 = 0;
diff --git a/sys/arch/vax/vax/trap.c b/sys/arch/vax/vax/trap.c
index 7260b4ec777..d74d65d75e8 100644
--- a/sys/arch/vax/vax/trap.c
+++ b/sys/arch/vax/vax/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.54 2014/11/16 12:30:59 deraadt Exp $ */
+/* $OpenBSD: trap.c,v 1.55 2015/01/20 19:43:21 kettenis Exp $ */
/* $NetBSD: trap.c,v 1.47 1999/08/21 19:26:20 matt Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
@@ -309,7 +309,7 @@ setregs(p, pack, stack, retval)
exptr->r6 = stack; /* for ELF */
exptr->r7 = 0; /* for ELF */
exptr->r8 = 0; /* for ELF */
- exptr->r9 = (u_long) PS_STRINGS; /* for ELF */
+ exptr->r9 = p->p_p->ps_strings; /* for ELF */
retval[1] = 0;
}
diff --git a/sys/kern/exec_elf.c b/sys/kern/exec_elf.c
index 4fcedcf6c1e..8954eabca0e 100644
--- a/sys/kern/exec_elf.c
+++ b/sys/kern/exec_elf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: exec_elf.c,v 1.108 2014/12/22 15:05:24 kettenis Exp $ */
+/* $OpenBSD: exec_elf.c,v 1.109 2015/01/20 19:43:21 kettenis Exp $ */
/*
* Copyright (c) 1996 Per Fogelstrom
@@ -1200,7 +1200,7 @@ ELFNAMEEND(coredump_notes)(struct proc *p, void *iocookie, size_t *sizep)
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;
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c
index 2f92dc9f7a1..811d8e7fa5c 100644
--- a/sys/kern/kern_exec.c
+++ b/sys/kern/kern_exec.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_exec.c,v 1.155 2015/01/15 16:31:19 kettenis Exp $ */
+/* $OpenBSD: kern_exec.c,v 1.156 2015/01/20 19:43:21 kettenis Exp $ */
/* $NetBSD: kern_exec.c,v 1.75 1996/02/09 18:59:28 christos Exp $ */
/*-
@@ -466,7 +466,12 @@ sys_execve(struct proc *p, void *v, register_t *retval)
goto exec_abort;
/* copy out the process's ps_strings structure */
- if (copyout(&arginfo, (char *)PS_STRINGS, sizeof(arginfo)))
+#ifdef MACHINE_STACK_GROWS_UP
+ pr->ps_strings = (vaddr_t)PS_STRINGS + sgap;
+#else
+ pr->ps_strings = (vaddr_t)PS_STRINGS - sgap;
+#endif
+ if (copyout(&arginfo, (char *)pr->ps_strings, sizeof(arginfo)))
goto exec_abort;
stopprofclock(pr); /* stop profiling */
diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c
index 04e08d21fbe..1b6df9ea98b 100644
--- a/sys/kern/kern_sysctl.c
+++ b/sys/kern/kern_sysctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_sysctl.c,v 1.278 2015/01/13 10:07:58 mpf Exp $ */
+/* $OpenBSD: kern_sysctl.c,v 1.279 2015/01/20 19:43:21 kettenis Exp $ */
/* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */
/*-
@@ -1566,6 +1566,7 @@ sysctl_proc_args(int *name, u_int namelen, void *oldp, size_t *oldlenp,
char **rargv, **vargv; /* reader vs. victim */
char *rarg, *varg, *buf;
struct vmspace *vm;
+ vaddr_t ps_strings;
if (namelen > 2)
return (ENOTDIR);
@@ -1610,6 +1611,7 @@ sysctl_proc_args(int *name, u_int namelen, void *oldp, size_t *oldlenp,
(error = suser(cp, 0)) != 0))
return (error);
+ ps_strings = vpr->ps_strings;
vm = vpr->ps_vmspace;
vm->vm_refcnt++;
vpr = NULL;
@@ -1619,8 +1621,8 @@ sysctl_proc_args(int *name, u_int namelen, void *oldp, size_t *oldlenp,
iov.iov_base = &pss;
iov.iov_len = sizeof(pss);
uio.uio_iov = &iov;
- uio.uio_iovcnt = 1;
- uio.uio_offset = (off_t)(vaddr_t)PS_STRINGS;
+ uio.uio_iovcnt = 1;
+ uio.uio_offset = (off_t)ps_strings;
uio.uio_resid = sizeof(pss);
uio.uio_segflg = UIO_SYSSPACE;
uio.uio_rw = UIO_READ;
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);
diff --git a/sys/sys/proc.h b/sys/sys/proc.h
index 72d684c5075..77a372f425d 100644
--- a/sys/sys/proc.h
+++ b/sys/sys/proc.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: proc.h,v 1.192 2015/01/15 23:59:09 deraadt Exp $ */
+/* $OpenBSD: proc.h,v 1.193 2015/01/20 19:43:21 kettenis Exp $ */
/* $NetBSD: proc.h,v 1.44 1996/04/22 01:23:21 christos Exp $ */
/*-
@@ -199,6 +199,7 @@ struct process {
struct plimit *ps_limit; /* Process limits. */
struct pgrp *ps_pgrp; /* Pointer to process group. */
struct emul *ps_emul; /* Emulation information */
+ vaddr_t ps_strings; /* User pointers to argv/env */
vaddr_t ps_sigcode; /* User pointer to the signal code */
u_int ps_rtableid; /* Process routing table/domain. */
char ps_nice; /* Process "nice" value. */
diff --git a/sys/uvm/uvm_meter.c b/sys/uvm/uvm_meter.c
index e9e116bc662..42e2b13ed37 100644
--- a/sys/uvm/uvm_meter.c
+++ b/sys/uvm/uvm_meter.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_meter.c,v 1.34 2014/07/11 16:35:40 jsg Exp $ */
+/* $OpenBSD: uvm_meter.c,v 1.35 2015/01/20 19:43:21 kettenis Exp $ */
/* $NetBSD: uvm_meter.c,v 1.21 2001/07/14 06:36:03 matt Exp $ */
/*
@@ -147,9 +147,9 @@ int
uvm_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
size_t newlen, struct proc *p)
{
+ struct process *pr = p->p_p;
struct vmtotal vmtotals;
int rv, t;
- struct _ps_strings _ps = { PS_STRINGS };
switch (name[0]) {
case VM_SWAPENCRYPT:
@@ -184,8 +184,9 @@ uvm_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
return (sysctl_rdint(oldp, oldlenp, newp, nkmempages));
case VM_PSSTRINGS:
- return (sysctl_rdstruct(oldp, oldlenp, newp, &_ps,
- sizeof(_ps)));
+ return (sysctl_rdstruct(oldp, oldlenp, newp, &pr->ps_strings,
+ sizeof(pr->ps_strings)));
+
case VM_ANONMIN:
t = uvmexp.anonminpct;
rv = sysctl_int(oldp, oldlenp, newp, newlen, &t);