Support for mounting verified merged CIMs - #2530
Merged
Merged
Conversation
Even though VMGS files aren't written to, we can't share the same file across multiple pods because HCS seems to be taking an exclusive lock on the file. To handle this, we make copies of the VMGS file (similar to how we make copies of the EFI VHD) per pod. This commit also changes the name of the default VMGS file to `cwcow.snp.vmgs` to better convey that by default we run in SNP mode. If a different VMGS file is desired, `"io.microsoft.virtualmachine.wcow.gueststatefile"` annotation can be used to override that. This commit also adds the code to handle the UVM console pipe annotation, if provided, for windows pods. Signed-off-by: Amit Barve <ambarve@microsoft.com>
This commit adds the new CimFS API that mounts the merged verified CIMs. Merge mounting verified CIM requires passing the root hash of the merged CIM. All reads happening on this mounted verified CIM will then be compared with this root hash for integrity check. This commit also adds the tests for the same. (A test that simply mounts verified CIMs was removed as that is being tested as a part of other verified CIM tests.) GCS sidecar code is also updated to use the newly added verified CIM mount APIs. Signed-off-by: Amit Barve <ambarve@microsoft.com>
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for mounting verified merged CIMs with integrity validation and improves VMGS file handling for confidential pods. The implementation includes new mounting APIs that verify CIM integrity against root hashes, ensuring secure file system operations.
- Implements
MountMergedVerifiedBlockCIMsAPI for mounting merged CIMs with root hash verification - Updates VMGS file handling to create per-pod copies instead of sharing a single file
- Consolidates UVM console pipe annotation handling to work for both WCOW and LCOW
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/cimfs/mount_cim.go | Adds new API for mounting merged verified CIMs with integrity checking |
| pkg/cimfs/cim_writer_windows.go | Fixes error reporting and adds path normalization for sealing operations |
| pkg/cimfs/cim_test.go | Removes redundant test and adds comprehensive test coverage for merged verified CIMs |
| internal/winapi/zsyscall_windows.go | Adds system call binding for CimMergeMountVerifiedImage API |
| internal/winapi/cimfs.go | Declares new Windows API function for verified merged CIM mounting |
| internal/uvm/create_wcow.go | Updates default VMGS filename to indicate SNP mode |
| internal/oci/uvm.go | Moves console pipe annotation handling to common function for both platforms |
| internal/gcs-sidecar/handlers.go | Updates to use new verified mounting APIs instead of regular mounting |
| cmd/containerd-shim-runhcs-v1/pod.go | Implements VMGS file copying and improves error messages |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
helsaawy
approved these changes
Oct 1, 2025
MahatiC
approved these changes
Oct 2, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds two commits:
Support for mounting merged verified CIMs
This commit adds the new CimFS API that mounts the merged verified CIMs. Merge mounting
verified CIM requires passing the root hash of the merged CIM. All reads happening on this
mounted verified CIM will then be compared with this root hash for integrity check.
This commit also adds the tests for the same. (A test that simply mounts verified CIMs was
removed as that is being tested as a part of other verified CIM tests.) GCS sidecar code is also updated to use the newly added verified CIM mount APIs.
Make copies of the VMGS for each confidential pod
Even though VMGS files aren't written to, we can't share the same file across multiple
pods because HCS seems to be taking an exclusive lock on the file. To handle this, we make
copies of the VMGS file (similar to how we make copies of the EFI VHD) per pod. This
commit also changes the name of the default VMGS file to
cwcow.snp.vmgsto better conveythat by default we run in SNP mode. If a different VMGS file is desired,
"io.microsoft.virtualmachine.wcow.gueststatefile"annotation can be used to overridethat. This commit also adds the code to handle the UVM console pipe annotation, if provided, for
windows pods.