Re: [PATCH] KVM: Use vmemdup_user()
From: Paolo Bonzini
Date: Fri Jun 18 2021 - 13:32:34 EST
On 18/06/21 19:04, Michal Hocko wrote:
On Fri 18-06-21 09:53:53, Jim Mattson wrote:
In any case, these allocations *should* be accounted, shouldn't they?
This is more of a question to maintainers. Are these objects easy to
request by userspace without any bounds?
This particular one need not be accounted because the allocation only
lasts for the duration of the ioctl. The allocation below in
e2 = kvmalloc_array(cpuid->nent, sizeof(*e2), GFP_KERNEL_ACCOUNT);
is long term and is already accounted for.
kvm_vcpu_ioctl_set_cpuid2 should also use kvmalloc_array and
GFP_KERNEL_ACCOUNT. However, it wasn't doing so before this patch went