Skip to content

Igvmfilegen: Support CoRIM generation and patch command - #3088

Merged
Ming-Wei Shih (mingweishih) merged 1 commit into
microsoft:mainfrom
mingweishih:igvmfilegen_corim_write
Jul 21, 2026
Merged

Igvmfilegen: Support CoRIM generation and patch command#3088
Ming-Wei Shih (mingweishih) merged 1 commit into
microsoft:mainfrom
mingweishih:igvmfilegen_corim_write

Conversation

@mingweishih

@mingweishih Ming-Wei Shih (mingweishih) commented Mar 20, 2026

Copy link
Copy Markdown
Contributor

This PR adds the support of writing CoRIM to an existing IGVM file, allowing for injecting the CoRIM files post build in the pipeline.

By IGVM design, a signed CoRIM is expected to be broken into payload and signed envelope with payload detached and written into CORIM_DOCUMENT and CORIM_SIGNATURE entries correspondingly. The idea is decoupling the payload generation and the signing process. However, given that the CoRIM detached signing might not always be supported by the signing infrastructure, the tool additionally supports taking a signed CoRIM as input and handles the decoupling before writing to the IGVM file.

Copilot AI review requested due to automatic review settings March 20, 2026 22:28

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.

Pull request overview

Adds CoRIM (Concise Reference Integrity Manifest) patching/extraction capabilities to igvmfilegen, enabling post-build injection of CoRIM document/signature data into an existing IGVM file (including support for splitting bundled COSE_Sign1 inputs).

Changes:

  • Add new DumpCorim and PatchCorim CLI subcommands to inspect and patch CoRIM headers in IGVM files.
  • Introduce a new corim module implementing IGVM directive patching plus minimal COSE_Sign1 split/validation utilities (with unit tests).
  • Switch igvm/igvm_defs workspace deps to a git fork/branch that includes the required CoRIM header support.

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
vm/loader/igvmfilegen/src/main.rs Adds new CLI commands and implements CoRIM header dumping/patching entrypoints.
vm/loader/igvmfilegen/src/corim/mod.rs Adds IGVM-level CoRIM patching logic and compatibility-mask helpers.
vm/loader/igvmfilegen/src/corim/cose.rs Adds COSE_Sign1 parsing/splitting/validation helpers plus unit tests.
vm/loader/igvmfilegen/Cargo.toml Adds open_enum dependency for the new COSE/CBOR helpers.
Cargo.toml Switches igvm and igvm_defs from crates.io to a git fork/branch.
Cargo.lock Updates lock entries for the new git-based igvm crates and incidental dependency resolution changes.

Comment thread vm/loader/igvmfilegen/src/corim/mod.rs Outdated
Comment thread vm/loader/igvmfilegen/src/corim/cose.rs Outdated
Comment thread vm/loader/igvmfilegen/src/main.rs Outdated
Comment thread vm/loader/igvmfilegen/src/main.rs Outdated
Comment thread vm/loader/igvmfilegen/src/main.rs Outdated
Comment thread vm/loader/igvmfilegen/src/main.rs Outdated
Comment thread Cargo.toml Outdated
Comment thread vm/loader/igvmfilegen/src/corim/mod.rs Outdated
Copilot AI review requested due to automatic review settings March 20, 2026 22:45

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.

Pull request overview

Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.

Comment thread vm/loader/igvmfilegen/src/corim/mod.rs Outdated
Comment thread vm/loader/igvmfilegen/src/main.rs Outdated
Copilot AI review requested due to automatic review settings March 24, 2026 18:00

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.

Pull request overview

Copilot reviewed 5 out of 6 changed files in this pull request and generated 4 comments.

Comment thread vm/loader/igvmfilegen/src/main.rs Outdated
Comment thread vm/loader/igvmfilegen/src/main.rs Outdated
Comment thread vm/loader/igvmfilegen/src/corim/mod.rs Outdated
Comment thread vm/loader/igvmfilegen/src/corim/mod.rs Outdated
Copilot AI review requested due to automatic review settings March 24, 2026 18:15

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.

Pull request overview

Copilot reviewed 5 out of 6 changed files in this pull request and generated 7 comments.

Comment thread vm/loader/igvmfilegen/src/main.rs Outdated
Comment thread vm/loader/igvmfilegen/src/main.rs Outdated
Comment thread vm/loader/igvmfilegen/src/main.rs Outdated
Comment thread vm/loader/igvmfilegen/src/corim_signature/mod.rs
Comment thread vm/loader/igvmfilegen/src/corim/cose.rs Outdated
Comment thread vm/loader/igvmfilegen/src/main.rs Outdated
Comment thread vm/loader/igvmfilegen/src/corim/cose.rs Outdated
Copilot AI review requested due to automatic review settings March 26, 2026 20:59

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.

Pull request overview

Copilot reviewed 5 out of 6 changed files in this pull request and generated 6 comments.

Comment thread vm/loader/igvmfilegen/src/main.rs Outdated
Comment thread vm/loader/igvmfilegen/src/main.rs Outdated
Comment thread vm/loader/igvmfilegen/src/main.rs Outdated
Comment thread vm/loader/igvmfilegen/src/corim_signature/mod.rs Outdated
Comment thread vm/loader/igvmfilegen/src/corim/mod.rs Outdated
Comment thread vm/loader/igvmfilegen/src/corim/cose.rs Outdated
Copilot AI review requested due to automatic review settings March 26, 2026 21:08

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.

Pull request overview

Copilot reviewed 5 out of 6 changed files in this pull request and generated 3 comments.

Comment thread vm/loader/igvmfilegen/src/corim_signature/mod.rs
Comment thread vm/loader/igvmfilegen/src/main.rs
Comment thread vm/loader/igvmfilegen/src/corim/cose.rs Outdated
@benhillis Ben Hillis (benhillis) added the enhancement New feature or request label Apr 6, 2026
Copilot AI review requested due to automatic review settings May 29, 2026 18:46

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.

Pull request overview

Copilot reviewed 17 out of 18 changed files in this pull request and generated 4 comments.

Comment thread vm/loader/igvmfilegen/src/measurement_diag.rs
Comment thread vm/loader/igvmfilegen/src/main.rs Outdated
Comment thread vm/loader/igvmfilegen/src/main.rs Outdated
Comment thread Cargo.toml Outdated

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.

Pull request overview

Copilot reviewed 17 out of 18 changed files in this pull request and generated 8 comments.

Comment thread vm/loader/igvmfilegen/src/measurement_diag.rs
Comment thread vm/loader/igvmfilegen/src/main.rs Outdated
Comment thread vm/loader/igvmfilegen/src/main.rs Outdated
Comment thread vm/loader/igvmfilegen/src/main.rs Outdated
Comment thread vm/loader/igvmfilegen/src/main.rs Outdated
Comment thread vm/loader/igvmfilegen/src/corim_signature/mod.rs Outdated
Comment thread Cargo.toml Outdated
Comment on lines +611 to +612
igvm = { git = "https://github.com/mingweishih/igvm", rev = "c389b9f", features = ["corim"] }
igvm_defs = { git = "https://github.com/mingweishih/igvm", rev = "c389b9f", default-features = false }
Comment thread vm/loader/igvmfilegen/src/measurement_diag.rs Outdated
Copilot AI review requested due to automatic review settings May 30, 2026 05:12

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.

Pull request overview

Copilot reviewed 17 out of 18 changed files in this pull request and generated 3 comments.

Comment thread vm/loader/igvmfilegen/src/measurement_diag.rs
Comment thread vm/loader/igvmfilegen/src/main.rs
Comment thread Cargo.toml Outdated
@mingweishih

Copy link
Copy Markdown
Contributor Author

Review responses

High-Impact issues:

  1. igvm git pin - Leave as-is
    The pinning is required because the PR consumes the upstream CoRIM support that has not been released yet. Will switch back to crate.io version once new release ships.
  2. SNP SevVmsa size loosening - Leave as-is
    The zero padding is introduced by upstream igvm (igvm: Update SevVmsa structure definition. Pad to full 4K. igvm#109). There is no impact on the measurement because SNP's calculation always operates on 4k pages.
  3. libssl-dev in build_igvmfilegen.rs - Leave as-is
    Kept for consistency with the existing build_vmgstool.rs pattern. Will revisit as a cleanup follow-up.

Behavior nuances worth surfacing

  1. bundle/IGVM-doc mismatch produces an opaque crypto error - Fixed
    Add explicit comparison between the CoRIM document from the bundle against the built-in one and provider clearer error message.
  2. re-anchoring CorimDocument at the tail - Comment updated
    igvm only enforces that CorimDocument appears before CorimSignature for the same mask. There are no constraints on ordering relative to other init headers.
  3. VBS vs CoRIM algorithm difference. - Won't Fix
    The comment is incorrect - VBS and CoRIM signing targets different payload.
  4. test vs prod crypto backend - Won't Fix
    Following the existing patterns.

Minor

  1. unreachable! in build_endorsement_json. - Leave as-is
    The suggestion requires significant refactoring. Not worth.
  2. Platform CLI enum duplication. - Leave as-is
    The duplication is intentional to isolate clap-derive concerns from the upstream IgvmPlatformType type.
  3. pinning corim = "=0.1.3" - Leave as-is
    Following the project pattern. The dependency is tracked by Cargo.lock that effectively does the pinning.
  4. SNP_FAMILY_ID/SNP_IMAGE_ID byte-identity - Fixed
    Add a test case to prevent any change to the identity values.

Test Coverage

  • CRC32 round-trip assertion. - Added test cases

Petri failures

failures are unrelated to this PR.

@github-actions

Copy link
Copy Markdown

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.

Pull request overview

Copilot reviewed 23 out of 24 changed files in this pull request and generated 2 comments.

Comment thread vm/loader/igvmfilegen/src/measurement_diag.rs
Comment thread vm/loader/igvmfilegen/src/main.rs Outdated
@github-actions

Copy link
Copy Markdown

Copilot AI review requested due to automatic review settings June 22, 2026 22:03

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.

Pull request overview

Copilot reviewed 23 out of 24 changed files in this pull request and generated 1 comment.

Comment thread vm/loader/igvmfilegen/src/measurement_diag.rs
@github-actions

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown

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.

Pull request overview

Copilot reviewed 10 out of 11 changed files in this pull request and generated 1 comment.

Comment thread vm/loader/igvmfilegen/src/main.rs Outdated

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.

Pull request overview

Copilot reviewed 10 out of 11 changed files in this pull request and generated 1 comment.

Comment thread vm/loader/igvmfilegen/src/platform_mask.rs Outdated

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.

Pull request overview

Copilot reviewed 10 out of 11 changed files in this pull request and generated no new comments.

@github-actions

Copy link
Copy Markdown

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.

Pull request overview

Copilot reviewed 11 out of 12 changed files in this pull request and generated 1 comment.

Comment thread vm/loader/igvmfilegen/src/main.rs Outdated

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.

Pull request overview

Copilot reviewed 11 out of 12 changed files in this pull request and generated 1 comment.

Comment thread vm/loader/igvmfilegen/src/platform_mask.rs Outdated

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.

Pull request overview

Copilot reviewed 11 out of 12 changed files in this pull request and generated no new comments.

Signed-off-by: Ming-Wei Shih <mishih@microsoft.com>

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.

Pull request overview

Copilot reviewed 11 out of 12 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

vm/loader/igvmfilegen/src/platform_mask.rs:102

  • Doc comment says this returns a "lowercase" platform name, but the fallback path can return platform_{platform:?} via isolation_label, which is not necessarily lowercase (e.g., platform_Native, platform_SEV_SNP). Either normalize the fallback to lowercase or adjust the docs so callers don't rely on lowercase output.
/// Map a compatibility mask to a lowercase platform name suitable for use in
/// file names. Returns the platform's canonical short name (`"vbs"`, `"snp"`,
/// `"tdx"`) when the mask matches a known platform header; otherwise
/// `platform_<Debug>` for a matching header whose platform type has no
/// canonical short name, or `mask_0x<hex>` if the mask matches no platform
/// header at all.

@github-actions

Copy link
Copy Markdown

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants