Page MenuHomeFreeBSD

Ensure we have a large enough stack for the lua loader
ClosedPublic

Authored by andrew on Aug 24 2018, 7:12 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Apr 23, 3:47 PM
Unknown Object (File)
Dec 20 2023, 2:57 AM
Unknown Object (File)
Oct 19 2023, 6:24 PM
Unknown Object (File)
Aug 27 2023, 8:39 AM
Unknown Object (File)
Jul 8 2023, 10:59 AM
Unknown Object (File)
Jul 8 2023, 10:58 AM
Unknown Object (File)
Jul 8 2023, 10:56 AM
Unknown Object (File)
Jul 8 2023, 10:41 AM
Subscribers

Details

Summary

Lua has a few places where it allocates a large buffer on the stack. This
is normally fine, except there are a few places where there can be multiple
frames with this buffer. This can cause a stack overflow on some arm64 SoCs.

Fix this by allocating our own stack in loader.efi large enough for these
objects. The required size has been found by tracing how the stack pointer
changes in a virtual machine and found to be no larger than 50kB. A
larger stack is allocated to reduce the likely hood of overflow from future
changes.

Diff Detail

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

Event Timeline

kevans added inline comments.
stand/efi/boot1/Makefile
9 ↗(On Diff #47257)

I really wish we could just kick boot1 out of the tree and make this a non-issue, but I guess that's not a good idea this late in the release process.

This revision is now accepted and ready to land.Aug 24 2018, 7:18 PM
stand/efi/boot1/Makefile
9 ↗(On Diff #47257)

That's just there as the fix is unneeded by boot1.efi. We could set the stack pointer in boot1.efi, however it's unneeded as the UEFI stack is large enough.

This revision was automatically updated to reflect the committed changes.