Re: [PATCH v5 4/5] KVM: VMX: Allow direct access to MSR_IA32_SPEC_CTRL

From: David Woodhouse
Date: Wed Jan 31 2018 - 15:00:32 EST


On Wed, 2018-01-31 at 11:53 -0800, Jim Mattson wrote:
> On Wed, Jan 31, 2018 at 11:37 AM, KarimAllah Ahmed wrote:
>
> > +
> > +ÂÂÂÂÂÂ if (to_vmx(vcpu)->save_spec_ctrl_on_exit) {
> > +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂ nested_vmx_disable_intercept_for_msr(
> > +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ msr_bitmap_l1, msr_bitmap_l0,
> > +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ MSR_IA32_SPEC_CTRL,
> > +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ MSR_TYPE_R | MSR_TYPE_W);
> > +ÂÂÂÂÂÂ }
> > +
>
> As this is written, L2 will never get direct access to this MSR until
> after L1 writes it. What if L1 never writes it? The condition should
> really be something that captures, "if L0 is willing to yield this MSR
> to the guest..."

I'm still kind of lost here, but don't forget the requirement that the
MSR must *not* be passed through for direct access by L1 or L2 guests,
unless that ->save_spec_ctrl_on_exit flag is set.

Because that's what makes us set it back to zero on vmexit.

So the above condition doesn't look *so* wrong to me. Perhaps the issue
is that we're missing a way for L2 to actually cause that flag to get
set?

Attachment: smime.p7s
Description: S/MIME cryptographic signature