Re: [PATCH v2] KVM: X86: deprecate obsolete KVM_GET_CPUID2 ioctl

From: Jim Mattson
Date: Mon Mar 02 2020 - 12:01:41 EST


On Wed, Feb 26, 2020 at 7:20 PM linmiaohe <linmiaohe@xxxxxxxxxx> wrote:
>
> From: Miaohe Lin <linmiaohe@xxxxxxxxxx>
>
> When kvm_vcpu_ioctl_get_cpuid2() fails, we set cpuid->nent to the value of
> vcpu->arch.cpuid_nent. But this is in vain as cpuid->nent is not copied to
> userspace by copy_to_user() from call site. Also cpuid->nent is not updated
> to indicate how many entries were retrieved on success case. So this ioctl
> is straight up broken. And in fact, it's not used anywhere. So it should be
> deprecated.

I don't know how you can make the assertion that this ioctl is not
used anywhere. For instance, I see a use of it in Google's code base.