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)
Feb 2 2024, 2:24 PM
Unknown Object (File)
Dec 20 2023, 4:51 AM
Unknown Object (File)
Nov 15 2023, 11:07 AM
Unknown Object (File)
Nov 8 2023, 7:44 PM
Unknown Object (File)
Oct 14 2023, 10:09 AM
Unknown Object (File)
Aug 5 2023, 12:52 AM
Unknown Object (File)
Aug 5 2023, 12:52 AM
Unknown Object (File)
Aug 5 2023, 12:50 AM

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.