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]
Date: Thu, 1 Feb 2024 09:57:29 +0800
From: Yuan Yao <yuan.yao@...ux.intel.com>
To: isaku.yamahata@...el.com
Cc: kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
	isaku.yamahata@...il.com, Paolo Bonzini <pbonzini@...hat.com>,
	erdemaktas@...gle.com, Sean Christopherson <seanjc@...gle.com>,
	Sagi Shahar <sagis@...gle.com>, Kai Huang <kai.huang@...el.com>,
	chen.bo@...el.com, hang.yuan@...el.com, tina.zhang@...el.com
Subject: Re: [PATCH v18 001/121] x86/virt/tdx: Export TDX KeyID information

On Mon, Jan 22, 2024 at 03:52:37PM -0800, isaku.yamahata@...el.com wrote:
> From: Kai Huang <kai.huang@...el.com>
>
> Each TDX guest must be protected by its own unique TDX KeyID.  KVM will
> need to tell the TDX module the unique KeyID for a TDX guest when KVM
> creates it.
>
> Export the TDX KeyID range that can be used by TDX guests for KVM to
> use.  KVM can then manage these KeyIDs and assign one for each TDX guest
> when it is created.
>
> Each TDX guest has a root control structure called "Trust Domain Root"
> (TDR).  Unlike the rest of the TDX guest, the TDR is protected by the
> TDX global KeyID.  When tearing down the TDR, KVM will need to pass the
> TDX global KeyID explicitly to the TDX module to flush cache associated
> to the TDR.
>
> Also export the TDX global KeyID for KVM to tear down the TDR.
>
> Signed-off-by: Kai Huang <kai.huang@...el.com>

The variables exported by this patch are used first time in patch 18 IIUC...
So how about move this one just before the patch 18 ?

> ---
>  arch/x86/include/asm/tdx.h  |  5 +++++
>  arch/x86/virt/vmx/tdx/tdx.c | 11 ++++++++---
>  2 files changed, 13 insertions(+), 3 deletions(-)
>
> diff --git a/arch/x86/include/asm/tdx.h b/arch/x86/include/asm/tdx.h
> index 4595fbe4639b..4e219fc2e8ee 100644
> --- a/arch/x86/include/asm/tdx.h
> +++ b/arch/x86/include/asm/tdx.h
> @@ -88,6 +88,11 @@ static inline long tdx_kvm_hypercall(unsigned int nr, unsigned long p1,
>  #endif /* CONFIG_INTEL_TDX_GUEST && CONFIG_KVM_GUEST */
>
>  #ifdef CONFIG_INTEL_TDX_HOST
> +
> +extern u32 tdx_global_keyid;
> +extern u32 tdx_guest_keyid_start;
> +extern u32 tdx_nr_guest_keyids;
> +
>  u64 __seamcall(u64 fn, struct tdx_module_args *args);
>  u64 __seamcall_ret(u64 fn, struct tdx_module_args *args);
>  u64 __seamcall_saved_ret(u64 fn, struct tdx_module_args *args);
> diff --git a/arch/x86/virt/vmx/tdx/tdx.c b/arch/x86/virt/vmx/tdx/tdx.c
> index 06fbd0b9ea29..14e068ee2640 100644
> --- a/arch/x86/virt/vmx/tdx/tdx.c
> +++ b/arch/x86/virt/vmx/tdx/tdx.c
> @@ -39,9 +39,14 @@
>  #include <asm/mce.h>
>  #include "tdx.h"
>
> -static u32 tdx_global_keyid __ro_after_init;
> -static u32 tdx_guest_keyid_start __ro_after_init;
> -static u32 tdx_nr_guest_keyids __ro_after_init;
> +u32 tdx_global_keyid __ro_after_init;
> +EXPORT_SYMBOL_GPL(tdx_global_keyid);
> +
> +u32 tdx_guest_keyid_start __ro_after_init;
> +EXPORT_SYMBOL_GPL(tdx_guest_keyid_start);
> +
> +u32 tdx_nr_guest_keyids __ro_after_init;
> +EXPORT_SYMBOL_GPL(tdx_nr_guest_keyids);
>
>  static DEFINE_PER_CPU(bool, tdx_lp_initialized);
>
> --
> 2.25.1
>
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ