Re: [PATCH v5 11/19] KVM:VMX: Emulate read and write to CET MSRs
From: Yang, Weijiang
Date: Tue Aug 08 2023 - 23:05:25 EST
On 8/5/2023 5:40 AM, Paolo Bonzini wrote:
On 8/3/23 06:27, Yang Weijiang wrote:
+ if (msr_info->index == MSR_KVM_GUEST_SSP)
+ msr_info->data = vmcs_readl(GUEST_SSP);
Accesses to MSR_KVM_(GUEST_)SSP must be rejected unless host-initiated.
Yes, it's kept, in v5 it's folded in:
+static bool kvm_cet_is_msr_accessible(struct kvm_vcpu *vcpu,
+struct msr_data *msr)
+{
+if (is_shadow_stack_msr(msr->index)) {
+if (!kvm_cpu_cap_has(X86_FEATURE_SHSTK))
+return false;
+
+if (msr->index == MSR_KVM_GUEST_SSP)
+return msr->host_initiated;
+
+return msr->host_initiated ||
+guest_cpuid_has(vcpu, X86_FEATURE_SHSTK);
+}
+
+if (!kvm_cpu_cap_has(X86_FEATURE_SHSTK) &&
+!kvm_cpu_cap_has(X86_FEATURE_IBT))
+return false;
+
+return msr->host_initiated ||
+guest_cpuid_has(vcpu, X86_FEATURE_IBT) ||
+guest_cpuid_has(vcpu, X86_FEATURE_SHSTK); }
+
Paolo