Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: Peter Fang <peter.fang@intel.com>
To: <sashiko-reviews@lists.linux.dev>
Cc: <kvm@vger.kernel.org>
Subject: Re: [PATCH 2/2] virt: tdx-guest: Allocate Quote buffer dynamically
Date: Fri, 17 Jul 2026 03:21:42 -0700	[thread overview]
Message-ID: <20260717102142.GF3178326@pedri> (raw)
In-Reply-To: <20260612112202.82E011F000E9@smtp.kernel.org>

On Fri, Jun 12, 2026 at 11:22:02AM +0000, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [High] Unbounded host-provided quote size causes guest kernel warning (and potential panic) during allocation.
> --
> 
> commit 918e9fdc48e5a03b41dab3a999be1a3f631327c1
> Author: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
> 
> virt: tdx-guest: Allocate Quote buffer dynamically
> 
> This commit modifies the TDX attestation driver to allocate the Quote
> buffer dynamically based on the size reported by the TDX module. It falls
> back to a default 128 KB buffer if the reported size is unavailable,
> supporting larger quotes needed for newer schemes.
> 
> > +
> > +static void *alloc_quote_buf(size_t *buflen)
> > +{
> > +	unsigned int count;
> > +	size_t len;
> >  	void *addr;
> >  
> > +	len = get_quote_buf_size();
> > +
> > +	/*
> > +	 * This fails if the requested size exceeds the buddy allocator's
> > +	 * maximum order (order-10, 4MB).
> > +	 */
> >  	addr = alloc_pages_exact(len, GFP_KERNEL | __GFP_ZERO);
> 
> [Severity: High]
> If the host provides an excessively large quote_sz, could this allocation
> trigger a kernel warning?
> 
> The comments indicate the buddy allocator will fail requests exceeding
> its maximum order. However, passing an unbounded, host-controlled size
> directly to alloc_pages_exact() without __GFP_NOWARN will trigger a
> WARN_ON_ONCE_GFP in the page allocator's slow path before failing.
> 
> If a host is malicious or misconfigured, could this be used to spam the
> guest's kernel log or cause a denial-of-service crash if the guest runs
> with panic_on_warn=1?
> 
> Would it be better to explicitly check the size against a reasonable upper
> bound or include the __GFP_NOWARN flag here?

Good point. I'll add __GFP_NOWARN here since the host is untrusted.

> 
> -- 
> Sashiko AI review · https://sashiko.dev/#/patchset/20260612110853.3188196-1-peter.fang@intel.com?part=2

  reply	other threads:[~2026-07-17 10:21 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-12 11:08 [PATCH 0/2] tdx-guest: Make Quote buffer size dynamic Peter Fang
2026-06-12 11:08 ` [PATCH 1/2] x86/tdx: Add helper to query maximum TD Quote size Peter Fang
2026-06-12 12:36   ` Kiryl Shutsemau
2026-06-23  4:30     ` Peter Fang
2026-07-10  2:38     ` Binbin Wu
2026-07-14  5:54       ` Peter Fang
2026-06-12 14:25   ` Xiaoyao Li
2026-06-23  4:44     ` Peter Fang
2026-07-02 10:16       ` Xiaoyao Li
2026-07-06  9:18         ` Peter Fang
2026-07-13 16:01   ` Kuppuswamy Sathyanarayanan
2026-07-14  5:56     ` Peter Fang
2026-06-12 11:08 ` [PATCH 2/2] virt: tdx-guest: Allocate Quote buffer dynamically Peter Fang
2026-06-12 11:22   ` sashiko-bot
2026-07-17 10:21     ` Peter Fang [this message]
2026-06-12 12:37   ` Kiryl Shutsemau
2026-06-23  5:11     ` Peter Fang
2026-07-10  3:32   ` Binbin Wu
2026-07-14  6:18     ` Peter Fang
2026-07-13 17:27   ` Kuppuswamy Sathyanarayanan
2026-07-14  6:25     ` Peter Fang
2026-07-14 16:22       ` Kuppuswamy Sathyanarayanan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260717102142.GF3178326@pedri \
    --to=peter.fang@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox