Re: [PATCH 2/2] virt: tdx-guest: Allocate Quote buffer dynamically
From: Binbin Wu
Date: Thu Jul 09 2026 - 23:33:47 EST
On 6/12/2026 7:08 PM, Peter Fang wrote:
> From: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@xxxxxxxxxxxxxxx>
>
> The TDX attestation driver currently uses a fixed 128 KB Quote buffer
> shared with the host VMM. This may be too small for Quotes using schemes
> such as post-quantum cryptography (PQC), where certificate chains can
> increase the Quote size to several megabytes.
Nit:
I think the description here should be more accurate.
"Several megabytes" colloquially implies sizes that could easily exceed 4 MB.
And it's a slight contradiction VS the 4MB limitation below.
>
> Allocate the Quote buffer based on the size reported by the TDX module
> instead of always reserving a fixed-size buffer. This avoids wasting
> memory on platforms that do not require larger Quotes. Older platforms
> fall back to the default 128 KB buffer.
>
> Because the Quote buffer must be physically contiguous, its size is
> bound by the buddy allocator's maximum page order (4 MB), which should
> be sufficient for current attestation needs.
>
> struct tdx_quote_buf has a trailing flexible array, so use offsetof()
> instead of sizeof() to calculate the header size.
>
> Signed-off-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@xxxxxxxxxxxxxxx>
> Assisted-by: Claude:claude-opus-4-7
> Assisted-by: GitHub Copilot:gpt-5.4
Same issue as pointed by Kiryl in the first patch.
> Signed-off-by: Peter Fang <peter.fang@xxxxxxxxx>
Also the use of struct_size_t() instead of offsetof().
Otherwise looks okay to me:
Reviewed-by: Binbin Wu <binbin.wu@xxxxxxxxxxxxxxx>