Re: [PATCH 08/15] KVM: VMX: Configure list of user return MSRs at module init

From: Sean Christopherson
Date: Mon May 10 2021 - 11:29:22 EST


On Mon, May 10, 2021, Maxim Levitsky wrote:
> On Tue, 2021-05-04 at 10:17 -0700, Sean Christopherson wrote:
> > @@ -6929,18 +6942,10 @@ static int vmx_create_vcpu(struct kvm_vcpu *vcpu)
> > goto free_vpid;
> > }
> >
> > - BUILD_BUG_ON(ARRAY_SIZE(vmx_uret_msrs_list) != MAX_NR_USER_RETURN_MSRS);
> > + for (i = 0; i < vmx_nr_uret_msrs; ++i) {
> > + vmx->guest_uret_msrs[i].data = 0;
> >
> > - for (i = 0; i < ARRAY_SIZE(vmx_uret_msrs_list); ++i) {
> > - u32 index = vmx_uret_msrs_list[i];
> > - int j = vmx->nr_uret_msrs;
> > -
> > - if (kvm_probe_user_return_msr(index))
> > - continue;
> > -
> > - vmx->guest_uret_msrs[j].slot = i;
> I don't see anything initalizing the .slot after this patch.
> Now this code is removed later which masks this bug,
> but for the bisect sake, I think that this patch
> should still be fixed.

Egad, indeed it's broken. I'll retest the whole series to verify the other
patches will bisect cleanly.

Nice catch!