svn commit: r360024 - in head/sys: amd64/linux amd64/linux32 arm64/linux compat/freebsd32 i386/linux kern powerpc/powerpc sys
Brooks Davis
brooks at FreeBSD.org
Thu Apr 16 21:53:19 UTC 2020
Author: brooks
Date: Thu Apr 16 21:53:17 2020
New Revision: 360024
URL: https://svnweb.freebsd.org/changeset/base/360024
Log:
Convert canary, execpathp, and pagesizes to pointers.
Use AUXARGS_ENTRY_PTR to export these pointers. This is a followup to
r359987 and r359988.
Reviewed by: jhb
Obtained from: CheriBSD
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D24446
Modified:
head/sys/amd64/linux/linux_sysvec.c
head/sys/amd64/linux32/linux32_sysvec.c
head/sys/arm64/linux/linux_sysvec.c
head/sys/compat/freebsd32/freebsd32_misc.c
head/sys/i386/linux/linux_sysvec.c
head/sys/kern/imgact_elf.c
head/sys/kern/kern_exec.c
head/sys/powerpc/powerpc/elf_common.c
head/sys/sys/imgact.h
Modified: head/sys/amd64/linux/linux_sysvec.c
==============================================================================
--- head/sys/amd64/linux/linux_sysvec.c Thu Apr 16 20:46:35 2020 (r360023)
+++ head/sys/amd64/linux/linux_sysvec.c Thu Apr 16 21:53:17 2020 (r360024)
@@ -254,9 +254,9 @@ linux_copyout_auxargs(struct image_params *imgp, uintp
AUXARGS_ENTRY(pos, AT_EGID, imgp->proc->p_ucred->cr_svgid);
AUXARGS_ENTRY(pos, LINUX_AT_SECURE, issetugid);
AUXARGS_ENTRY(pos, LINUX_AT_PLATFORM, PTROUT(linux_platform));
- AUXARGS_ENTRY(pos, LINUX_AT_RANDOM, imgp->canary);
+ AUXARGS_ENTRY_PTR(pos, LINUX_AT_RANDOM, imgp->canary);
if (imgp->execpathp != 0)
- AUXARGS_ENTRY(pos, LINUX_AT_EXECFN, imgp->execpathp);
+ AUXARGS_ENTRY_PTR(pos, LINUX_AT_EXECFN, imgp->execpathp);
if (args->execfd != -1)
AUXARGS_ENTRY(pos, AT_EXECFD, args->execfd);
AUXARGS_ENTRY(pos, AT_NULL, 0);
@@ -315,8 +315,8 @@ linux_copyout_strings(struct image_params *imgp, uintp
if (execpath_len != 0) {
destp -= execpath_len;
destp = rounddown2(destp, sizeof(void *));
- imgp->execpathp = destp;
- error = copyout(imgp->execpath, (void *)destp, execpath_len);
+ imgp->execpathp = (void *)destp;
+ error = copyout(imgp->execpath, imgp->execpathp, execpath_len);
if (error != 0)
return (error);
}
@@ -324,8 +324,8 @@ linux_copyout_strings(struct image_params *imgp, uintp
/* Prepare the canary for SSP. */
arc4rand(canary, sizeof(canary), 0);
destp -= roundup(sizeof(canary), sizeof(void *));
- imgp->canary = destp;
- error = copyout(canary, (void *)destp, sizeof(canary));
+ imgp->canary = (void *)destp;
+ error = copyout(canary, imgp->canary, sizeof(canary));
if (error != 0)
return (error);
Modified: head/sys/amd64/linux32/linux32_sysvec.c
==============================================================================
--- head/sys/amd64/linux32/linux32_sysvec.c Thu Apr 16 20:46:35 2020 (r360023)
+++ head/sys/amd64/linux32/linux32_sysvec.c Thu Apr 16 21:53:17 2020 (r360024)
@@ -742,8 +742,8 @@ linux_copyout_strings(struct image_params *imgp, uintp
if (execpath_len != 0) {
destp -= execpath_len;
destp = rounddown2(destp, sizeof(uint32_t));
- imgp->execpathp = destp;
- error = copyout(imgp->execpath, (void *)destp, execpath_len);
+ imgp->execpathp = (void *)destp;
+ error = copyout(imgp->execpath, imgp->execpathp, execpath_len);
if (error != 0)
return (error);
}
@@ -751,8 +751,8 @@ linux_copyout_strings(struct image_params *imgp, uintp
/* Prepare the canary for SSP. */
arc4rand(canary, sizeof(canary), 0);
destp -= roundup(sizeof(canary), sizeof(uint32_t));
- imgp->canary = destp;
- error = copyout(canary, (void *)destp, sizeof(canary));
+ imgp->canary = (void *)destp;
+ error = copyout(canary, imgp->canary, sizeof(canary));
if (error != 0)
return (error);
Modified: head/sys/arm64/linux/linux_sysvec.c
==============================================================================
--- head/sys/arm64/linux/linux_sysvec.c Thu Apr 16 20:46:35 2020 (r360023)
+++ head/sys/arm64/linux/linux_sysvec.c Thu Apr 16 21:53:17 2020 (r360024)
@@ -180,9 +180,9 @@ linux_copyout_auxargs(struct image_params *imgp, uintp
#if 0 /* LINUXTODO: implement arm64 LINUX_AT_PLATFORM */
AUXARGS_ENTRY(pos, LINUX_AT_PLATFORM, PTROUT(linux_platform));
#endif
- AUXARGS_ENTRY(pos, LINUX_AT_RANDOM, imgp->canary);
+ AUXARGS_ENTRY_PTR(pos, LINUX_AT_RANDOM, imgp->canary);
if (imgp->execpathp != 0)
- AUXARGS_ENTRY(pos, LINUX_AT_EXECFN, imgp->execpathp);
+ AUXARGS_ENTRY_PTR(pos, LINUX_AT_EXECFN, imgp->execpathp);
if (args->execfd != -1)
AUXARGS_ENTRY(pos, AT_EXECFD, args->execfd);
AUXARGS_ENTRY(pos, AT_NULL, 0);
@@ -236,8 +236,8 @@ linux_copyout_strings(struct image_params *imgp, uintp
if (execpath_len != 0) {
destp -= execpath_len;
destp = rounddown2(destp, sizeof(void *));
- imgp->execpathp = destp;
- error = copyout(imgp->execpath, (void *)destp, execpath_len);
+ imgp->execpathp = (void *)destp;
+ error = copyout(imgp->execpath, imgp->execpathp, execpath_len);
if (error != 0)
return (error);
}
@@ -245,8 +245,8 @@ linux_copyout_strings(struct image_params *imgp, uintp
/* Prepare the canary for SSP. */
arc4rand(canary, sizeof(canary), 0);
destp -= roundup(sizeof(canary), sizeof(void *));
- imgp->canary = destp;
- error = copyout(canary, (void *)destp, sizeof(canary));
+ imgp->canary = (void *)destp;
+ error = copyout(canary, imgp->canary, sizeof(canary));
if (error != 0)
return (error);
Modified: head/sys/compat/freebsd32/freebsd32_misc.c
==============================================================================
--- head/sys/compat/freebsd32/freebsd32_misc.c Thu Apr 16 20:46:35 2020 (r360023)
+++ head/sys/compat/freebsd32/freebsd32_misc.c Thu Apr 16 21:53:17 2020 (r360024)
@@ -3161,8 +3161,8 @@ freebsd32_copyout_strings(struct image_params *imgp, u
*/
if (execpath_len != 0) {
destp -= execpath_len;
- imgp->execpathp = destp;
- error = copyout(imgp->execpath, (void *)destp, execpath_len);
+ imgp->execpathp = (void *)destp;
+ error = copyout(imgp->execpath, imgp->execpathp, execpath_len);
if (error != 0)
return (error);
}
@@ -3172,8 +3172,8 @@ freebsd32_copyout_strings(struct image_params *imgp, u
*/
arc4rand(canary, sizeof(canary), 0);
destp -= sizeof(canary);
- imgp->canary = destp;
- error = copyout(canary, (void *)destp, sizeof(canary));
+ imgp->canary = (void *)destp;
+ error = copyout(canary, imgp->canary, sizeof(canary));
if (error != 0)
return (error);
imgp->canarylen = sizeof(canary);
@@ -3185,8 +3185,8 @@ freebsd32_copyout_strings(struct image_params *imgp, u
pagesizes32[i] = (uint32_t)pagesizes[i];
destp -= sizeof(pagesizes32);
destp = rounddown2(destp, sizeof(uint32_t));
- imgp->pagesizes = destp;
- error = copyout(pagesizes32, (void *)destp, sizeof(pagesizes32));
+ imgp->pagesizes = (void *)destp;
+ error = copyout(pagesizes32, imgp->pagesizes, sizeof(pagesizes32));
if (error != 0)
return (error);
imgp->pagesizeslen = sizeof(pagesizes32);
Modified: head/sys/i386/linux/linux_sysvec.c
==============================================================================
--- head/sys/i386/linux/linux_sysvec.c Thu Apr 16 20:46:35 2020 (r360023)
+++ head/sys/i386/linux/linux_sysvec.c Thu Apr 16 21:53:17 2020 (r360024)
@@ -237,9 +237,9 @@ linux_copyout_auxargs(struct image_params *imgp, uintp
AUXARGS_ENTRY(pos, AT_GID, imgp->proc->p_ucred->cr_rgid);
AUXARGS_ENTRY(pos, AT_EGID, imgp->proc->p_ucred->cr_svgid);
AUXARGS_ENTRY(pos, LINUX_AT_PLATFORM, PTROUT(uplatform));
- AUXARGS_ENTRY(pos, LINUX_AT_RANDOM, imgp->canary);
+ AUXARGS_ENTRY_PTR(pos, LINUX_AT_RANDOM, imgp->canary);
if (imgp->execpathp != 0)
- AUXARGS_ENTRY(pos, LINUX_AT_EXECFN, imgp->execpathp);
+ AUXARGS_ENTRY_PTR(pos, LINUX_AT_EXECFN, imgp->execpathp);
if (args->execfd != -1)
AUXARGS_ENTRY(pos, AT_EXECFD, args->execfd);
AUXARGS_ENTRY(pos, AT_NULL, 0);
@@ -301,8 +301,8 @@ linux_copyout_strings(struct image_params *imgp, uintp
if (execpath_len != 0) {
destp -= execpath_len;
destp = rounddown2(destp, sizeof(void *));
- imgp->execpathp = destp;
- error = copyout(imgp->execpath, (void *)destp, execpath_len);
+ imgp->execpathp = (void *)destp;
+ error = copyout(imgp->execpath, imgp->execpathp, execpath_len);
if (error != 0)
return (error);
}
@@ -310,8 +310,8 @@ linux_copyout_strings(struct image_params *imgp, uintp
/* Prepare the canary for SSP. */
arc4rand(canary, sizeof(canary), 0);
destp -= roundup(sizeof(canary), sizeof(void *));
- imgp->canary = destp;
- error = copyout(canary, (void *)destp, sizeof(canary));
+ imgp->canary = (void *)destp;
+ error = copyout(canary, imgp->canary, sizeof(canary));
if (error != 0)
return (error);
Modified: head/sys/kern/imgact_elf.c
==============================================================================
--- head/sys/kern/imgact_elf.c Thu Apr 16 20:46:35 2020 (r360023)
+++ head/sys/kern/imgact_elf.c Thu Apr 16 21:53:17 2020 (r360024)
@@ -1349,16 +1349,16 @@ __elfN(freebsd_copyout_auxargs)(struct image_params *i
AUXARGS_ENTRY(pos, AT_BASE, args->base);
AUXARGS_ENTRY(pos, AT_EHDRFLAGS, args->hdr_eflags);
if (imgp->execpathp != 0)
- AUXARGS_ENTRY(pos, AT_EXECPATH, imgp->execpathp);
+ AUXARGS_ENTRY_PTR(pos, AT_EXECPATH, imgp->execpathp);
AUXARGS_ENTRY(pos, AT_OSRELDATE,
imgp->proc->p_ucred->cr_prison->pr_osreldate);
if (imgp->canary != 0) {
- AUXARGS_ENTRY(pos, AT_CANARY, imgp->canary);
+ AUXARGS_ENTRY_PTR(pos, AT_CANARY, imgp->canary);
AUXARGS_ENTRY(pos, AT_CANARYLEN, imgp->canarylen);
}
AUXARGS_ENTRY(pos, AT_NCPUS, mp_ncpus);
if (imgp->pagesizes != 0) {
- AUXARGS_ENTRY(pos, AT_PAGESIZES, imgp->pagesizes);
+ AUXARGS_ENTRY_PTR(pos, AT_PAGESIZES, imgp->pagesizes);
AUXARGS_ENTRY(pos, AT_PAGESIZESLEN, imgp->pagesizeslen);
}
if (imgp->sysent->sv_timekeep_base != 0) {
Modified: head/sys/kern/kern_exec.c
==============================================================================
--- head/sys/kern/kern_exec.c Thu Apr 16 20:46:35 2020 (r360023)
+++ head/sys/kern/kern_exec.c Thu Apr 16 21:53:17 2020 (r360024)
@@ -1571,8 +1571,8 @@ exec_copyout_strings(struct image_params *imgp, uintpt
if (execpath_len != 0) {
destp -= execpath_len;
destp = rounddown2(destp, sizeof(void *));
- imgp->execpathp = destp;
- error = copyout(imgp->execpath, (void *)destp, execpath_len);
+ imgp->execpathp = (void *)destp;
+ error = copyout(imgp->execpath, imgp->execpathp, execpath_len);
if (error != 0)
return (error);
}
@@ -1582,8 +1582,8 @@ exec_copyout_strings(struct image_params *imgp, uintpt
*/
arc4rand(canary, sizeof(canary), 0);
destp -= sizeof(canary);
- imgp->canary = destp;
- error = copyout(canary, (void *)destp, sizeof(canary));
+ imgp->canary = (void *)destp;
+ error = copyout(canary, imgp->canary, sizeof(canary));
if (error != 0)
return (error);
imgp->canarylen = sizeof(canary);
@@ -1593,8 +1593,8 @@ exec_copyout_strings(struct image_params *imgp, uintpt
*/
destp -= szps;
destp = rounddown2(destp, sizeof(void *));
- imgp->pagesizes = destp;
- error = copyout(pagesizes, (void *)destp, szps);
+ imgp->pagesizes = (void *)destp;
+ error = copyout(pagesizes, imgp->pagesizes, szps);
if (error != 0)
return (error);
imgp->pagesizeslen = szps;
Modified: head/sys/powerpc/powerpc/elf_common.c
==============================================================================
--- head/sys/powerpc/powerpc/elf_common.c Thu Apr 16 20:46:35 2020 (r360023)
+++ head/sys/powerpc/powerpc/elf_common.c Thu Apr 16 21:53:17 2020 (r360024)
@@ -54,16 +54,16 @@ __elfN(powerpc_copyout_auxargs)(struct image_params *i
AUXARGS_ENTRY(pos, AT_OLD_BASE, args->base);
AUXARGS_ENTRY(pos, AT_OLD_EHDRFLAGS, args->hdr_eflags);
if (imgp->execpathp != 0)
- AUXARGS_ENTRY(pos, AT_OLD_EXECPATH, imgp->execpathp);
+ AUXARGS_ENTRY_PTR(pos, AT_OLD_EXECPATH, imgp->execpathp);
AUXARGS_ENTRY(pos, AT_OLD_OSRELDATE,
imgp->proc->p_ucred->cr_prison->pr_osreldate);
if (imgp->canary != 0) {
- AUXARGS_ENTRY(pos, AT_OLD_CANARY, imgp->canary);
+ AUXARGS_ENTRY_PTR(pos, AT_OLD_CANARY, imgp->canary);
AUXARGS_ENTRY(pos, AT_OLD_CANARYLEN, imgp->canarylen);
}
AUXARGS_ENTRY(pos, AT_OLD_NCPUS, mp_ncpus);
if (imgp->pagesizes != 0) {
- AUXARGS_ENTRY(pos, AT_OLD_PAGESIZES, imgp->pagesizes);
+ AUXARGS_ENTRY_PTR(pos, AT_OLD_PAGESIZES, imgp->pagesizes);
AUXARGS_ENTRY(pos, AT_OLD_PAGESIZESLEN, imgp->pagesizeslen);
}
if (imgp->sysent->sv_timekeep_base != 0) {
Modified: head/sys/sys/imgact.h
==============================================================================
--- head/sys/sys/imgact.h Thu Apr 16 20:46:35 2020 (r360023)
+++ head/sys/sys/imgact.h Thu Apr 16 21:53:17 2020 (r360024)
@@ -81,11 +81,11 @@ struct image_params {
void *argv; /* pointer to argv (user space) */
void *envv; /* pointer to envv (user space) */
char *execpath;
- unsigned long execpathp;
+ void *execpathp;
char *freepath;
- unsigned long canary;
+ void *canary;
int canarylen;
- unsigned long pagesizes;
+ void *pagesizes;
int pagesizeslen;
vm_prot_t stack_prot;
u_long stack_sz;
More information about the svn-src-all
mailing list