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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5f7525877c21bb9dccd77c5a14ad79b585791aba.camel@intel.com>
Date: Fri, 21 Feb 2025 00:12:37 +0000
From: "Huang, Kai" <kai.huang@...el.com>
To: "kvm@...r.kernel.org" <kvm@...r.kernel.org>, "pbonzini@...hat.com"
	<pbonzini@...hat.com>, "linux-kernel@...r.kernel.org"
	<linux-kernel@...r.kernel.org>
CC: "seanjc@...gle.com" <seanjc@...gle.com>, "Zhao, Yan Y"
	<yan.y.zhao@...el.com>, "Edgecombe, Rick P" <rick.p.edgecombe@...el.com>
Subject: Re: [PATCH 13/30] KVM: TDX: Get TDX global information

On Thu, 2025-02-20 at 12:05 -0500, Paolo Bonzini wrote:
> From: Kai Huang <kai.huang@...el.com>
> 
> KVM will need to consult some essential TDX global information to create
> and run TDX guests.  Get the global information after initializing TDX.
> 
> Signed-off-by: Kai Huang <kai.huang@...el.com>
> Signed-off-by: Rick Edgecombe <rick.p.edgecombe@...el.com>
> Message-ID: <20241030190039.77971-3-rick.p.edgecombe@...el.com>
> Signed-off-by: Paolo Bonzini <pbonzini@...hat.com>
> ---
>  arch/x86/kvm/vmx/tdx.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/arch/x86/kvm/vmx/tdx.c b/arch/x86/kvm/vmx/tdx.c
> index 0666dfbe0bc0..761d3a9cd5c5 100644
> --- a/arch/x86/kvm/vmx/tdx.c
> +++ b/arch/x86/kvm/vmx/tdx.c
> @@ -13,6 +13,8 @@ module_param_named(tdx, enable_tdx, bool, 0444);
>  
>  static enum cpuhp_state tdx_cpuhp_state;
>  
> +static const struct tdx_sys_info *tdx_sysinfo;
> +
>  static int tdx_online_cpu(unsigned int cpu)
>  {
>  	unsigned long flags;
> @@ -90,11 +92,20 @@ static int __init __tdx_bringup(void)
>  	if (r)
>  		goto tdx_bringup_err;
>  
> +	/* Get TDX global information for later use */
> +	tdx_sysinfo = tdx_get_sysinfo();
> +	if (WARN_ON_ONCE(!tdx_sysinfo)) {
> +		r = -EINVAL;
> +		goto get_sysinfo_err;
> +	}
> +
>  	/*
>  	 * Leave hardware virtualization enabled after TDX is enabled
>  	 * successfully.  TDX CPU hotplug depends on this.
>  	 */
>  	return 0;
> +get_sysinfo_err:
> +	__do_tdx_cleanup();

We need to call __tdx_cleanup() after we fix the bug in the previous patch using
the diff I provided:

diff --git a/arch/x86/kvm/vmx/tdx.c b/arch/x86/kvm/vmx/tdx.c
index a889087f119f..770ac9b8b528 100644
--- a/arch/x86/kvm/vmx/tdx.c
+++ b/arch/x86/kvm/vmx/tdx.c
@@ -112,7 +112,7 @@ static int __init __tdx_bringup(void)
         */
        return 0;
 get_sysinfo_err:
-       __do_tdx_cleanup();
+       __tdx_cleanup();
 tdx_bringup_err:
        kvm_disable_virtualization();
        return r;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ