Skip to content

microVM: identify snapshot blocks only by storage generation; stop hashing block artifacts #557

Closed

Description

Summary

The architecture guide (#529) now identifies every bound sandbox block, the read-only layers and paired scratch.img, only by a caller-supplied storage generation, and states that the VMM never reads an artifact or block to verify its contents. OpenVMM still defaults to whole-file SHA-256 block identity. Remove it, so neither capture nor restore hashes block artifacts.

Why

  • Every hash is a full read, on the capture and restore paths. With the default sha256 identity:
    • Capture hashes every bound block (capture_snapshot_block_contract), and publication hashes the published scratch.img again.
    • Restore hashes scratch.img when it opens the file, again before it materializes it, and then the resulting private copy, clone, or link. It then rebuilds the block contract (restore_snapshot_block_contract) by hashing every attached block: the supplied read-only layers, and the materialized scratch a fourth time. The default private-copy policy also copies the scratch.
    • A platform capture hashes every read-only layer and then discards the digests, because platform layers are recorded as unbound.
  • The digest is not the integrity boundary. The manifest carries no checksums for state.bin or memory.bin, artifact integrity already relies on host access control, and the proposed trusted-storage design, which doc: replace doc/design with an architecture-only design guide #529 removed, relied on an authenticated storage generation, leaving SHA-256 to export or deep verification outside the VMM.

Where SHA-256 identity lives

OpenVMM (openvmm/ submodule; paths relative to it):

  • openvmm/openvmm_entry/src/cli_args/microvm.rs: SnapshotBlockIdentityCli (default Sha256), --snapshot-block-identity, and the rule that --snapshot-generation-id comes only with generation.
  • openvmm/openvmm_entry/src/storage_builder/microvm.rs: capture_snapshot_block_contract and restore_snapshot_block_contract call file_sha256.
  • openvmm/openvmm_entry/src/vm_controller/microvm.rs: platform captures hash the layers and then clear their identities.
  • openvmm/openvmm_helpers/src/snapshot/publish.rs: hashes the published scratch.img.
  • openvmm/openvmm_helpers/src/snapshot/restore.rs: verify_sandbox_block_identity, the three paired-scratch materializers, and the unused copy_verified_file.
  • openvmm/openvmm_entry/src/microvm/restore.rs and openvmm/openvmm_entry/src/microvm/launch.rs: the restore path that verifies, materializes, and then re-hashes paired scratch.
  • openvmm/openvmm_helpers/src/snapshot/microvm.rs: SNAPSHOT_BLOCK_IDENTITY_SHA256 in manifest validation.
  • Guide/src/dev_guide/snapshot_format.md, Guide/src/user_guide/openvmm/snapshots.md, and Guide/src/reference/openvmm/management/cli.md.

NVX:

  • scripts/nvx_tools/microvm_tests.py: scratch-snapshot captures with the default sha256 and expects restore to reject a same-length wrong layer and a scratch.img with one flipped byte; snapshot-tiers passes --snapshot-block-identity generation and relies on the default for its platform tier.
  • scripts/test_microvm_tests.py: the expected tier capture arguments.

Decisions

  • Existing snapshots. Manifest version 6 accepts sha256 identities. Decide whether restore rejects them and asks for a recapture, or keeps verifying them for a transition period.
  • Generation source. Captures that bind blocks (workload-start and instance-checkpoint) would always need --snapshot-generation-id. Decide who supplies it where no storage control plane exists, such as nvx.py and the test harness.
  • Restore-time check. Restore currently trusts the generation in the manifest and takes none from the caller. Decide whether the caller should state the generation it supplies, so restore can reject a snapshot paired with the wrong storage.
  • Same-length changes. Without a digest, restore no longer detects a same-length change to a bound layer or to scratch.img; the storage owner's generation is the only binding. Confirm that this is acceptable, or decide where deep verification lives.

Tasks

  • OpenVMM: remove the sha256 block identity and --snapshot-block-identity, require a storage generation for captures that bind blocks, stop hashing blocks at capture, publication, and restore, remove copy_verified_file, and update the tests and the Guide.
  • NVX: promote the OpenVMM pin.
  • Tests: move scratch-snapshot to generation identity and replace its same-length corruption checks with structural ones, and drop the identity flag from snapshot-tiers.
  • Docs: doc: replace doc/design with an architecture-only design guide #529 removed the old doc/design/ chapters, and the architecture guide that replaced them already describes generation-only identity. No other NVX document describes block identity.

Metadata

Metadata

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions