Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1678843pxj; Fri, 18 Jun 2021 12:26:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzavFIXTB2VGpUYjPn0+StRH+M727oHNG2P78gVOdDC6BNW+MaAj65YzqVx9bFErwj2sXOO X-Received: by 2002:a17:906:3a0e:: with SMTP id z14mr12628592eje.289.1624044402560; Fri, 18 Jun 2021 12:26:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624044402; cv=none; d=google.com; s=arc-20160816; b=MrSktZGVusg0t1DLq/YEuEYR7jOE4wyzxj91KR2TABJZNe7OXU0h17YlX1Z7nt4eJk wgFqA8I+FLIWAx5Nsfvjl/F3fo2gvtUOpKIidNJmZH5CF1MQ5cODQm8XYjjKZ+CP+qU4 sA+OWqSKHi03WJwOXac/yeKmLdLHVdq1bCNyIl8koA/cBU4hY2ocncqfAtOWKiVG87nR 8YLyI5HC8IntafOF5rV8kqLOqXhpgN1TRICKEsYDHscZyjXBpgNCcWiTm5BDeo84KSSw z76FfrlfFKbcyBfWGCYKhfZJXw1mykXOB2LusJ1IOT2OtHgTOtOidtW9kNVwtc79BB3P XGFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:subject:from :references:cc:to:dkim-signature; bh=5O7zgLDKRYY6G6eiJkRemhZqC/jfLI1t6/bNmPfwOko=; b=Oikj05JNtgkvcu61j8tvtbnQFmE82acz5HqkEeIpncBUCpSm6ZZ73MFoCJaF3HAgzm rABrOdYm2bG7+mGKyjQh+xDGzDfv8ln69J1LnuqB8JKxAwaj7g2QTKLD9crIHKw50aSR h7QBXEDdSRnT6VryMnMVnWkXS4+7WHAc3sAX76/JpffqgP/LFj6CsNZ0n5E7v1Ga8OwF 9HjYpib4VSS6MP+gGw427FyXgDyKocsyySJFph0ktG2LbTVLnve5scSvb2iaz+H7+Xrj dN4w6Sk+Hn0AMkW6VaDrzJoNYQmAuwX72LYfS9E6hFrvPrRE58540j76fDK17gQPsDBh 8L7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="XE/OXn+x"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k2si3157342ejd.410.2021.06.18.12.26.19; Fri, 18 Jun 2021 12:26:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="XE/OXn+x"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236119AbhFRRel (ORCPT + 99 others); Fri, 18 Jun 2021 13:34:41 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:39495 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234369AbhFRReg (ORCPT ); Fri, 18 Jun 2021 13:34:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1624037546; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5O7zgLDKRYY6G6eiJkRemhZqC/jfLI1t6/bNmPfwOko=; b=XE/OXn+xDyRNiGWdKrqx8+5iyHrPRpVgzmH1KxhOITd4GdwdsrcYZoln4hafbN6PEQdJTs KglgYrgt4T/0Um5umTipQY4njk8Mfgr7kY+d4+vJrJgNDCksLVxcoSAdGuY4nEhH15aQTb VXbksM5oR9TgRl6HFqIZk3n79dNi+CA= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-526-K5aJNxIoPKOuDeDHyGP4rw-1; Fri, 18 Jun 2021 13:32:24 -0400 X-MC-Unique: K5aJNxIoPKOuDeDHyGP4rw-1 Received: by mail-wr1-f72.google.com with SMTP id h104-20020adf90710000b029010de8455a3aso4650383wrh.12 for ; Fri, 18 Jun 2021 10:32:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:cc:references:from:subject:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=5O7zgLDKRYY6G6eiJkRemhZqC/jfLI1t6/bNmPfwOko=; b=sJmAkeZDcHIjGpIFp0+JXPHBk1qGnLWLzWKsLTT4JMZKHQn97lk4JREsKghLxhNjVZ rC+8QtVI+0kQIt1FESsVtoGNL70nAr39HodXtRvS56b0Ff5PBU6QyjZToS95m8fRckYQ lTyVl2F+DJpKdPi84Yfd9mxM3RggrN6o2hIAZm6p/WIjQU9P5H2qF1IoEYaen/9SBSDj c6eTtQ1DgcQdowI63eicGezz4sIQT0oNEPu0StSQsQ+V+E5zMBmmkQRuxa0fADDTCmua DSAuS2Fga1nIvNnmwYrx7f6R2LAmoO/6HKsdjSYPJ9hh4DGv5hnKr7nh/jnmvz8gDnb6 LL+w== X-Gm-Message-State: AOAM531sTh3QbAuz4xW45NU4MMME2fCZZNnrdGJfMI82dsJ4mVBp78yQ fCj/a0TwszwBQBN5WaADymzvLwq4D/rBl0l4K6kBAbsjo9cz3MdVoLVHlfWeXFLHqlJS54tqiyV 0TXAuqR8/bEXU9q1x6a0zarQIZgSi5C8BUXP1BOvNE941nm5TnKWLjKWjFt5t/J1/enhbkKncHm Np X-Received: by 2002:a05:600c:4f0c:: with SMTP id l12mr12803771wmq.123.1624037543339; Fri, 18 Jun 2021 10:32:23 -0700 (PDT) X-Received: by 2002:a05:600c:4f0c:: with SMTP id l12mr12803745wmq.123.1624037543095; Fri, 18 Jun 2021 10:32:23 -0700 (PDT) Received: from ?IPv6:2001:b07:6468:f312:c8dd:75d4:99ab:290a? ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id g17sm12060743wrh.72.2021.06.18.10.32.22 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 18 Jun 2021 10:32:22 -0700 (PDT) To: Michal Hocko , Jim Mattson Cc: Denis Efremov , joe@perches.com, kvm list , LKML References: <0c00d96c46d34d69f5f459baebf3c89a507730fc.camel@perches.com> <20200603101131.2107303-1-efremov@linux.com> From: Paolo Bonzini Subject: Re: [PATCH] KVM: Use vmemdup_user() Message-ID: Date: Fri, 18 Jun 2021 19:32:21 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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