Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Xu Yilun" <yilun.xu@linux.intel.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH v3 5/6] x86/virt/tdx: Re-initialize the extensions on runtime TDX module update
Date: Mon, 05 Oct 2026 17:58:39 +0000	[thread overview]
Message-ID: <20261005175840.1F2D81F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20261006-tdx-module-ext-v3-5-db52cb05b918@linux.intel.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] virt/tdx: stale boot metadata breaks TDX extension initialization
--

commit c0a5cf03ba530712949cf538278d0905890ebf56
Author: Xu Yilun <yilun.xu@linux.intel.com>

x86/virt/tdx: Re-initialize the extensions on runtime TDX module update

This commit introduces a mechanism to re-initialize TDX module extensions
during a runtime update. It intentionally skips memory reallocation, expecting
the TDH.EXT.INIT call to fail if the updated extensions require more memory
than what was originally allocated at boot.

> --- a/arch/x86/virt/vmx/tdx/tdx.c
> +++ b/arch/x86/virt/vmx/tdx/tdx.c

[ ... ]

> +/*
> + * Don't update the memory requirement metadata or try memory allocation in
> + * stop_machine(). If an incompatible update requires more memory, let the
> + * extensions re-initialization fail.
> + */
> +static int reinit_tdx_module_extensions(void)
> +{
> +	if (!(tdx_sysinfo.features.tdx_features0 & TDX_FEATURES0_EXT))
> +		return 0;
> +
> +	return tdx_ext_init();
> +}

[Severity: High]
Will this logic use stale boot-time metadata to skip a mandatory
initialization step for updated modules that introduce extension support?

reinit_tdx_module_extensions() unconditionally reads from
tdx_sysinfo.features.tdx_features0. This struct is populated during boot
initialization.

If an administrator installs a TDX module update where the new firmware
introduces extension support, this check will incorrectly evaluate to 0 and
skip tdx_ext_init().

When a new module adds extension support, it transitions to a pending
initialization state after TDH.SYS.UPDATE and explicitly requires
TDH.EXT.INIT. By returning 0 (success) here, the kernel proceeds as if
the module is fully initialized.

The hardware is left trapped in an intermediate state, which will cause all
subsequent SEAMCALLs to fail and active or new TDs to crash. Conversely,
if an update removes extension support, the kernel will incorrectly attempt
TDH.EXT.INIT and fail the update.

Should the kernel dynamically read the new module's feature bit via
TDH.SYS.RD after the update to accurately determine if TDH.EXT.INIT
is required?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261006-tdx-module-ext-v3-0-db52cb05b918@linux.intel.com?part=5

  reply	other threads:[~2026-10-05 17:58 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-05 17:41 [PATCH v3 0/6] Enable TDX module extensions Xu Yilun
2026-10-05 17:41 ` [PATCH v3 1/6] x86/virt/tdx: Move TDH.SYS.CONFIG operations into a wrapper Xu Yilun
2026-10-06 23:27   ` Edgecombe, Rick P
2026-10-05 17:41 ` [PATCH v3 2/6] x86/virt/tdx: Configure add-on features on TDX module init Xu Yilun
2026-10-06 23:56   ` Edgecombe, Rick P
2026-10-08  4:18     ` Xu Yilun
2026-10-05 17:41 ` [PATCH v3 3/6] x86/virt/tdx: Add extra memory to TDX module for the extensions Xu Yilun
2026-10-05 17:56   ` sashiko-bot
2026-10-05 17:41 ` [PATCH v3 4/6] x86/virt/tdx: Make TDX module initialize " Xu Yilun
2026-10-05 18:00   ` sashiko-bot
2026-10-08  4:25     ` Xu Yilun
2026-10-05 17:41 ` [PATCH v3 5/6] x86/virt/tdx: Re-initialize the extensions on runtime TDX module update Xu Yilun
2026-10-05 17:58   ` sashiko-bot [this message]
2026-10-08  4:47     ` Xu Yilun
2026-10-06  4:32   ` Tony Lindgren
2026-10-05 17:41 ` [PATCH v3 6/6] x86/virt/tdx: Support DPAMT when adding memory for the extensions Xu Yilun
2026-10-05 17:57   ` sashiko-bot
2026-10-08  4:31     ` Xu Yilun
2026-10-06  4:36   ` Tony Lindgren
2026-10-08  4:39     ` Xu Yilun
2026-10-08  5:37       ` Tony Lindgren

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=20261005175840.1F2D81F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=yilun.xu@linux.intel.com \
    /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