Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752895AbeANXH3 (ORCPT + 1 other); Sun, 14 Jan 2018 18:07:29 -0500 Received: from bombadil.infradead.org ([65.50.211.133]:57482 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751302AbeANXH0 (ORCPT ); Sun, 14 Jan 2018 18:07:26 -0500 Date: Sun, 14 Jan 2018 15:07:19 -0800 From: Matthew Wilcox To: Christopher Lameter Cc: Kees Cook , linux-kernel@vger.kernel.org, David Windsor , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , linux-mm@kvack.org, linux-xfs@vger.kernel.org, Linus Torvalds , Alexander Viro , Andy Lutomirski , Christoph Hellwig , "David S. Miller" , Laura Abbott , Mark Rutland , "Martin K. Petersen" , Paolo Bonzini , Christian Borntraeger , Christoffer Dall , Dave Kleikamp , Jan Kara , Luis de Bethencourt , Marc Zyngier , Rik van Riel , Matthew Garrett , linux-fsdevel@vger.kernel.org, linux-arch@vger.kernel.org, netdev@vger.kernel.org, kernel-hardening@lists.openwall.com Subject: Re: [PATCH 04/36] usercopy: Prepare for usercopy whitelisting Message-ID: <20180114230719.GB32027@bombadil.infradead.org> References: <1515531365-37423-1-git-send-email-keescook@chromium.org> <1515531365-37423-5-git-send-email-keescook@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.1 (2017-09-22) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On Wed, Jan 10, 2018 at 12:28:23PM -0600, Christopher Lameter wrote: > On Tue, 9 Jan 2018, Kees Cook wrote: > > +struct kmem_cache *kmem_cache_create_usercopy(const char *name, > > + size_t size, size_t align, slab_flags_t flags, > > + size_t useroffset, size_t usersize, > > + void (*ctor)(void *)); > > Hmmm... At some point we should switch kmem_cache_create to pass a struct > containing all the parameters. Otherwise the API will blow up with > additional functions. Obviously I agree with you. I'm inclined to not let that delay Kees' patches; we can fix the few places that use this API later. At this point, my proposal for the ultimate form would be: struct kmem_cache_attr { const char name[32]; void (*ctor)(void *); unsigned int useroffset; unsigned int user_size; }; kmem_create_cache_attr(const struct kmem_cache_attr *attr, unsigned int size, unsigned int align, slab_flags_t flags) (my rationale is that everything in attr should be const, but size, align and flags all get modified by the slab code).