fix(tee): bare-metal SEV-SNP via configfs-TSM; accept report version >=2#412
Merged
Conversation
Hardware validation on a real non-paravisor SEV-SNP guest (GCP N2D, AMD Milan) surfaced two bugs in the bare-metal path: 1. SEVSNPProvider used a /dev/sev-guest ioctl whose number (0xC0A01181) and inline request ABI were wrong; it failed with ENOTTY on real hardware. Rewritten to use the kernel configfs-TSM interface (/sys/kernel/config/tsm/ report), the same interface agent-manifest uses. Validated: the guest nonce lands in REPORT_DATA and the report verifies against the AMD VCEK. 2. cmcp_verify.sev_snp rejected any report version outside (2, 3); real Milan hardware emits version 5. Accept version >=2 (field offsets are stable across v2..v5; the VCEK signature is the real gate). Tests updated to the configfs-TSM model (mock _tsm_get_report; version-5 accepted, version-1 rejected). ruff + mypy (cmcp_runtime) clean; 103 tests pass. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The configfs-TSM report directory exists whenever tsm.ko is loaded (including on ordinary CI runners) with no provider registered, so detecting on the directory wrongly auto-selected SEVSNPProvider and aborted gateway startup with a configfs PermissionError. Gate on /dev/sev-guest (created by the sev-guest driver on a real SNP guest); acquisition still uses configfs-TSM. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Two bugs in the bare-metal (non-paravisor) SEV-SNP path, both caught on real hardware — a GCP N2D SEV-SNP VM (AMD Milan, genuine non-paravisor SNP:
dmesgshowsAMD SEV SEV-ES SEV-SNP, guest controlsREPORT_DATA).Bug 1 — collector used a broken
/dev/sev-guestioctlSEVSNPProvider.get_attestation_reportissued ioctl0xC0A01181with an inline request struct. The real kernel ABI isSNP_GET_REPORT = _IOWR('S', 0x0, struct snp_guest_request_ioctl)with pointers to separate request/response structs, so the call failed on real hardware withOSError [Errno 25] Inappropriate ioctl for device(ENOTTY).Fix: obtain the report via the kernel configfs-TSM interface (
/sys/kernel/config/tsm/report, Linux 6.7+) — the same interfaceagent-manifestuses. Validated live: the guest-supplied nonce lands inREPORT_DATAand the report verifies against the AMD VCEK (verified=True, fieldsmeasurement, report_data, vcek_cert_chain, report_signature).Bug 2 — verifier rejected report version 5
cmcp_verify.sev_snpaccepted only report versions(2, 3); real Milan hardware emits version 5, so genuine reports were rejected asinvalid_snp_report_version. The fields read (report_data0x50,measurement0x90,reported_tcb0x180,chip_id0x1a0,signature0x2a0) are layout-stable v2..v5, and the VCEK signature is the real gate. Fix: accept version>= 2.Tests
Updated to the configfs-TSM model (mock
_tsm_get_reportinstead of fcntl; version-5 accepted, version-1 rejected).ruff+mypy src/cmcp_runtime/clean; 103 attestation/verify tests pass.Note: independent of the distinct-
azure-cvm-sev-snp-platform change (#411) — different files.🤖 Generated with Claude Code