[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZbNRz/c207HYuHxi@chao-email>
Date: Fri, 26 Jan 2024 14:31:43 +0800
From: Chao Gao <chao.gao@...el.com>
To: Yang Weijiang <weijiang.yang@...el.com>
CC: <seanjc@...gle.com>, <pbonzini@...hat.com>, <dave.hansen@...el.com>,
<kvm@...r.kernel.org>, <linux-kernel@...r.kernel.org>, <x86@...nel.org>,
<yuan.yao@...ux.intel.com>, <peterz@...radead.org>,
<rick.p.edgecombe@...el.com>, <mlevitsk@...hat.com>, <john.allen@....com>
Subject: Re: [PATCH v9 23/27] KVM: VMX: Set host constant supervisor states
to VMCS fields
On Tue, Jan 23, 2024 at 06:41:56PM -0800, Yang Weijiang wrote:
>Save constant values to HOST_{S_CET,SSP,INTR_SSP_TABLE} field explicitly.
>Kernel IBT is supported and the setting in MSR_IA32_S_CET is static after
>post-boot(The exception is BIOS call case but vCPU thread never across it)
>and KVM doesn't need to refresh HOST_S_CET field before every VM-Enter/
>VM-Exit sequence.
>
>Host supervisor shadow stack is not enabled now and SSP is not accessible
>to kernel mode, thus it's safe to set host IA32_INT_SSP_TAB/SSP VMCS field
>to 0s. When shadow stack is enabled for CPL3, SSP is reloaded from PL3_SSP
>before it exits to userspace. Check SDM Vol 2A/B Chapter 3/4 for SYSCALL/
>SYSRET/SYSENTER SYSEXIT/RDSSP/CALL etc.
>
>Prevent KVM module loading if host supervisor shadow stack SHSTK_EN is set
>in MSR_IA32_S_CET as KVM cannot co-exit with it correctly.
>
>Suggested-by: Sean Christopherson <seanjc@...gle.com>
>Suggested-by: Chao Gao <chao.gao@...el.com>
>Signed-off-by: Yang Weijiang <weijiang.yang@...el.com>
>Reviewed-by: Maxim Levitsky <mlevitsk@...hat.com>
Reviewed-by: Chao Gao <chao.gao@...el.com>
two nits below.
>---
> arch/x86/kvm/vmx/capabilities.h | 4 ++++
> arch/x86/kvm/vmx/vmx.c | 15 +++++++++++++++
> arch/x86/kvm/x86.c | 14 ++++++++++++++
> arch/x86/kvm/x86.h | 1 +
> 4 files changed, 34 insertions(+)
>
>diff --git a/arch/x86/kvm/vmx/capabilities.h b/arch/x86/kvm/vmx/capabilities.h
>index 41a4533f9989..ee8938818c8a 100644
>--- a/arch/x86/kvm/vmx/capabilities.h
>+++ b/arch/x86/kvm/vmx/capabilities.h
>@@ -106,6 +106,10 @@ static inline bool cpu_has_load_perf_global_ctrl(void)
> return vmcs_config.vmentry_ctrl & VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL;
> }
>
>+static inline bool cpu_has_load_cet_ctrl(void)
s/cet_ctrl/cet_state
>+{
>+ return (vmcs_config.vmentry_ctrl & VM_ENTRY_LOAD_CET_STATE);
nit: unnecessary brackets.
Powered by blists - more mailing lists