aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/kern_exec.c
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2019-11-15 18:42:13 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2019-11-15 18:42:13 +0000
commite353233118b40ad89658630e5effe402c6e81fd7 (patch)
tree9781427ac5e9ffe63add763415ce7535585e9a3a /sys/kern/kern_exec.c
parent310399ac729d85bd35f4e9763f9168eed7c470cc (diff)
downloadsrc-e353233118b40ad89658630e5effe402c6e81fd7.tar.gz
src-e353233118b40ad89658630e5effe402c6e81fd7.zip
Add a sv_copyout_auxargs() hook in sysentvec.
Change the FreeBSD ELF ABIs to use this new hook to copyout ELF auxv instead of doing it in the sv_fixup hook. In particular, this new hook allows the stack space to be allocated at the same time the auxv values are copied out to userland. This allows us to avoid wasting space for unused auxv entries as well as not having to recalculate where the auxv vector is by walking back up over the argv and environment vectors. Reviewed by: brooks, emaste Tested on: amd64 (amd64 and i386 binaries), i386, mips, mips64 Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D22355
Notes
Notes: svn path=/head/; revision=354741
Diffstat (limited to 'sys/kern/kern_exec.c')
-rw-r--r--sys/kern/kern_exec.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c
index f2a6c1143cea..dc5f72093ca0 100644
--- a/sys/kern/kern_exec.c
+++ b/sys/kern/kern_exec.c
@@ -1637,14 +1637,8 @@ exec_copyout_strings(struct image_params *imgp)
if (imgp->sysent->sv_stackgap != NULL)
imgp->sysent->sv_stackgap(imgp, (u_long *)&vectp);
- if (imgp->auxargs) {
- /*
- * Allocate room on the stack for the ELF auxargs
- * array. It has up to AT_COUNT entries.
- */
- vectp -= howmany(AT_COUNT * sizeof(Elf_Auxinfo),
- sizeof(*vectp));
- }
+ if (imgp->auxargs)
+ imgp->sysent->sv_copyout_auxargs(imgp, (u_long *)&vectp);
/*
* Allocate room for the argv[] and env vectors including the