Page MenuHomeFreeBSD

Add a sv_copyout_auxargs() hook in sysentvec.
ClosedPublic

Authored by jhb on Nov 13 2019, 11:02 PM.
Tags
None
Referenced Files
Unknown Object (File)
Oct 1 2024, 10:12 AM
Unknown Object (File)
Sep 21 2024, 1:46 PM
Unknown Object (File)
Sep 19 2024, 5:13 AM
Unknown Object (File)
Sep 17 2024, 10:57 AM
Unknown Object (File)
Sep 16 2024, 5:28 PM
Unknown Object (File)
Sep 8 2024, 11:31 PM
Unknown Object (File)
Sep 7 2024, 10:35 PM
Unknown Object (File)
Aug 17 2024, 1:59 PM

Details

Summary

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.

Tested on: amd64 (amd64 and i386 binaries), i386, mips, mips64

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

LGTM. This makes much more sense.

sys/kern/kern_exec.c
1641 ↗(On Diff #64292)

Would it be too ELF specific to call __elfN(freebsd_copyout_auxargs) here if imgp->sysent->sv_copyout_auxargs == NULL to avoid most of the explicit assignments?

This revision is now accepted and ready to land.Nov 13 2019, 11:19 PM
sys/kern/kern_exec.c
1641 ↗(On Diff #64292)

It feels like it would be, though the use of Elf_Auxinfo was ELF-specific before. OTOH, you can't actually call __elfN() here since this file isn't compiled multiple times (though I suppose freebsd32 already uses a separate copyout_strings()). Hmm, I'm not sure. In the Linux ABIs in the child review, it does seem like linux_copyout_strings() should just call linux_copyout_auxargs() directly, though I guess on i386 we support Linux a.out still.

This revision was automatically updated to reflect the committed changes.