Re: [PATCH v5 4/6] virt: tdx-guest: Add a helper for the Quote buffer size
From: Peter Fang
Date: Tue Sep 29 2026 - 07:01:34 EST
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.
Skipping the zeroing shouldn't pose a security risk.
> could just zero the struct members, or maybe skip it).
>
> But actually, this series has a little bit of a change there? Because after this
> helper is used, the whole page aligned buffer is zeroed regardless of the quote
> size being aligned. Today the compile time constant buffer size happens to be
> page aligned already though, so actually there is no change.
That's a good point. I took Xiaoyao's suggestion to just always align
[1], but maybe that was packing too much into one function.
[1] https://lore.kernel.org/all/e6121cf3-83eb-4cc8-919e-2557fbcab3c9@xxxxxxxxx/
>
> But still, a more limited change would have get_quote_buf_size() return the un-
> aligned size, like how the define is treated. Then leave the align logic alone
> in the callers. Another patch (not in this series) could change that and maybe
> make the memset() length in tdx_report_new_locked() make more sense. How about
> it?
Sounds good to me.
>
> I guess it just seems like this patch preps for the dynamic changes, while only
> halfway addressing the align mysteries.