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, Dec 14, 8:23 PM
Unknown Object (File)
Sat, Nov 29, 3:09 AM
Unknown Object (File)
Nov 20 2025, 4:43 PM
Unknown Object (File)
Nov 20 2025, 4:31 PM
Unknown Object (File)
Nov 20 2025, 4:31 PM
Unknown Object (File)
Nov 20 2025, 4:30 PM
Unknown Object (File)
Nov 20 2025, 4:28 PM
Unknown Object (File)
Nov 20 2025, 4:28 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.