Re: [PATCH v2 27/49] KVM: x86: Swap incoming guest CPUID into vCPU before massaging in KVM_SET_CPUID2

From: Sean Christopherson
Date: Mon Jul 08 2024 - 17:37:49 EST


On Thu, Jul 04, 2024, Maxim Levitsky wrote:
> On Fri, 2024-05-17 at 10:39 -0700, Sean Christopherson wrote:
> > @@ -529,7 +533,14 @@ static int kvm_set_cpuid(struct kvm_vcpu *vcpu, struct kvm_cpuid_entry2 *e2,
> > #endif
> > kvm_vcpu_after_set_cpuid(vcpu);
> >
> > +success:
> > + kvfree(e2);
> > return 0;
> > +
> > +err:
> > + swap(vcpu->arch.cpuid_entries, e2);
> > + swap(vcpu->arch.cpuid_nent, nent);
> > + return r;
> > }
> >
> > /* when an old userspace process fills a new kernel module */
>
> Hi,
>
> This IMHO is a good idea. You might consider moving this patch to the
> beginning of the patch series though, it will make more sense with the rest
> of the patches there.

I'll double check, but IIRC, there were dependencies that prevented moving this
patch earlier.