Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751368AbeAPPVh (ORCPT + 1 other); Tue, 16 Jan 2018 10:21:37 -0500 Received: from resqmta-ch2-12v.sys.comcast.net ([69.252.207.44]:34616 "EHLO resqmta-ch2-12v.sys.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751002AbeAPPVe (ORCPT ); Tue, 16 Jan 2018 10:21:34 -0500 Date: Tue, 16 Jan 2018 09:21:30 -0600 (CST) From: Christopher Lameter X-X-Sender: cl@nuc-kabylake To: Matthew Wilcox 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: kmem_cache_attr (was Re: [PATCH 04/36] usercopy: Prepare for usercopy whitelisting) In-Reply-To: <20180114230719.GB32027@bombadil.infradead.org> Message-ID: References: <1515531365-37423-1-git-send-email-keescook@chromium.org> <1515531365-37423-5-git-send-email-keescook@chromium.org> <20180114230719.GB32027@bombadil.infradead.org> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-CMAE-Envelope: MS4wfDIgtVQCBZgt6sk+9cYrNvAYpD3LVlpNA3QJk+0A6AooKRI5QyVUmTLfuhsztx4D2V5GutUHvta8o7gLg/5lgynemi7Qui0cXDZ76wSkO+j1XhdlC2lU B3kA6ZC2poviOEZhAc0Gs68GUYy1rgUD/T9CVZSN/WRLreZxCwQ1EoeqDkWs40HKJ5ka7J5f7tEJLPUgwwvS6R0pdKwKvufwb8c5CF50ZerFRtknOWNmaJWW IRav88CYCF7dMdRCnghUy2qeV/MQzrxot+TuszVjruiZOpLSwYc4wblx3a8oSETVGJ5qlsLTtP1c0OBpw1ME8XFpkI9ZXY9+vH1T81+yw6UKVljuWls3VoTP 8VPhKYoJubyZZHb2PrdIKkRFc5uunP9LQZGLun15IluzfI2ZAFfxF3sTLlh30cVNIjra15grAS+ESxSTCtpXhwYm7nHHj3YX8A6iq7Dcnm0O/BR+BdLNehd5 h4oVwkdvh1xNrNhgfgeWoyxnVpZ2jidFCZzcfVii4qRiVfLk7zg6yw+PzEznmE4SF3W4i5ViaUK/QOzbMh5oItnb4g+EFKaFM8+nFHIwsac3cxXXP2Ik+v1Q sfKlS65OB+cBZo9ylOL/TdsyIvZ5Z9xu9hUniz+y3BEDwFQzNI9565YiFuIva3H6cx/hesJoNsOHxhMbEO6EpzCtCOtOGpR4/ltxDkVkY/tn0IlszGMS3Q1S Ue05O5ePFM929N/no76Q9ahW9VDC0+4qDqiYIhQWGRV7iazXhY9d4kZQS3TwjmLsdDupGhMvQ3MtOQ6W8KgbFrTyrzTx7CpmdimxCE4YEWqqdBbPFJ5sjX3z msCCrEWMpa82Cg6Uq1cQALczwkMloDljlSoLQTM1GTLZWZbKjCeAXoHJl/3Tva/HgadTnVjdT8dkxtqGI0lCmJoJJhcWHIT/+cEm2fqtT+VQEA4VLdpHiJ0n idh7MghpgIUjrcsOQwM/iZ4/Ic2L9mdl6XdqLSxotxL7z/jyO9J31PCy8kv2Vkzo+MogOFFZyF/CNmHarJySrZSrueZOBQ9Xtn1cLPx5LVNoNKVKcQODDFLW JCnhxNFZWOFbhjnMz+IHWZja0lpoiENUvjoYZjx8rWw2BvnMwFbfH7LagRtB4+m1YXkbf6w9qqfNaKIwtcPB8XKm8R1YzgDgMKM= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On Sun, 14 Jan 2018, Matthew Wilcox wrote: > > 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: Right. Thats why I said "at some point".... > > struct kmem_cache_attr { > const char name[32]; Want to avoid the string reference mess that occurred in the past? Is that really necessary? But it would limit the size of the name. > 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). Thought about putting all the parameters into the kmem_cache_attr struct. So struct kmem_cache_attr { char *name; size_t size; size_t align; slab_flags_t flags; unsigned int useroffset; unsinged int usersize; void (*ctor)(void *); kmem_isolate_func *isolate; kmem_migrate_func *migrate; ... }