All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Michal Hocko <mhocko@suse.com>, Jim Mattson <jmattson@google.com>
Cc: Denis Efremov <efremov@linux.com>,
	joe@perches.com, kvm list <kvm@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] KVM: Use vmemdup_user()
Date: Fri, 18 Jun 2021 19:32:21 +0200	[thread overview]
Message-ID: <e5db7325-90ee-aee2-413f-9c21f48b50e5@redhat.com> (raw)
In-Reply-To: <YMzSM2WAmxpXIHhJ@dhcp22.suse.cz>

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 
kvm_vcpu_ioctl_set_cpuid

      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 
in, either.

Paolo


      reply	other threads:[~2021-06-18 17:32 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-30 14:35 [PATCH] KVM: Use previously computed array_size() Denis Efremov
2020-05-30 15:58 ` Joe Perches
2020-05-30 17:28   ` Denis Efremov
2020-06-01  8:46     ` Paolo Bonzini
2020-06-03 10:11   ` [PATCH] KVM: Use vmemdup_user() Denis Efremov
2020-06-04 18:41     ` Paolo Bonzini
2021-06-18  0:25     ` Jim Mattson
2021-06-18  6:00       ` Michal Hocko
2021-06-18 16:53         ` Jim Mattson
2021-06-18 17:04           ` Michal Hocko
2021-06-18 17:32             ` Paolo Bonzini [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e5db7325-90ee-aee2-413f-9c21f48b50e5@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=efremov@linux.com \
    --cc=jmattson@google.com \
    --cc=joe@perches.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhocko@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.