lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0a73607f-fe0b-4bd5-bc01-cd90841a39fa@linux.intel.com>
Date: Wed, 3 Dec 2025 11:49:36 +0800
From: Binbin Wu <binbin.wu@...ux.intel.com>
To: Chao Gao <chao.gao@...el.com>
Cc: linux-coco@...ts.linux.dev, linux-kernel@...r.kernel.org, x86@...nel.org,
 reinette.chatre@...el.com, ira.weiny@...el.com, kai.huang@...el.com,
 dan.j.williams@...el.com, yilun.xu@...ux.intel.com, sagis@...gle.com,
 vannapurve@...gle.com, paulmck@...nel.org, nik.borisov@...e.com,
 Farrah Chen <farrah.chen@...el.com>, "Kirill A. Shutemov" <kas@...nel.org>,
 Dave Hansen <dave.hansen@...ux.intel.com>,
 Thomas Gleixner <tglx@...utronix.de>, Ingo Molnar <mingo@...hat.com>,
 Borislav Petkov <bp@...en8.de>, "H. Peter Anvin" <hpa@...or.com>
Subject: Re: [PATCH v2 19/21] x86/virt/tdx: Establish contexts for the new TDX
 Module



On 10/1/2025 10:53 AM, Chao Gao wrote:
> After being installed, the new TDX Module shouldn't re-configure the
> global HKID, TDMRs or PAMTs. Instead, to preserve running TDs, it should
> import the handoff data from the old module to establish all necessary
> contexts.
> 
> Once the import is done, the TDX Module update is complete, and the new
> module is ready to handle requests from the VMM and guests.
> 
> Call the TDH.SYS.UPDATE SEAMCALL to import the handoff data from the old
> module.
> 
> Note that the location and the format of handoff data is defined by the
> TDX Module. The new module knows where to get the handoff data and how to
> parse it. The kernel doesn't need to provide its location, format etc.
> 
> Signed-off-by: Chao Gao <chao.gao@...el.com>
> Tested-by: Farrah Chen <farrah.chen@...el.com>
> ---
>  arch/x86/virt/vmx/tdx/seamldr.c |  5 +++++
>  arch/x86/virt/vmx/tdx/tdx.c     | 16 ++++++++++++++++
>  arch/x86/virt/vmx/tdx/tdx.h     |  2 ++
>  3 files changed, 23 insertions(+)
> 
> diff --git a/arch/x86/virt/vmx/tdx/seamldr.c b/arch/x86/virt/vmx/tdx/seamldr.c
> index 75bb650d8a16..a8ca6966beac 100644
> --- a/arch/x86/virt/vmx/tdx/seamldr.c
> +++ b/arch/x86/virt/vmx/tdx/seamldr.c
> @@ -236,6 +236,7 @@ enum tdp_state {
>  	TDP_SHUTDOWN,
>  	TDP_CPU_INSTALL,
>  	TDP_CPU_INIT,
> +	TDP_RUN_UPDATE,
>  	TDP_DONE,
>  };
>  
> @@ -310,6 +311,10 @@ static int do_seamldr_install_module(void *params)
>  			case TDP_CPU_INIT:
>  				ret = tdx_cpu_enable();
>  				break;
> +			case TDP_RUN_UPDATE:
> +				if (primary)
> +					ret = tdx_module_run_update();
> +				break;
>  			default:
>  				break;
>  			}
> diff --git a/arch/x86/virt/vmx/tdx/tdx.c b/arch/x86/virt/vmx/tdx/tdx.c
> index 280c2a9f3211..7613fd16a0ce 100644
> --- a/arch/x86/virt/vmx/tdx/tdx.c
> +++ b/arch/x86/virt/vmx/tdx/tdx.c
> @@ -1225,6 +1225,22 @@ void tdx_module_set_error(void)
>  	tdx_module_status = TDX_MODULE_ERROR;
>  }
>  
> +int tdx_module_run_update(void)
> +{
> +	struct tdx_module_args args = {};
> +	int ret;> +
> +	ret = seamcall(TDH_SYS_UPDATE, &args);

Since it's a seamcall error, shouldn't it be u64?

> +	if (ret) {
> +		tdx_module_status = TDX_MODULE_ERROR;
> +		pr_info("module update failed: %d\n", ret);

pr_info -> pr_err?
Also, use 0x%016llx as the format.

> +		return ret;
> +	}
> +
> +	tdx_module_status = TDX_MODULE_INITIALIZED;
> +	return 0;
> +}
> +
>  static bool is_pamt_page(unsigned long phys)
>  {
>  	struct tdmr_info_list *tdmr_list = &tdx_tdmr_list;
> diff --git a/arch/x86/virt/vmx/tdx/tdx.h b/arch/x86/virt/vmx/tdx/tdx.h
> index b903e479e46a..983c01c6949a 100644
> --- a/arch/x86/virt/vmx/tdx/tdx.h
> +++ b/arch/x86/virt/vmx/tdx/tdx.h
> @@ -47,6 +47,7 @@
>  #define TDH_VP_WR			43
>  #define TDH_SYS_CONFIG			45
>  #define TDH_SYS_SHUTDOWN		52
> +#define TDH_SYS_UPDATE		53
>  
>  /*
>   * SEAMCALL leaf:
> @@ -122,5 +123,6 @@ struct tdmr_info_list {
>  int tdx_module_shutdown(void);
>  void tdx_module_set_error(void);
>  int tdx_cpu_enable(void);
> +int tdx_module_run_update(void);
>  
>  #endif


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ