Skip to content

mkimage: emit digest.sev.txt (AMD SEV-SNP os_image_hash)#71

Open
kvinwang wants to merge 1 commit into
v0.6.x-develfrom
feat/digest-sev-txt
Open

mkimage: emit digest.sev.txt (AMD SEV-SNP os_image_hash)#71
kvinwang wants to merge 1 commit into
v0.6.x-develfrom
feat/digest-sev-txt

Conversation

@kvinwang

Copy link
Copy Markdown
Collaborator

What

Emit digest.sev.txt next to digest.txt when the image ships the AMD SEV firmware (ovmf-sev.fd). It is the AMD SEV-SNP os_image_hash — the image identity used for SEV attestation / on-chain allow-listing.

Why a separate digest

digest.txt (TDX) is sha256(sha256sum.txt) over the artifacts incl. ovmf.fd (the TDX firmware) — wrong firmware for SEV. For SEV, the meaningful identity is the image-invariant projection of the SNP launch measurement: ovmf-sev.fd launch digest + kernel/initrd/cmdline/rootfs hashes, excluding per-deployment params (vCPUs, etc.).

So digest.sev.txt is computed by dstack-vmm sev-os-image-hash <image-dir> and matches the os_image_hash the KMS verifier derives from a launch measurement (both go through the shared dstack_types::SevOsImageMeasurement; a unit test in dstack cross-checks the two paths).

Changes

  • mkimage.sh: when HAVE_OVMF_SEV, run dstack-vmm sev-os-image-hashdigest.sev.txt, and add it to the bare-metal tarball. Gracefully skipped (warning) if the SEV firmware is absent or the tool isn't built; path overridable via DSTACK_VMM_BIN.

Depends on

The dstack-side tooling (shared SevOsImageMeasurement + sev-os-image-hash subcommand + the os_image_hash vCPU-independence fix) in Dstack-TEE/dstack PR #728. build.sh's build_host already builds dstack-vmm to the repo root.

Verification

make dist (dev flavor) produced:

digest.txt      40a14f51...   (TDX, unchanged scheme)
digest.sev.txt  80e08e3e...   (SEV os_image_hash)

digest.sev.txt equals the standalone dstack-vmm sev-os-image-hash output and (per the dstack cross-check test) the KMS-derived os_image_hash.

When the SEV firmware is shipped, run `dstack-vmm sev-os-image-hash` over the
output image to produce digest.sev.txt: the AMD SEV-SNP os_image_hash computed
from the SEV firmware (ovmf-sev.fd) + kernel/initrd/cmdline/rootfs.

Unlike the TDX digest.txt (a content hash that includes the TDX firmware and
is vCPU-independent by construction), the SEV os_image_hash is the
image-invariant projection of the SNP launch measurement, so it matches what
the KMS verifier derives at attestation time.

Gracefully skipped (with a warning) when the SEV firmware is absent or the
dstack-vmm tool is not available; build.sh's build_host stage builds it to the
repo root. The tool path can be overridden with DSTACK_VMM_BIN.

Verified: digest.sev.txt is produced and equals the dstack-vmm output and the
KMS-derived os_image_hash (cross-checked by a unit test in dstack).
Copilot AI review requested due to automatic review settings June 17, 2026 03:09

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

This PR extends the image build tooling to emit an additional digest file for AMD SEV-SNP images (digest.sev.txt), representing the SEV-SNP os_image_hash identity used for SEV attestation / allow-listing, alongside the existing TDX-focused digest.txt.

Changes:

  • Add SEV-specific digest generation (digest.sev.txt) via dstack-vmm sev-os-image-hash when ovmf-sev.fd is present.
  • Add best-effort discovery of the dstack-vmm binary (with optional override via DSTACK_VMM_BIN) and conditionally include digest.sev.txt in the bare-metal tarball.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread mkimage.sh
Comment on lines +317 to +322
echo "Generating digest.sev.txt via ${DSTACK_VMM_BIN}"
"${DSTACK_VMM_BIN}" sev-os-image-hash "${OUTPUT_DIR}" > "${OUTPUT_DIR}/digest.sev.txt"
HAVE_DIGEST_SEV=1
else
echo "Warning: dstack-vmm not found; skipping digest.sev.txt (set DSTACK_VMM_BIN)" >&2
fi
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.

2 participants