Re: [PATCH v15 07/14] KVM: VMX: Emulate reads and writes to CET MSRs

From: Paolo Bonzini
Date: Wed Feb 03 2021 - 06:59:40 EST


On 03/02/21 12:34, Yang Weijiang wrote:
MSRs that are switched through XSAVES are especially annoying due to the possibility of the kernel's FPU being used in IRQ context. Disable IRQs and ensure the guest's FPU state is loaded when accessing such MSRs.

Good catch! This should be in x86.h and named kvm_get/set_xsave_msr because it's not VMX specific. The commit message should also be there as a comment.

In addition,

+ case MSR_IA32_S_CET:
+ if (!cet_is_control_msr_accessible(vcpu, msr_info))
+ return 1;
+ msr_info->data = vmcs_readl(GUEST_S_CET);
+ break;
+ case MSR_IA32_U_CET:
+ if (!cet_is_control_msr_accessible(vcpu, msr_info))
+ return 1;
+ vmx_get_xsave_msr(msr_info);
+ break;

these two might as well be the same "case" for symmetry with the handling of WRMSR.

I've fixed this up locally, since these patches will not be pushed to Linus until the corresponding bare metal support is there.

Paolo