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)
Thu, Nov 28, 6:20 PM
Unknown Object (File)
Sat, Nov 16, 9:34 PM
Unknown Object (File)
Oct 2 2024, 5:04 AM
Unknown Object (File)
Oct 1 2024, 1:36 PM
Unknown Object (File)
Sep 20 2024, 11:34 AM
Unknown Object (File)
Sep 17 2024, 9:24 PM
Unknown Object (File)
Sep 8 2024, 12:32 PM
Unknown Object (File)
Sep 8 2024, 5:16 AM
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

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

Event Timeline

arichardson created this revision.
mhorne added inline comments.
sys/riscv/riscv/machdep.c
783 ↗(On Diff #72725)

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

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.