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

From: Yang Weijiang
Date: Wed Feb 03 2021 - 07:38:59 EST


On Wed, Feb 03, 2021 at 12:57:41PM +0100, Paolo Bonzini wrote:
> 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.
Thanks a lot for reviewing! These words came from Sean! :-D
>
> 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.
Got it!
>
> Paolo