lkml.org 
[lkml]   [2020]   [Jul]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v3 3/8] KVM: X86: Introduce kvm_check_cpuid()
From
Date
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@intel.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:

\
 
 \ /
  Last update: 2020-07-08 14:29    [W:0.119 / U:0.620 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site