Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Chao Gao" <chao.gao@intel.com>, kvm@vger.kernel.org
Subject: Re: [PATCH v3 2/2] x86/virt/seamldr: Support multiple sigstruct pages
Date: Thu, 19 Nov 2026 07:53:04 +0000	[thread overview]
Message-ID: <sashiko-outbox-222624@kernel.org> (raw)
In-Reply-To: <20261119074925.3933804-3-chao.gao@intel.com>

Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [Critical] x86/tdx: unaligned physical memory access in
  seamldr_install_module() [1]
--

commit 5316f95a1fa1ecb4d66f112e0d257161d81dbb1c
Author: Chao Gao <chao.gao@intel.com>

x86/virt/seamldr: Support multiple sigstruct pages

This commit expands sigstruct_pages_pa_list[] in struct seamldr_params to
four entries and sets the seamldr_params version to 1 when the sigstruct
spans more than one page.

> diff --git a/arch/x86/virt/vmx/tdx/seamldr.c b/arch/x86/virt/vmx/tdx/seamldr.c
> index 6b9657a28129b..7c09c84df1aa3 100644
> --- a/arch/x86/virt/vmx/tdx/seamldr.c
> +++ b/arch/x86/virt/vmx/tdx/seamldr.c
> @@ -38,7 +38,7 @@
>   */
>  #define SEAMLDR_NR_MODULE_PA_ENTRIES	((SEAMLDR_PARAMS_NR_PAGES * PAGE_SIZE - 128) / sizeof(u64))
>  #define SEAMLDR_MAX_NR_MODULE_PAGES	(SEAMLDR_NR_MODULE_PA_ENTRIES - SEAMLDR_PARAMS_NR_PAGES)
> -#define SEAMLDR_MAX_NR_SIG_PAGES	1
> +#define SEAMLDR_MAX_NR_SIG_PAGES	4
>  
>  /*
>   * The seamldr_params "scenario" field specifies the operation mode:
> @@ -59,7 +59,7 @@ struct seamldr_params {
>  	u32	version;
>  	u32	scenario;
>  	u64	sigstruct_pages_pa_list[SEAMLDR_MAX_NR_SIG_PAGES];
> -	u8	reserved[104];
> +	u8	reserved[80];
>  	u64	module_nr_pages;
>  	u64	module_pages_pa_list[SEAMLDR_NR_MODULE_PA_ENTRIES];
>  } __packed;

[Severity: Critical]
This problem wasn't introduced by this patch, but can allocating struct
seamldr_params with kzalloc_obj() in seamldr_install_module() violate the
hardware page-alignment requirement when CONFIG_SLUB_DEBUG is enabled
[1]?

arch/x86/virt/vmx/tdx/seamldr.c:seamldr_install_module() {
	...
	params = kzalloc_obj(*params);
	if (!params)
		return -ENOMEM;
	...
}

When SLUB redzoning is active, the returned object is shifted within the
slab page rather than page-aligned.  Passing __pa(params) to P_SEAMLDR_INSTALL
in seamldr_install() (and similarly __pa(tdmr_pa_array) from kzalloc() to
TDH_SYS_CONFIG in config_tdx_module()) then hands an unaligned physical
address to the hardware, which truncates the address to the alignment
boundary and reads SLUB metadata and redzone bytes instead of the parameters,
causing initialization failure or memory corruption.

[1] https://sashiko.dev/#/bug/linux-d025ea4c-abd9-44fc-9005-5b2dc7291000

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261119074925.3933804-1-chao.gao@intel.com?part=2

      reply	other threads:[~2026-11-19  7:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19  7:49 [PATCH v3 0/2] TDX: P-SEAMLDR: Support large TDX modules and sigstructs Chao Gao
2026-11-19  7:49 ` [PATCH v3 1/2] x86/virt/seamldr: Support large TDX module binaries Chao Gao
2026-11-19  7:49 ` [PATCH v3 2/2] x86/virt/seamldr: Support multiple sigstruct pages Chao Gao
2026-11-19  7:53   ` 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-222624@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=chao.gao@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