Page MenuHomeFreeBSD

Simplify the code to allocate stack for auxv, argv[], and environment vectors.
ClosedPublic

Authored by jhb on Apr 17 2018, 10:58 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Jan 2, 2:08 PM
Unknown Object (File)
Sat, Dec 27, 11:22 PM
Unknown Object (File)
Dec 19 2025, 6:30 PM
Unknown Object (File)
Dec 6 2025, 12:30 PM
Unknown Object (File)
Nov 27 2025, 7:04 PM
Unknown Object (File)
Nov 20 2025, 5:27 PM
Unknown Object (File)
Nov 20 2025, 5:24 PM
Unknown Object (File)
Nov 20 2025, 5:24 PM
Subscribers

Details

Summary

Remove auxarg_size as it was only used once right after a confusing
assignment in each of the variants of exec_copyout_strings().

Test Plan
  • booted a patched FreeBSD/amd64 kernel and was able to run FreeBSD/amd64, FreeBSD/i386, and Linux/x86-64 binaries.

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 16219
Build 16170: arc lint + arc unit

Event Timeline

emaste added inline comments.
sys/amd64/linux/linux_sysvec.c
337–338

Maybe capital-A Auxargs follows from struct Elf64_Auxargs?

340–342

Perhaps a _Static_assert that sizeof(Elf_Auxinfo) is some multiple of sizeof (char *)?

348

Thanks, I think this comment is much improved.

This revision is now accepted and ready to land.Apr 18 2018, 7:44 PM
sys/amd64/linux/linux_sysvec.c
340–342

I started down that path and then tried an alternate approach of decrementing vectp directly using howmany(). This doesn't require the casts and is shorter and looks more like the math to handle the argv and env vectors. Will update after some more testing.

This also needs to use Elf64_Auxinfo.

sys/amd64/linux32/linux32_sysvec.c
792

Just noticed these roundup/rounddown's are probably wrong (just need to be aligned to uint32_t) but it doesn't hurt beyond a few bytes of wasted space.

  • Use howmany() and pointer subtraction for auxargs.
This revision now requires review to proceed.Apr 19 2018, 2:58 AM
This revision is now accepted and ready to land.Apr 19 2018, 1:57 PM
This revision was automatically updated to reflect the committed changes.