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: <4eaaa842d7bccfe242eb8671f2ab87a647b02b7e.camel@intel.com>
Date: Tue, 19 Dec 2023 10:39:12 +0000
From: "Huang, Kai" <kai.huang@...el.com>
To: "kvm@...r.kernel.org" <kvm@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>, "Yamahata,
 Isaku" <isaku.yamahata@...el.com>
CC: "Zhang, Tina" <tina.zhang@...el.com>, "seanjc@...gle.com"
	<seanjc@...gle.com>, "Yuan, Hang" <hang.yuan@...el.com>, "Chen, Bo2"
	<chen.bo@...el.com>, "sagis@...gle.com" <sagis@...gle.com>,
	"isaku.yamahata@...il.com" <isaku.yamahata@...il.com>, "Aktas, Erdem"
	<erdemaktas@...gle.com>, "pbonzini@...hat.com" <pbonzini@...hat.com>,
	"dmatlack@...gle.com" <dmatlack@...gle.com>, "zhi.wang.linux@...il.com"
	<zhi.wang.linux@...il.com>, "sean.j.christopherson@...el.com"
	<sean.j.christopherson@...el.com>
Subject: Re: [PATCH v17 011/116] KVM: TDX: Add C wrapper functions for
 SEAMCALLs to the TDX module

On Tue, 2023-11-07 at 06:55 -0800, isaku.yamahata@...el.com wrote:
> +static inline u64 tdx_seamcall(u64 op, u64 rcx, u64 rdx, u64 r8, u64 r9,
> +			       struct tdx_module_args *out)
> +{
> +	u64 ret;
> +
> +	if (out) {
> +		*out = (struct tdx_module_args) {
> +			.rcx = rcx,
> +			.rdx = rdx,
> +			.r8 = r8,
> +			.r9 = r9,
> +		};
> +		ret = __seamcall_ret(op, out);
> +	} else {
> +		struct tdx_module_args args = {
> +			.rcx = rcx,
> +			.rdx = rdx,
> +			.r8 = r8,
> +			.r9 = r9,
> +		};
> +		ret = __seamcall(op, &args);
> +	}
> +	if (unlikely(ret == TDX_SEAMCALL_UD)) {
> +		/*
> +		 * SEAMCALLs fail with TDX_SEAMCALL_UD returned when VMX is off.
> +		 * This can happen when the host gets rebooted or live
> +		 * updated. In this case, the instruction execution is ignored
> +		 * as KVM is shut down, so the error code is suppressed. Other
> +		 * than this, the error is unexpected and the execution can't
> +		 * continue as the TDX features reply on VMX to be on.
> +		 */
> +		kvm_spurious_fault();
> +		return 0;
> +	}
> +	return ret;
> +}

Why is tdx_seamcall() still taking individual registers as input?  This is not
extendable for supporting SEAMCALLs taking more input registers such as live
migration SEAMCALLs.

It's OK to take individual inputs for the SEAMCALL leaf wrappers like ...

> +
> +static inline u64 tdh_mng_addcx(hpa_t tdr, hpa_t addr)
> +{
> +	clflush_cache_range(__va(addr), PAGE_SIZE);
> +	return tdx_seamcall(TDH_MNG_ADDCX, addr, tdr, 0, 0, NULL);
> +}

... this, but the tdx_seamcall() should just take 'struct tdx_module_args' as
argument.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ