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: <ZgzD1FPZV4A45m/e@chao-email>
Date: Wed, 3 Apr 2024 10:49:56 +0800
From: Chao Gao <chao.gao@...el.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 v19 106/130] KVM: TDX: Add KVM Exit for TDX TDG.VP.VMCALL

On Mon, Feb 26, 2024 at 12:26:48AM -0800, isaku.yamahata@...el.com wrote:
>From: Isaku Yamahata <isaku.yamahata@...el.com>
>
>Some of TDG.VP.VMCALL require device model, for example, qemu, to handle
>them on behalf of kvm kernel module. TDVMCALL_REPORT_FATAL_ERROR,
>TDVMCALL_MAP_GPA, TDVMCALL_SETUP_EVENT_NOTIFY_INTERRUPT, and
>TDVMCALL_GET_QUOTE requires user space VMM handling.
>
>Introduce new kvm exit, KVM_EXIT_TDX, and functions to setup it. Device
>model should update R10 if necessary as return value.
>
>Signed-off-by: Isaku Yamahata <isaku.yamahata@...el.com>
>---
>v14 -> v15:
>- updated struct kvm_tdx_exit with union
>- export constants for reg bitmask
>
>Signed-off-by: Isaku Yamahata <isaku.yamahata@...el.com>
>---
> arch/x86/kvm/vmx/tdx.c   | 83 ++++++++++++++++++++++++++++++++++++-
> include/uapi/linux/kvm.h | 89 ++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 170 insertions(+), 2 deletions(-)
>
>diff --git a/arch/x86/kvm/vmx/tdx.c b/arch/x86/kvm/vmx/tdx.c
>index c8eb47591105..72dbe2ff9062 100644
>--- a/arch/x86/kvm/vmx/tdx.c
>+++ b/arch/x86/kvm/vmx/tdx.c
>@@ -1038,6 +1038,78 @@ static int tdx_emulate_vmcall(struct kvm_vcpu *vcpu)
> 	return 1;
> }
> 
>+static int tdx_complete_vp_vmcall(struct kvm_vcpu *vcpu)
>+{
>+	struct kvm_tdx_vmcall *tdx_vmcall = &vcpu->run->tdx.u.vmcall;
>+	__u64 reg_mask = kvm_rcx_read(vcpu);
>+
>+#define COPY_REG(MASK, REG)							\
>+	do {									\
>+		if (reg_mask & TDX_VMCALL_REG_MASK_ ## MASK)			\
>+			kvm_## REG ## _write(vcpu, tdx_vmcall->out_ ## REG);	\
>+	} while (0)

Why XMMs are not copied?

Looks you assume the guest won't use XMMs for TDVMCALL. But I think the ABI
(KVM_EXIT_TDX) should be general, i.e., can support all kinds of (future)
TDVMCALLs.

>+
>+
>+	COPY_REG(R10, r10);
>+	COPY_REG(R11, r11);
>+	COPY_REG(R12, r12);
>+	COPY_REG(R13, r13);
>+	COPY_REG(R14, r14);
>+	COPY_REG(R15, r15);
>+	COPY_REG(RBX, rbx);
>+	COPY_REG(RDI, rdi);
>+	COPY_REG(RSI, rsi);
>+	COPY_REG(R8, r8);
>+	COPY_REG(R9, r9);
>+	COPY_REG(RDX, rdx);
>+
>+#undef COPY_REG
>+
>+	return 1;
>+}

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ