Page MenuHomeFreeBSD

loader: disk io should not use alloca()
ClosedPublic

Authored by tsoome on Feb 5 2017, 6:04 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Dec 20, 11:44 AM
Unknown Object (File)
Mon, Dec 2, 6:16 AM
Unknown Object (File)
Nov 7 2024, 6:09 PM
Unknown Object (File)
Nov 5 2024, 1:55 PM
Unknown Object (File)
Oct 22 2024, 11:59 PM
Unknown Object (File)
Oct 22 2024, 11:55 PM
Unknown Object (File)
Oct 22 2024, 11:55 PM
Unknown Object (File)
Oct 22 2024, 11:55 PM

Details

Summary

The alloca() does give us pointer and we have no practical way to check if the area
is actually available, resulting in corruption in corner cases.

Unfortunately we do not have too many options right now, but to use one page.

Test Plan

Done usb/disk boot and no immediate issues were detected, CD boot is in queue.
The CD boot is the most probable victim as the one page is just enough for
2 sectors (2KB).

About the background: The loader (user) memory starts from physical address 0xa000,
we have loader code, data and bss segments there. The stack is set on memory end.
The memory end in this case means the value from BDA address 0x413 (2 bytes, value is
in kilobytes). Therefore the stack address is actually system specific and in general
is at about 610k-640k range. So it is entirely possible that at some point the
loader runtime setup and the loader stack will meet heads up.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 7222
Build 7392: arc lint + arc unit

Event Timeline

tsoome retitled this revision from to loader: disk io should not use alloca().
tsoome updated this object.
tsoome edited the test plan for this revision. (Show Details)
tsoome added reviewers: allanjude, imp.
allanjude edited edge metadata.

Approved for commit

This revision is now accepted and ready to land.Feb 5 2017, 10:54 PM

11.0.1 release did not boot out the box for me, with this patch applied it boots again -- so I can verify it works and fixed my previous problem.

This revision was automatically updated to reflect the committed changes.