Received: by 10.192.165.148 with SMTP id m20csp3078442imm; Sun, 29 Apr 2018 13:31:09 -0700 (PDT) X-Google-Smtp-Source: AB8JxZppaGqY8wkDCaRrIKm20cCObyFB89c9t6lmBM5iV60ySZ/3Wvd/1bmKXZfvlilKWR6ezM4o X-Received: by 2002:a17:902:6ac7:: with SMTP id i7-v6mr9800426plt.374.1525033869456; Sun, 29 Apr 2018 13:31:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525033869; cv=none; d=google.com; s=arc-20160816; b=TCmIE/L4CBytMq4tuTLraHFgaAQRcFBowzXm6LhltGY0/M39h0yjMx4YXOOT+l95W5 vMB92T7FhLuGZsFRU5UIKSZT7RE49cLfpOyYkVLXGChgC43EkzkMI9q1FejxEjJ0qlqI 3ral9nqbE9WQA0nwJGHrw5DmivPYb5QZsxLjV4f0y1vq3BItzIyPJ/GCx4X8ZccAMssr 72+tCFbZmunZ2a9keMCEEGhCNPsX9G//6xP6vvCXxrxhDfBcLVgubFrjIaxImAsnqfbS o6nkD5i66kIFw4ArQGPjt+ZCoh6PbP5U1h+q7clAOwGpxy8+ONpLj0WW5ozn+3vZpuio KScQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=Sr+rYXKZnjLJN9fHm2WWLMN5Mn4xsyeavWRuKpZsyfA=; b=qPvTvgbQnyMs00fa/gRqSW2VgMQe6ki7V3sx/d1SEOAdxzm/V3yUHn2tdAvSoc0pej 3gKEqX1PkX3F88TMZcwtLBE2Q7lbtAyvqt6hVrLnqRvDuQhdHr1Z6pZI+oCMhgQSilC2 0eduubgf4nAZ7SCqvHOs4jncVZw5DRDO/bIHFxlRX3TxvVXKQzmHzH8W3miD3D6QIln0 ps9E3IVUCUuujrNShEBF3hC0PtZBd+uPTMhIrdPnkcINCApzuM8bPyW/4xgzydph0rSX idGERijGWuGgnjR159NxjBVrMmB1gdYVQzdDWo8PlKpEaUzAi1qQ6nfaj93BrF/VDMZN qA3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=psOzgTdi; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t126si6310038pfd.55.2018.04.29.13.30.53; Sun, 29 Apr 2018 13:31:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=psOzgTdi; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754220AbeD2Uaa (ORCPT + 99 others); Sun, 29 Apr 2018 16:30:30 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:33650 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753781AbeD2Ua3 (ORCPT ); Sun, 29 Apr 2018 16:30:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Sr+rYXKZnjLJN9fHm2WWLMN5Mn4xsyeavWRuKpZsyfA=; b=psOzgTdix53A6yiOSOvYqnkiu e2L54WCEvWrDIHaIddCBGJXvEnmBamVFM6gkbUoz57m9UZyKjKIl95f2qbN9zfd7JuzEmvmY/DRfW dWzAhAnRMItT7sU1KYde9vHh3wZi3berZ8wJE9beIVjc25fpPWMRM7lyQWvUeR4qv/Pq0PC8KIJKe KEIe+PpAoVIKFu+NyjInWPLLfrhnc0LNdooGOM7nVABFiUW0spIZPO59AIR62ppBHV6Xo6Hb2G+H8 WA+KQWx/Y/TYKBhM2TqoIXDutARiF/EPMCg/qatnXcPSEGBmPlIu0PSbpwJNwjdbgik5fWBlKNS5Y JhG+syVOw==; Received: from willy by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1fCsxj-0004Ui-O2; Sun, 29 Apr 2018 20:30:23 +0000 Date: Sun, 29 Apr 2018 13:30:23 -0700 From: Matthew Wilcox To: Kees Cook Cc: Julia Lawall , Andrew Morton , Matthew Wilcox , Linux-MM , LKML , Kernel Hardening , cocci@systeme.lip6.fr, Himanshu Jha Subject: Re: [PATCH 2/2] mm: Add kvmalloc_ab_c and kvzalloc_struct Message-ID: <20180429203023.GA11891@bombadil.infradead.org> References: <20180214182618.14627-1-willy@infradead.org> <20180214182618.14627-3-willy@infradead.org> <20180308025812.GA9082@bombadil.infradead.org> <20180308230512.GD29073@bombadil.infradead.org> <20180313183220.GA21538@bombadil.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Apr 29, 2018 at 09:59:27AM -0700, Kees Cook wrote: > Did this ever happen? Not yet. I brought it up at LSFMM, and I'll repost the patches soon. > I'd also like to see kmalloc_array_3d() or > something that takes three size arguments. We have a lot of this > pattern too: > > kmalloc(sizeof(foo) * A * B, gfp...) > > And we could turn that into: > > kmalloc_array_3d(sizeof(foo), A, B, gfp...) Are either of A or B constant? Because if so, we could just use kmalloc_array. If not, then kmalloc_array_3d becomes a little more expensive than kmalloc_array because we have to do a divide at runtime instead of compile-time. that's still better than allocating too few bytes, of course. I'm wondering how far down the abc + ab + ac + bc + d rabbit-hole we're going to end up going. As far as we have to, I guess.