Skip to content

Support for mounting verified merged CIMs - #2530

Merged
ambarve merged 2 commits into
microsoft:mainfrom
ambarve:copy_vmgs
Oct 3, 2025
Merged

Support for mounting verified merged CIMs#2530
ambarve merged 2 commits into
microsoft:mainfrom
ambarve:copy_vmgs

Conversation

@ambarve

@ambarve ambarve commented Oct 1, 2025

Copy link
Copy Markdown
Contributor

This PR adds two commits:

  1. 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.

  2. 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.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.

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>
@ambarve
ambarve requested a review from a team as a code owner October 1, 2025 19:18
@ambarve
ambarve requested a review from Copilot October 1, 2025 19:19

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 MountMergedVerifiedBlockCIMs API 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.

@ambarve
ambarve merged commit 81ce6c2 into microsoft:main Oct 3, 2025
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants