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)
Dec 22 2023, 11:09 PM
Unknown Object (File)
Sep 14 2023, 8:32 PM
Unknown Object (File)
Sep 14 2023, 8:32 PM
Unknown Object (File)
Sep 14 2023, 8:32 PM
Unknown Object (File)
Sep 11 2023, 1:21 PM
Unknown Object (File)
Sep 2 2023, 12:46 AM
Unknown Object (File)
Aug 27 2023, 2:35 PM
Unknown Object (File)
Jun 24 2023, 2:05 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.