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)
Dec 20 2023, 4:30 AM
Unknown Object (File)
Nov 27 2023, 2:31 PM
Unknown Object (File)
Nov 25 2023, 12:50 AM
Unknown Object (File)
Nov 23 2023, 8:10 AM
Unknown Object (File)
Jun 15 2023, 2:46 AM
Unknown Object (File)
May 18 2023, 5:03 PM
Unknown Object (File)
Jan 18 2023, 2:17 AM
Unknown Object (File)
Dec 4 2022, 4:49 AM
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

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

Event Timeline

emaste added inline comments.
sys/amd64/linux/linux_sysvec.c
344 ↗(On Diff #41603)

Maybe capital-A Auxargs follows from struct Elf64_Auxargs?

347–348 ↗(On Diff #41603)

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

355 ↗(On Diff #41603)

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
347–348 ↗(On Diff #41603)

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
830 ↗(On Diff #41603)

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.