Skip to content

build: refuse rootfs verity when no initramfs rebuilds the FIT - #318

Merged
jetm merged 1 commit into
mainfrom
jschneck/fit-roothash-needs-initramfs
Oct 21, 2026
Merged

jetm merged 1 commit into
mainfrom
jschneck/fit-roothash-needs-initramfs

Conversation

@mobileoverlord

Copy link
Copy Markdown
Contributor

With rootfs.image.verity on, the root hash reaches the kernel only as avocado,roothash in 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

  • Before the FIT gate, a FIT machine with a rootfs root hash and no project initramfs fails the build with an error naming both fixes (install the initramfs packages, or turn rootfs verity off).
  • Without verity, a runtime with no initramfs still leaves the feed's FIT alone.

#316 adds the same guard for kernel.cmdline_extra at the same spot; whichever merges second keeps both checks.

Testing

What Result
verity_without_an_initramfs_fails_instead_of_booting_unverified (fails with the guard removed) pass
cargo fmt --check, cargo clippy --all-targets --all-features -D warnings, full cargo test pass
cargo check --all-targets --target x86_64-pc-windows-gnu pass

@mobileoverlord
mobileoverlord requested review from jetm and a balanced review from Copilot October 19, 2026 21:14

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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

jetm
jetm previously approved these changes Oct 19, 2026
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.

@jetm jetm left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@jetm
jetm merged commit a112314 into main Oct 21, 2026
11 checks passed
@jetm
jetm deleted the jschneck/fit-roothash-needs-initramfs branch October 21, 2026 22:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants