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 v4 6/6] x86/virt/tdx: Re-initialize the extensions on runtime TDX module update
Date: Tue, 13 Oct 2026 15:44:40 +0000	[thread overview]
Message-ID: <sashiko-outbox-170037@kernel.org> (raw)
In-Reply-To: <20261013-tdx-module-ext-v4-6-de5ffac65470@linux.intel.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] tdx: use stale features0 metadata for TDH.EXT.INIT during update
--

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

x86/virt/tdx: Re-initialize the extensions on runtime TDX module update
    
Runtime TDX module update introduces a mechanism to update the module
firmware while preserving and restoring TDX operations. The extensions
functionalities should also be re-initialized as part of the restoration
process.

> diff --git a/arch/x86/virt/vmx/tdx/tdx.c b/arch/x86/virt/vmx/tdx/tdx.c
> index f1cc0422d129a..4cce77b6a31f6 100644
> --- a/arch/x86/virt/vmx/tdx/tdx.c
> +++ b/arch/x86/virt/vmx/tdx/tdx.c

[ ... ]

> @@ -1384,6 +1384,19 @@ static __init int init_tdx_module_extensions(void)
>  	return tdx_ext_init();
>  }
>  
> +/*
> + * 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]
Does this use stale features0 metadata during the update?

If an administrator applies a valid TDX firmware update that changes the
presence of zero-memory extensions, could relying on the boot-time cached
value of tdx_sysinfo.features.tdx_features0 cause problems?

If the update introduces zero-memory extensions to a module that originally
had none, the cached flag evaluates to 0, skipping TDH.EXT.INIT. According
to the TDX architecture, this could leave the new TDX module stuck in the
SYS_UPDATED state.

Conversely, if an update removes extensions, the cached flag remains 1,
causing the kernel to erroneously call TDH.EXT.INIT on a module that
doesn't support it.

Should the kernel read the updated TDX_FEATURES0 metadata field using
read_sys_metadata_field() during the update instead of relying on the
boot-time cached value?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261013-tdx-module-ext-v4-0-de5ffac65470@linux.intel.com?part=6

      reply	other threads:[~2026-10-13 15:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-13 15:28 [PATCH v4 0/6] Enable TDX module extensions Xu Yilun
2026-10-13 15:28 ` [PATCH v4 1/6] x86/virt/tdx: Move TDH.SYS.CONFIG operations into a wrapper Xu Yilun
2026-10-13 15:28 ` [PATCH v4 2/6] x86/virt/tdx: Configure add-on features on TDX module init Xu Yilun
2026-10-13 15:28 ` [PATCH v4 3/6] x86/virt/tdx: Add extra memory to TDX module for the extensions Xu Yilun
2026-10-13 18:46   ` Edgecombe, Rick P
2026-10-13 15:28 ` [PATCH v4 4/6] x86/virt/tdx: Support DPAMT when adding memory " Xu Yilun
2026-10-13 18:59   ` Edgecombe, Rick P
2026-10-13 15:28 ` [PATCH v4 5/6] x86/virt/tdx: Make TDX module initialize " Xu Yilun
2026-10-13 15:28 ` [PATCH v4 6/6] x86/virt/tdx: Re-initialize the extensions on runtime TDX module update Xu Yilun
2026-10-13 15:44   ` sashiko-bot [this message]

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=sashiko-outbox-170037@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