Skip to content

snp: support IGVM launch on MSHV - #4361

Open
Will Wright (will-j-wright) wants to merge 2 commits into
microsoft:mainfrom
will-j-wright:snp-mshv-igvm-pr
Open

snp: support IGVM launch on MSHV#4361
Will Wright (will-j-wright) wants to merge 2 commits into
microsoft:mainfrom
will-j-wright:snp-mshv-igvm-pr

Conversation

@will-j-wright

Copy link
Copy Markdown
Contributor

Summary

Add SEV-SNP IGVM launch support to the MSHV backend. OpenVMM can now launch a measured Linux direct guest from IGVM-provided launch state instead of rebuilding the BSP VMSA in the VMM.

MSHV consumes the IGVM SNP policy, BSP VMSA, and optional ID block and authentication data. It validates the IGVM platform and VMSA configuration, preserves measured page-import order, keeps stable userspace backing for the VMSA, submits the policy and optional identity during launch completion, and activates the imported VMSA through the SEV control register.

Implementation

Prepare the IGVM SNP configuration before partition build. Validate the requested VTL, shared GPA boundary, relocation metadata, VMSA GPA and feature set, and IGVM VP contexts against the configured topology.

Add shared SNP ID-block serialization helpers to virt and use them to build the MSHV PSP launch-finish payload. When identity data is present, OpenVMM supplies the launch digest, image identity, guest SVN, signatures, public keys, and key algorithms, and enables the ID-block and author-key flags.

Extend the Linux direct IGVM generator and manifest configuration with a restricted-injection image variant. The generated VMSA records the selected injection mode, which MSHV preserves when it imports the VMSA. Standard interrupt injection remains supported.

Update the OpenVMM CLI and manifest documentation for MSHV SNP IGVM boot.

Current limitations

MSHV SNP IGVM boot currently supports VTL0, with no relocation metadata and no shared GPA boundary.

@will-j-wright
Will Wright (will-j-wright) requested a review from a team as a code owner September 1, 2026 23:22
Copilot AI lite review requested due to automatic review settings September 1, 2026 23:22
@github-actions github-actions Bot added Guide unsafe Related to unsafe code labels Sep 1, 2026
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown

⚠️ Unsafe Code Detected

This PR modifies files containing unsafe Rust code. Extra scrutiny is required during review.

For more on why we check whole files, instead of just diffs, check out the Rustonomicon

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

It changes security-sensitive SNP launch/memory-mapping behavior for MSHV and should get final human validation beyond automated review.

Pull request overview

Adds SEV-SNP IGVM launch support to the Linux MSHV backend so OpenVMM can boot a measured Linux direct guest from IGVM-provided SNP launch state (policy, VMSA, optional ID block/auth), rather than reconstructing the BSP VMSA in the VMM.

Changes:

  • Introduces shared SNP ID-block + ID-auth serialization helpers in virt, with unit tests validating PSP offsets and reserved-byte zeroing.
  • Extends MSHV SNP bring-up to pre-validate and retain IGVM SNP config (topology, VMSA GPA/features), preserve IGVM import order when required, add a stable userspace VMSA mapping, and submit policy/identity during launch completion.
  • Extends IGVM generation + manifests/docs to support restricted interrupt injection as an explicit variant, and documents MSHV SNP IGVM boot usage in the Guide.
File summaries
File Description
vmm_core/virt/src/x86/snp.rs Adds reusable SNP launch helpers for PSP ID block/auth serialization plus tests.
vmm_core/virt_mshv/src/x86_64/snp.rs Implements IGVM-aware SNP config prep/validation, stable VMSA mapping, ordered imports, and launch-finish payload population.
vmm_core/virt_mshv/src/x86_64/mod.rs Plumbs IGVM SNP config into MSHV proto-partition creation/build flow.
vmm_core/virt_mshv/src/lib.rs Stores per-proto-partition isolation state and adds new SNP IGVM validation error variants.
vm/loader/manifests/snp-linux-direct-restricted.json Adds a restricted-injection manifest profile for MSHV bring-up.
vm/loader/manifests/README.md Documents IGVM output behavior and introduces the restricted-injection profile notes.
vm/loader/igvmfilegen/src/snp_linux_direct.rs Threads injection mode into the SNP Linux-direct IGVM generator and tests VMSA injection feature bits.
vm/loader/igvmfilegen/src/main.rs Allows non-normal injection mode for snp_linux_direct generation (no longer hard-rejects restricted).
vm/loader/igvmfilegen_config/src/lib.rs Adds a parsing/validation test for the new restricted-injection manifest.
Guide/src/reference/openvmm/management/cli.md Updates CLI documentation with MSHV SNP IGVM boot constraints and example invocation.
Review details
  • Files reviewed: 10/10 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/loader/manifests/README.md Outdated
Comment on lines +21 to +25
The normal-injection output is a shared artifact: the same binary is intended
to boot on KVM and MSHV. Its `SnpVpContext` uses the SNP initial-VMSA GPA
`0xffff_ffff_f000`. KVM synthesizes its measured VMSA at that GPA, while MSHV
maps and imports the file-provided VMSA there. Both backends submit the policy
and SNP ID block encoded in the file.
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown


The normal-injection output is a shared artifact: the same binary is intended
to boot on KVM and MSHV. Its `SnpVpContext` uses the SNP initial-VMSA GPA
`0xffff_ffff_f000`. KVM synthesizes its measured VMSA at that GPA, while MSHV

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

do we actually use this gpa on mshv and it works fine? that's surprising to me if so

@will-j-wright Will Wright (will-j-wright) Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yep, did you expect something different?

Comment thread vmm_core/virt/src/x86/snp.rs Outdated
Comment thread vmm_core/virt_mshv/src/x86_64/mod.rs Outdated
Comment thread vmm_core/virt_mshv/src/x86_64/mod.rs
Comment thread vmm_core/virt_mshv/src/x86_64/snp.rs
Comment thread vmm_core/virt_mshv/src/x86_64/snp.rs Outdated
Comment thread vmm_core/virt_mshv/src/x86_64/snp.rs Outdated
Comment thread vmm_core/virt_mshv/src/x86_64/snp.rs
Comment thread vmm_core/virt_mshv/src/x86_64/snp.rs
Comment thread vmm_core/virt_mshv/src/x86_64/snp.rs

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

It changes security-sensitive SNP launch/measurement behavior and MSHV memory mapping/launch-finish plumbing, which warrants expert validation and end-to-end testing on real MSHV SNP environments.

Review details
  • Files reviewed: 11/11 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Guide unsafe Related to unsafe code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants