Skip to content

feat(rootfs): compile-time guest hash and versioned rootfs pipeline#269

Merged
DorianZheng merged 3 commits intomainfrom
feat/compile-time-guest-hash
Feb 15, 2026
Merged

feat(rootfs): compile-time guest hash and versioned rootfs pipeline#269
DorianZheng merged 3 commits intomainfrom
feat/compile-time-guest-hash

Conversation

@DorianZheng
Copy link
Copy Markdown
Member

Summary

  • Introduces a two-stage guest rootfs pipeline: ImageDiskManager (image→ext4, cached by digest) + GuestRootfsManager (ext4+guest→versioned rootfs, cached by digest+guest hash)
  • Embeds SHA256 hash of boxlite-guest binary at compile time via build.rs, eliminating ~14s of runtime hash computation on startup
  • Verifies actual guest binary hash at rootfs creation time — refuses to proceed if compile-time hash is stale (inconsistent build)
  • GC preserves current-version cache entries, removes only stale+unreferenced ones

Test plan

  • cargo test -p boxlite -- guest_rootfs — 15 tests pass
  • make dev:python — builds with embedded guest hash
  • End-to-end: CACHE HIT path shows 0ms hash overhead
  • End-to-end: CACHE MISS path verifies actual guest hash matches compile-time hash

Introduce a two-stage guest rootfs pipeline with compile-time hash
optimization and integrity verification:

- ImageDiskManager: cached image-to-ext4 conversion (stage 1)
- GuestRootfsManager: versioned rootfs with injected guest binary (stage 2)
- Compile-time SHA256 hash of boxlite-guest embedded via build.rs
- Runtime verification: refuse to proceed if actual hash mismatches
- OnceLock cache eliminates redundant hash computations
- GC preserves current-version entries, removes stale ones safely

Reduces guest rootfs startup overhead from ~14s to 0ms (cache hit path).
Remove unnecessary `&` on `[0u8; 10]` array literal passed to
`std::fs::write`, fixing `needless_borrows_for_generic_args` warning.
@DorianZheng DorianZheng merged commit 833554a into main Feb 15, 2026
14 checks passed
@DorianZheng DorianZheng deleted the feat/compile-time-guest-hash branch February 15, 2026 00:47
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.

1 participant