From 397df744f90e2b6e5edb0b1c1d42076821efecef Mon Sep 17 00:00:00 2001 From: Brooks Davis Date: Wed, 15 Apr 2020 20:21:30 +0000 Subject: [PATCH] Make ps_strings in struct image_params into a pointer. This is a prepratory commit for D24407. Reviewed by: kib Obtained from: CheriBSD Sponsored by: DARPA --- sys/amd64/ia32/ia32_signal.c | 2 +- sys/amd64/linux32/linux32_sysvec.c | 2 +- sys/compat/freebsd32/freebsd32_misc.c | 1 + sys/kern/imgact_aout.c | 2 +- sys/kern/kern_exec.c | 1 + sys/sys/imgact.h | 2 +- 6 files changed, 6 insertions(+), 4 deletions(-) diff --git a/sys/amd64/ia32/ia32_signal.c b/sys/amd64/ia32/ia32_signal.c index 0f2d874d142e..51dd1f38090f 100644 --- a/sys/amd64/ia32/ia32_signal.c +++ b/sys/amd64/ia32/ia32_signal.c @@ -961,7 +961,7 @@ ia32_setregs(struct thread *td, struct image_params *imgp, uintptr_t stack) regs->tf_rflags = PSL_USER | saved_rflags; regs->tf_ss = _udatasel; regs->tf_cs = _ucode32sel; - regs->tf_rbx = imgp->ps_strings; + regs->tf_rbx = (register_t)imgp->ps_strings; regs->tf_ds = _udatasel; regs->tf_es = _udatasel; regs->tf_fs = _ufssel; diff --git a/sys/amd64/linux32/linux32_sysvec.c b/sys/amd64/linux32/linux32_sysvec.c index 867235bf8f57..2f0865c8e890 100644 --- a/sys/amd64/linux32/linux32_sysvec.c +++ b/sys/amd64/linux32/linux32_sysvec.c @@ -708,7 +708,7 @@ linux_exec_setregs(struct thread *td, struct image_params *imgp, regs->tf_ss = _udatasel; regs->tf_flags = TF_HASSEGS; regs->tf_cs = _ucode32sel; - regs->tf_rbx = imgp->ps_strings; + regs->tf_rbx = (register_t)imgp->ps_strings; fpstate_drop(td); diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c index 375371a502bd..9480d437bd9a 100644 --- a/sys/compat/freebsd32/freebsd32_misc.c +++ b/sys/compat/freebsd32/freebsd32_misc.c @@ -3137,6 +3137,7 @@ freebsd32_copyout_strings(struct image_params *imgp, uintptr_t *stack_base) execpath_len = 0; arginfo = (struct freebsd32_ps_strings *)curproc->p_sysent-> sv_psstrings; + imgp->ps_strings = arginfo; if (imgp->proc->p_sysent->sv_sigcode_base == 0) szsigcode = *(imgp->proc->p_sysent->sv_szsigcode); else diff --git a/sys/kern/imgact_aout.c b/sys/kern/imgact_aout.c index 5a1b400f1d50..8062bac35a4b 100644 --- a/sys/kern/imgact_aout.c +++ b/sys/kern/imgact_aout.c @@ -200,7 +200,7 @@ exec_aout_imgact(struct image_params *imgp) file_offset = 0; /* Pass PS_STRINGS for BSD/OS binaries only. */ if (N_GETMID(*a_out) == MID_ZERO) - imgp->ps_strings = aout_sysvec.sv_psstrings; + imgp->ps_strings = (void *)aout_sysvec.sv_psstrings; break; default: /* NetBSD compatibility */ diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index 1e8cd39192fc..c99bd884668d 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -1546,6 +1546,7 @@ exec_copyout_strings(struct image_params *imgp, uintptr_t *stack_base) p = imgp->proc; szsigcode = 0; arginfo = (struct ps_strings *)p->p_sysent->sv_psstrings; + imgp->ps_strings = arginfo; if (p->p_sysent->sv_sigcode_base == 0) { if (p->p_sysent->sv_szsigcode != NULL) szsigcode = *(p->p_sysent->sv_szsigcode); diff --git a/sys/sys/imgact.h b/sys/sys/imgact.h index c3709858ced8..35ddbbd946f3 100644 --- a/sys/sys/imgact.h +++ b/sys/sys/imgact.h @@ -75,7 +75,7 @@ struct image_params { char *interpreter_name; /* name of the interpreter */ void *auxargs; /* ELF Auxinfo structure pointer */ struct sf_buf *firstpage; /* first page that we mapped */ - unsigned long ps_strings; /* PS_STRINGS for BSD/OS binaries */ + void *ps_strings; /* pointer to ps_string (user space) */ struct image_args *args; /* system call arguments */ struct sysentvec *sysent; /* system entry vector */ char *execpath;