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
F154204886: D25153.diff
Mon, Apr 27, 2:30 AM
F154137575: D25153.diff
Sun, Apr 26, 11:58 AM
Unknown Object (File)
Sat, Apr 25, 3:09 PM
Unknown Object (File)
Sun, Apr 12, 6:55 PM
Unknown Object (File)
Sun, Apr 12, 10:06 AM
Unknown Object (File)
Sun, Apr 5, 7:46 AM
Unknown Object (File)
Sat, Apr 4, 6:26 AM
Unknown Object (File)
Mar 19 2026, 11:24 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

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.