dstack-mr: diagnose subcommand for operator-facing MR verification#679
Draft
Leechael wants to merge 1 commit into
Draft
dstack-mr: diagnose subcommand for operator-facing MR verification#679Leechael wants to merge 1 commit into
Leechael wants to merge 1 commit into
Conversation
Takes a VmConfig JSON (the same payload VMM serializes into KMS metadata)
plus an image directory, computes the expected MRTD/RTMR0-2 via
Machine::measure_with_logs(), and prints each RTMR0 event log entry with a
semantic label and what it varies with. Labels switch between the legacy
13-event layout (Pre202505) and the edk2-stable202505 17-event layout based
on the resolved OvmfVariant.
OvmfVariant resolution follows the verifier order: explicit
vm_config.ovmf_variant > image_info.ovmf_variant > parse image_info.version
> ovmf_variant_for_image(vm_config.image) fallback.
Optionally accepts --actual-{mrtd,rtmr0,rtmr1,rtmr2} hex strings to compare
against and report MATCH/MISMATCH per measurement.
Intended as an operator-facing acceptance tool: validate a given VmConfig +
image combination produces the expected MRs without rebuilding or
redeploying KMS. When a quote-side mismatch shows up, this lets you locate
which RTMR0 event entry drifted (e.g. acpi_* group vs new
fwcfg:* / variable_authority / Boot* introduced by edk2-stable202505).
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.
Summary
Adds a
dstack-mr diagnosesubcommand that takes aVmConfigJSON (the samepayload VMM serializes into KMS metadata) plus an image directory, computes
the expected MRTD / RTMR0-2 via
Machine::measure_with_logs(), and printseach RTMR0 event log entry with a semantic label and what it varies with.
Optionally compares against
--actual-{mrtd,rtmr0,rtmr1,rtmr2}hex from aquote and reports MATCH / MISMATCH per measurement.
Stacked on top of #678 (
fix/dstack-mr-ovmf-202505-events) because thelabels follow the two OVMF event-log layouts introduced there.
Why
While debugging the 0.5.9 → 0.5.10 RTMR0 mismatch, the iteration cost of
"rebuild KMS image → redeploy → trigger onboard → read mismatch" was the
main bottleneck. A small offline tool that consumes the same VmConfig
schema as the verifier and prints each RTMR0 event entry with a label lets
operators:
(VmConfig, image)pair produces the expected MRswithout rebuilding any service image.
new edk2-stable202505 events (
fwcfg:BootMenu,fwcfg:bootorder,variable_authority,Boot0001) vs the legacyacpi_*andBoot0000.Approach
Diagnose(DiagnoseConfig)subcommand alongside existingMeasure.OvmfVariantresolution mirrors the verifier order:vm_config.ovmf_variant>image_info.ovmf_variant>ovmf_variant_for_version(image_info.version)>ovmf_variant_for_image(vm_config.image).Pre202505, 17 forStable202505), each row tagged with whether the hash is fixed or whichinputs it varies with.
Usage
When
--actual-*is provided, exit code is non-zero on any mismatch.Test plan
cargo fmt -p dstack-mr-clicargo clippy -p dstack-mr-cli --all-features -- -D warningscleancargo check -p dstack-mr-clicleandstack-mr diagnoseagainst a realVmConfigand 0.5.10 image produces expected MRTD / RTMR0-2 plus the 17-entry
labeled event log
--actual-rtmr0 <self>reportsMATCH; intentionally wrong actualreports
MISMATCHwith both hex values printed and exits non-zeroBackward compatibility
VmConfig,ImageInfo, orMachine. Uses existingschema introduced by dstack-mr: support edk2-stable202505 OVMF event layout #678.
Measureflow untouched.Draft pending #678 merge.