Repository navigation
build: refuse rootfs verity when no initramfs rebuilds the FIT - #318
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
The guard closes the identified verification bypass, preserves non-verity behavior, and has focused regression coverage.
No open issues 🎉
What changed in this PR
Prevents FIT-based runtime builds from silently booting without rootfs verification when no project initramfs is available.
Changes:
- Rejects this configuration with an error explaining both remedies.
- Adds regression coverage for rejection with verity enabled and unchanged behavior without verity.
| File | Description |
|---|---|
src/commands/runtime/build.rs |
Adds the pre-assembly guard and regression test. |
Review effort: Balanced
The rootfs root hash reaches the kernel only in the rebuilt boot FIT, and the FIT is only rebuilt around this runtime's initramfs. On a FIT machine whose runtime produced none, the hash was dropped without a word and the device booted the feed's FIT unverified. The build now fails and says why.
dfd4267 to
eb92924
Compare
jetm
left a comment
There was a problem hiding this comment.
No blocking findings. I checked that the refusal fires only when the FIT sources exist, no initramfs image is set and a rootfs root hash is present, so a build without verity or with an initramfs that rebuilds the FIT is unaffected. The guard and the rebuild branch read the same AVOCADO_ROOTFS_ROOTHASH and AVOCADO_INITRAMFS_IMAGE variables, and the message names both fixes. I did not run the tests. No inline comments; a few minor notes were left off.
With
rootfs.image.verityon, the root hash reaches the kernel only asavocado,roothashin the rebuilt boot FIT, and the FIT is only rebuilt around this runtime's initramfs. On a machine that ships the FIT template and kernel but whose runtime built no initramfs, the FIT assembly was skipped without a message: the device booted the feed's FIT, without the hash, unverified.What
#316 adds the same guard for
kernel.cmdline_extraat the same spot; whichever merges second keeps both checks.Testing
verity_without_an_initramfs_fails_instead_of_booting_unverified(fails with the guard removed)cargo fmt --check,cargo clippy --all-targets --all-features -D warnings, fullcargo testcargo check --all-targets --target x86_64-pc-windows-gnu