Re: [PATCH 2/2] virt: tdx-guest: Allocate Quote buffer dynamically
Peter Fang <[email protected]>
| Newsgroups | dev.linux.lists.linux-coco,org.kernel.vger.kvm,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <20260714061811.GD3178326@pedri> |
On Fri, Jul 10, 2026 at 11:32:55AM +0800, Binbin Wu wrote: > On 6/12/2026 7:08 PM, Peter Fang wrote: > > From: Kuppuswamy Sathyanarayanan <[email protected]> > > > > 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. Good point. I'll make this clearer. > > > > > 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 <[email protected]> > > Assisted-by: Claude:claude-opus-4-7 > > Assisted-by: GitHub Copilot:gpt-5.4 > > Same issue as pointed by Kiryl in the first patch. There have been discussions about this recently [1]. I think perhaps I should drop the "Assisted-by" tags since I did not use AI to write the actual code. [1] https://lore.kernel.org/linux-coco/[email protected]/ > > > Signed-off-by: Peter Fang <[email protected]> > > Also the use of struct_size_t() instead of offsetof(). Yep. > > Otherwise looks okay to me: > > Reviewed-by: Binbin Wu <[email protected]> Thanks for the review Binbin!