[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3a085ea6-1f2b-904a-99a4-e10ed00e99a0@intel.com>
Date: Wed, 8 Jul 2020 20:28:06 +0800
From: Xiaoyao Li <xiaoyao.li@...el.com>
To: Paolo Bonzini <pbonzini@...hat.com>,
Sean Christopherson <sean.j.christopherson@...el.com>,
Jim Mattson <jmattson@...gle.com>
Cc: kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-doc@...r.kernel.org, Jonathan Corbet <corbet@....net>,
Vitaly Kuznetsov <vkuznets@...hat.com>,
Wanpeng Li <wanpengli@...cent.com>,
Joerg Roedel <joro@...tes.org>
Subject: Re: [PATCH v3 3/8] KVM: X86: Introduce kvm_check_cpuid()
On 7/8/2020 2:50 PM, Xiaoyao Li wrote:
> Use kvm_check_cpuid() to validate if userspace provides legal cpuid
> settings and call it before KVM updates CPUID.
>
> Signed-off-by: Xiaoyao Li <xiaoyao.li@...el.com>
[...]
> @@ -202,12 +208,16 @@ int kvm_vcpu_ioctl_set_cpuid(struct kvm_vcpu *vcpu,
> vcpu->arch.cpuid_entries[i].padding[2] = 0;
> }
> vcpu->arch.cpuid_nent = cpuid->nent;
> + r = kvm_check_cpuid(vcpu);
> + if (r) {
> + vcpu->arch.cpuid_nent = 0;
Paolo,
here lack a kvfree(cpuid_entries);
Can you help fix it?
Apologize for it.
> + goto out;
> + }
> +
> cpuid_fix_nx_cap(vcpu);
> kvm_apic_set_version(vcpu);
> kvm_x86_ops.cpuid_update(vcpu);
> - r = kvm_update_cpuid(vcpu);
> - if (r)
> - vcpu->arch.cpuid_nent = 0;
> + kvm_update_cpuid(vcpu);
>
> kvfree(cpuid_entries);
> out:
Powered by blists - more mailing lists