Skip to content

openhcl: reseal VMGS hardware protector after live migration - #4415

Open
Ming-Wei Shih (mingweishih) wants to merge 1 commit into
microsoft:mainfrom
mingweishih:hw-sealing-post-live-migration
Open

openhcl: reseal VMGS hardware protector after live migration#4415
Ming-Wei Shih (mingweishih) wants to merge 1 commit into
microsoft:mainfrom
mingweishih:hw-sealing-post-live-migration

Conversation

@mingweishih

Copy link
Copy Markdown
Contributor

Summary

Reseal the active VMGS datastore key after GET reports live migration completion, so a hardware protector bound to the source platform can be replaced with one bound to destination hardware.

  • Wire NOTIFY_POST_LIVE_MIGRATION to a lifecycle-managed worker using bounded, coalesced notifications; the GET callback performs no hardware or storage I/O.
  • Derive fresh hardware keys using the destination's local report SVN and the configured sealing policy, and seal the unchanged active DEK. No DEK rotation, remote key release, or GET protocol changes.
  • Verify the candidate with fresh hardware derivations before and after persistence. Serialize the active-key comparison, protector write, and final flush through the VMGS broker.
  • Retry failed event-triggered recovery with bounded exponential backoff and jitter, preserve events received during an attempt, and drain in-flight I/O before save/teardown.
  • Add typed runtime sealing helpers, regression tests, rate-limited diagnostics, and Guide documentation.

Scope and limitations

This is the event-driven change only. Recurring verification and ordinary startup checks are deferred to a separate follow-up. Saved-state reconstruction explicitly requests a durable rewrite to avoid losing an earlier failed-flush obligation; this does not add isolated-VM servicing support.

A completely missed migration notification has no periodic recovery coverage in this PR. Recovery remains best effort: a crash after migration but before durable destination resealing may leave hardware-only VMGS unrecoverable. No encryption or sealing-policy downgrade is introduced.

Validation

Validated in a clean worktree using the OpenHCL entrypoint's normal crypto/TPM feature selection:

  • cargo check --all-targets for the modified crates and openvmm_hcl
  • cargo clippy --all-targets with -D warnings
  • cargo doc --no-deps
  • cargo nextest run --profile agent: 168 tests passed, 0 skipped
  • cargo xtask fmt --fix: all passes succeeded

Coverage includes SNP/TDX protector verification, same-SVN hardware-secret changes, unchanged-DEK resealing, idle behavior without notifications, coalescing, retry backoff, events/migration during I/O, stale-key guards, flush failures, and stop/drain/reconstruction behavior.

Real-hardware live migration has not yet been tested.

Copilot AI lite review requested due to automatic review settings September 10, 2026 22:03
@github-actions github-actions Bot added the Guide label Sep 10, 2026

Copilot AI 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.

🔵 Needs a closer look

The change spans complex migration, hardware sealing, persistence, and lifecycle behavior, with review comments still outstanding.

Pull request overview

Adds event-driven VMGS hardware-protector resealing after live migration while preserving the active DEK and coordinating retries, persistence, and shutdown.

Changes:

  • Adds migration notification handling and a lifecycle-managed resealing worker.
  • Adds guarded VMGS broker operations and runtime sealing verification.
  • Adds regression tests, diagnostics, dependency updates, and documentation.
File summaries
File Summary
vm/vmgs/vmgs/src/vmgs_impl.rs Exposes active-key retrieval and flushing.
vm/vmgs/vmgs/Cargo.toml Updates VMGS package dependencies.
vm/vmgs/vmgs_broker/src/client.rs Adds guarded key and write APIs.
vm/vmgs/vmgs_broker/src/broker/tests.rs Tests broker guards and flush behavior. Nit (2 votes): remove the unused test_with_tracing::test import.
vm/vmgs/vmgs_broker/src/broker.rs Implements serialized guarded writes.
vm/vmgs/vmgs_broker/Cargo.toml Updates broker dependencies. Nit (1 vote): remove the unused test_with_tracing dev-dependency.
openhcl/underhill_core/src/worker.rs Wires migration notifications and starts the reseal worker.
openhcl/underhill_core/src/lib.rs Registers the hardware-reseal module.
openhcl/underhill_core/src/hardware_reseal/tests.rs Tests notification, retry, I/O, and shutdown behavior.
openhcl/underhill_core/src/hardware_reseal.rs Implements resealing, retries, persistence, and lifecycle handling.
openhcl/underhill_core/src/dispatch/mod.rs Drains resealing during teardown.
openhcl/underhill_attestation/src/vmgs.rs Shares VMGS protector parsing.
openhcl/underhill_attestation/src/runtime_sealing/tests.rs Tests runtime sealing policies and failures.
openhcl/underhill_attestation/src/runtime_sealing.rs Creates and verifies runtime protectors.
openhcl/underhill_attestation/src/lib.rs Exports runtime sealing helpers.
openhcl/underhill_attestation/src/hardware_key_sealing.rs Adds typed sealing errors and rate-limited diagnostics.
openhcl/underhill_attestation/Cargo.toml Adds runtime sealing dependencies.
Guide/src/reference/architecture/openhcl/processes.md Documents VMGS hardware resealing.
Cargo.lock Updates dependency resolution.
Review details

Suppressed comments (1)

vm/vmgs/vmgs_broker/Cargo.toml:35

  • This dev-dependency has no consumer: the only test_with_tracing reference in this crate is the unused import in broker/tests.rs, while every test uses #[async_test]. Remove this dependency along with that import so the workspace formatter does not delete it or leave unused test plumbing behind.
test_with_tracing.workspace = true
  • Files reviewed: 18/19 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread vm/vmgs/vmgs_broker/src/broker/tests.rs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants