Re: [PATCH v5 4/6] virt: tdx-guest: Add a helper for the Quote buffer size

From: Peter Fang

Date: Tue Sep 29 2026 - 12:08:58 EST


On Tue, Sep 29, 2026 at 08:45:35AM -0700, Edgecombe, Rick P wrote:
> On Tue, 2026-09-29 at 03:32 -0700, Peter Fang wrote:
> > On Mon, Sep 28, 2026 at 12:13:12PM -0700, Edgecombe, Rick P wrote:
> > > On Mon, 2026-09-28 at 09:13 -0700, Dave Hansen wrote:
> > > > Please explain the goal of this function. Why is it doing what it is
> > > > doing? This should also explain why it is page-aligning and caching
> > > > things.
> > >
> > > I'm not sure it actually needs to be. It shortens the math in the places
> > > where it needs to calculate the pages. And then in tdx_report_new_locked()
> > > it skips zeroing the whole buffer (not sure why to zero the buffer actually.
> > > Seems it
> >
> > I talked to the TDX security folks and this seems to be a hygiene thing.
>
> ???

I was also confused about the zeroing in tdx_report_new_locked(), so I
asked around and the answer was "it's good practice to zero the buffer
before use". So I don't think there was a security reason behind this
zeroing.

>
> > Skipping the zeroing shouldn't pose a security risk.
>
> It is allocated __GFP_ZERO so today the whole thing already gets zeroed before
> being set shared. After that it is a shared buffer and host can read/write it as
> much as they want.

Agreed.