[PATCH v3 0/4] tdx-guest: Make Quote buffer size dynamic
From: Peter Fang
Date: Wed Jul 29 2026 - 09:09:38 EST
Hi,
A new TDX module ABI provides the maximum attestation report size. This
series changes the TDX guest driver's report buffer size from a fixed
constant to that queried value. So effectively:
s/FIXED_BUF_SIZE/queried_buf_size/g
...in the TDX guest driver.
Terminology
===========
A "TD Quote" is an attestation structure signed with a platform key. It
contains information about a TDX guest and the platform it's running on.
The "Quote buffer" in the TDX guest driver is a memory buffer shared
between the TDX guest and the host VMM to retrieve TD Quotes. It has a
header defined in the GHCI spec [1].
Device Identifier Composition Engine ("DICE") provides a framework for
layering attestation evidence. This replaces the SGX model of contacting
an Intel server to obtain a certificate.
Problem
=======
The fixed-size Quote buffer approach is not sustainable. As
cryptographic algorithms evolve, TD Quote sizes also grow. A previous
commit [2] increased the guest driver's fixed-size Quote buffer to 128
KB to accommodate DICE Quotes, but it may still be insufficient when
those Quotes use post-quantum cryptography (PQC). PQC certificate chains
are roughly 10x-15x larger than conventional ones, which can increase
Quote sizes significantly.
What's in this series
=====================
To avoid changing the driver whenever the Quote buffer becomes too
small, newer TDX modules report their maximum Quote size via a metadata
field. The guest driver uses this value for its Quote buffer when
available. Older TDX modules continue to use the 128 KB buffer.
Patches 2 and 3 refactor the existing fixed buffer handling. Patch 4
then makes the buffer size dynamic.
The "outblob" file in configfs-tsm no longer has a fixed maximum size.
The limit can now come from this new TDX module ABI.
Patch 1/4: Add a helper to read the QUOTE_MAX_SIZE metadata field.
Patch 2/4: Calculate the Quote buffer size with struct_size_t().
Patch 3/4: Store the Quote buffer size in a variable instead of a
constant.
Patch 4/4: Allocate the Quote buffer using the queried size, when
available.
AI use
======
I used Claude:claude-opus-4-8 to help edit this cover letter and the
changelogs, and to collect the review feedback on lore. The series also
underwent AI code review (Claude:claude-opus-4-7), but its comments were
limited to style suggestions.
v2: https://lore.kernel.org/all/20260717214349.4075994-1-peter.fang@xxxxxxxxx/
Changes in v3:
- Split the v2 "Allocate Quote buffer dynamically" patch to do the
refactoring first, then make the buffer size dynamic. [Dave]
- Improve patterns for readability. [Dave]
- Drop __GFP_NOWARN so an allocation failure warns. [Dave, Rick, Kiryl]
- Add Binbin's Reviewed-by to patch 1.
- Drop the Reviewed-by tags (Kiryl, Binbin) as the patch was reworked.
v1: https://lore.kernel.org/all/20260612110853.3188196-1-peter.fang@xxxxxxxxx/
Changes in v2:
- Collect Reviewed-by tags. [Kiryl, Xiaoyao, Binbin, Sathya]
- Keep the explicit (u32) cast in tdx_get_max_quote_size(). [Binbin]
- Calculate the Quote buffer size with struct_size_t(). [Kiryl, Binbin]
- Add __GFP_NOWARN to the allocation since its size comes from the
host. [sashiko]
- Rename quote_data_size to quote_data_len. [Sathya]
- Drop the Assisted-by tags, as AI was not used to write the code.
[1] Guest Hypervisor Communication Interface (GHCI) Specification,
Version 1.5, Section "TDG.VP.VMCALL<GetQuote>"
[2] 43185067c6fd ("configfs-tsm-report: tdx_guest: Increase Quote buffer
size to 128KB")
Kuppuswamy Sathyanarayanan (1):
virt: tdx-guest: Allocate Quote buffer dynamically
Peter Fang (3):
x86/tdx: Add helper to query maximum TD Quote size
virt: tdx-guest: Calculate the Quote buffer size safely
virt: tdx-guest: Use a variable to store the Quote buffer size
arch/x86/coco/tdx/tdx.c | 19 ++++++++++
arch/x86/include/asm/shared/tdx.h | 1 +
arch/x86/include/asm/tdx.h | 2 ++
drivers/virt/coco/tdx-guest/tdx-guest.c | 46 ++++++++++++++++++-------
4 files changed, 55 insertions(+), 13 deletions(-)
base-commit: f5098b6bae761e346ebcd9da7f95622c04733cff
--
2.53.0