[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZbNWiFt/azHuL1+f@chao-email>
Date: Fri, 26 Jan 2024 14:51:52 +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 21/27] KVM: x86: Save and reload SSP to/from SMRAM
On Fri, Jan 26, 2024 at 11:17:24AM +0800, Chao Gao wrote:
>On Tue, Jan 23, 2024 at 06:41:54PM -0800, Yang Weijiang wrote:
>>Save CET SSP to SMRAM on SMI and reload it on RSM. KVM emulates HW arch
>>behavior when guest enters/leaves SMM mode,i.e., save registers to SMRAM
>>at the entry of SMM and reload them at the exit to SMM. Per SDM, SSP is
>>one of such registers on 64-bit Arch, and add the support for SSP. Note,
>>on 32-bit Arch, SSP is not defined in SMRAM, so fail 32-bit CET guest
>>launch.
>>
>>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>
>>---
>> arch/x86/kvm/cpuid.c | 11 +++++++++++
>> arch/x86/kvm/smm.c | 8 ++++++++
>> arch/x86/kvm/smm.h | 2 +-
>> 3 files changed, 20 insertions(+), 1 deletion(-)
>>
>>diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
>>index 3ab133530573..95233b0879a3 100644
>>--- a/arch/x86/kvm/cpuid.c
>>+++ b/arch/x86/kvm/cpuid.c
>>@@ -149,6 +149,17 @@ static int kvm_check_cpuid(struct kvm_vcpu *vcpu,
>> if (vaddr_bits != 48 && vaddr_bits != 57 && vaddr_bits != 0)
>> return -EINVAL;
>> }
>>+ /*
>>+ * Prevent 32-bit guest launch if shadow stack is exposed as SSP
>>+ * state is not defined for 32-bit SMRAM.
>>+ */
>>+ best = cpuid_entry2_find(entries, nent, 0x80000001,
>>+ KVM_CPUID_INDEX_NOT_SIGNIFICANT);
>>+ if (best && !(best->edx & F(LM))) {
>>+ best = cpuid_entry2_find(entries, nent, 0x7, 0);
>>+ if (best && (best->ecx & F(SHSTK)))
>
>F(LM) and F(SHSTK) are kernel-defined feature bits; they are not
>bit masks defined by the CPU.
Oops, my comment is wrong here. Please disregard it.
Powered by blists - more mailing lists