Page MenuHomeFreeBSD

RISC-V: Check that the DTB doesn't overlap with kernel
ClosedPublic

Authored by arichardson on Jun 5 2020, 5:29 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Apr 5, 7:46 AM
Unknown Object (File)
Sat, Apr 4, 6:26 AM
Unknown Object (File)
Thu, Mar 19, 11:24 PM
Unknown Object (File)
Thu, Mar 19, 11:24 PM
Unknown Object (File)
Thu, Mar 19, 11:24 PM
Unknown Object (File)
Sun, Mar 15, 2:42 PM
Unknown Object (File)
Tue, Mar 10, 1:34 PM
Unknown Object (File)
Mar 7 2026, 6:12 PM
Subscribers

Details

Summary

This can happen with very large kernels (e.g. ones embedding a root
filesystem). The DTB written by OpenSBI/BBL is quite small so this is
unlikely to hit important data, but if it does this can result in very
confusing and hard-to-debug crashes. Add a KASSERT() and a verbose print
to catch this problem with debug kernels.

While this will not print any output by default if it fails (that would
depend on EARLY_PRINTF), at least the kernel now halts reliably instead
of randomly crashing.

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 31514
Build 29118: arc lint + arc unit

Event Timeline

arichardson created this revision.
mhorne added inline comments.
sys/riscv/riscv/machdep.c
783

This secondary indentation is unusual, but I think it's the right thing to do here.

This revision is now accepted and ready to land.Jun 5 2020, 5:40 PM
sys/riscv/riscv/machdep.c
783

This is caused by clang-format. I'm never quite sure how to correctly indent nested statements, so I just pick the clang-format output.