Skip to content

fix(sev-snp-qvl): borrow kernel certificate table entries instead of copying them - #1248

Merged
kvinwang merged 2 commits into
nextfrom
fix/parser-input-bounds
Sep 24, 2026
Merged

kvinwang merged 2 commits into
nextfrom
fix/parser-input-bounds

Conversation

@kvinwang

@kvinwang kvinwang commented Sep 20, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

parse_kernel_cert_table (sev-snp-qvl) copied every entry's range into a new Vec. Entries may overlap, so a table where each 24-byte entry names the whole blob decodes to len/24 copies of it, all held at once: 179 MB from a 64 KiB auxblob, ~46 GiB from 1 MiB. QuoteVerifier::verify runs this on cert_chain[0] of an unverified SNP attestation, before any signature check, and release builds abort on allocation failure.

Fix

Return borrowed slices from parse_kernel_cert_table and copy only the ASK and VCEK that are actually used. Memory is now bounded by the input, with no entry-count limit.

Verification

  • Regression test: a ~1 MiB table of overlapping whole-blob entries now fails fast with "missing ASK"; the old code would allocate ~46 GiB.
  • cargo test -p sev-snp-qvl: 16 passed. fmt and clippy clean.

@kvinwang kvinwang changed the title fix(sev-snp-qvl): an SNP certificate table can name 46 GiB from a 1 MiB blob fix(sev-snp-qvl): borrow kernel certificate table entries instead of copying them Sep 24, 2026
@kvinwang
kvinwang merged commit 8803fc9 into next Sep 24, 2026
11 checks passed
@kvinwang
kvinwang deleted the fix/parser-input-bounds branch September 24, 2026 14:20
kvinwang added a commit that referenced this pull request Sep 25, 2026
Extend the SEV-SNP case with the certificate-table, empty-report, guest
feature, rootfs-hash and page-budget tests (#1248, #1279, #1275, #1252),
and the cloud TPM case with the PCR bank, duplicate index, quoted event
log, collateral budget and host allowlist tests (#1275, #1267, #1338,

Signed-off-by: Kevin Wang <wy721@qq.com>
#1238, #1404).
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.

1 participant