snp: support IGVM launch on MSHV - #4361
Conversation
|
This PR modifies files containing For more on why we check whole files, instead of just diffs, check out the Rustonomicon |
There was a problem hiding this comment.
🔵 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.
| 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. |
|
|
||
| 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 |
There was a problem hiding this comment.
do we actually use this gpa on mshv and it works fine? that's surprising to me if so
There was a problem hiding this comment.
Yep, did you expect something different?
There was a problem hiding this comment.
🔵 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
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
virtand 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.