Skip to content

Conversation

@hyperfinitism
Copy link
Contributor

@hyperfinitism hyperfinitism commented Aug 7, 2025

This PR adds support for SEV-SNP Report Version 5 by updating the code and bumping the sev crate.

Fixes #113

What's changed

  • Bump the sev crate to the latest version
  • Modifies the code to support new fields introduced in Report Version 5 (e.g., launch_mit_vector)
  • Update README.md to reflect these changes

⚠️ Temporary Measure (as of 7 Aug 2025)

This PR (draft) is a temporary workaround using an unreleased version of sev. Once an official release of the sev crate with Report V5 support becomes available, I will:

  • Revert the GitHub dependency in Cargo.toml to a versioned release.
  • Regenerate Cargo.lock accordingly.

Summary by Sourcery

Add support for SEV-SNP Report Version 5 by updating the sev dependency, handling the new launch_mit_vector field in key derivation, and updating documentation.

New Features:

  • Add --launch_mit_vector option to include the launch mitigation vector in derived key requests
  • Bump sev crate to GitHub dependency to enable Report Version 6 support

Build:

  • Temporarily switch sev crate in Cargo.toml to GitHub source for unreleased v6

Documentation:

  • Update README to document the new --launch_mit_vector flag

@sourcery-ai
Copy link

sourcery-ai bot commented Aug 7, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This PR integrates support for the new launch_mit_vector field introduced in SEV-SNP Report Version 6 by extending the CLI, propagating the new parameter through key derivation calls, updating dependencies to a temporary GitHub release of the sev crate, and aligning documentation accordingly.

Entity relationship diagram for KeyArgs and DerivedKey with launch_mit_vector

erDiagram
    KEYARGS {
        Option u64 tcbv
        Option u64 lmv
    }
    DERIVEDKEY {
        root_key_select
        GuestFieldSelect
        vmpl
        gsvn
        tcbv
        lmv
    }
    KEYARGS ||--o{ DERIVEDKEY : provides
Loading

Class diagram for updated KeyArgs struct and get_derived_key function

classDiagram
    class KeyArgs {
        +Option<u64> tcbv
        +Option<u64> lmv
    }
    class DerivedKey {
        +new(root_key_select, GuestFieldSelect, vmpl, gsvn, tcbv, lmv)
    }
    class Firmware {
        +open()
        +get_derived_key(option, request)
    }
    KeyArgs --> DerivedKey : used in new()
    DerivedKey --> Firmware : passed to get_derived_key()
Loading

File-Level Changes

Change Details Files
Introduce launch_mit_vector support in key derivation
  • Add an optional lmv field to KeyArgs
  • Pass args.lmv into the DerivedKey::new constructor
  • Adjust the key request call to include the new launch mitigation vector parameter
src/key.rs
Bump sev crate to temporary GitHub dependency
  • Replace the versioned sev entry with a Git URL in Cargo.toml
  • Regenerate Cargo.lock to capture the new Git dependency
Cargo.toml
Cargo.lock
Update documentation for the new CLI flag
  • Extend the key command description with the --launch_mit_vector option
  • Add -l, --launch_mit_vector entry to the CLI options table in README.md
README.md

Assessment against linked issues

Issue Objective Addressed Explanation
#113 Fix the failure of the 'snpguest report --random' command due to 'Skipped bytes were expected to be zeroed' error on SEV-SNP-enabled systems with newer kernels.
#113 Ensure that the snp_report_req structure generated by the --random flag has all reserved bytes zeroed and only user_data populated, matching kernel expectations (including for Report Version 6).
#113 Update the codebase to support SEV-SNP Report Version 6, including updating dependencies and documentation as needed.

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@hyperfinitism hyperfinitism changed the title feat: support SEV-SNP Report Version 6 (temporary GitHub dependency) feat: support SEV-SNP Report Version 5 (temporary GitHub dependency) Aug 7, 2025
- Use sev crate from GitHub (main branch) to support Report Version 5
- Update Cargo.toml with git dependency and required features
- Modify code to handle new fields (e.g., launch_mit_vector)
- Add description of --launch_mit_vector option in README.md

Signed-off-by: Takuma IMAMURA <[email protected]>
@hyperfinitism hyperfinitism deleted the support-v6-format branch August 7, 2025 07:16
@hyperfinitism
Copy link
Contributor Author

This PR is replaced by #115

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.

report command fails with "Skipped bytes were expected to be zeroed"

1 participant