Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752401AbeAJS23 (ORCPT + 1 other); Wed, 10 Jan 2018 13:28:29 -0500 Received: from resqmta-po-01v.sys.comcast.net ([96.114.154.160]:50096 "EHLO resqmta-po-01v.sys.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751842AbeAJS22 (ORCPT ); Wed, 10 Jan 2018 13:28:28 -0500 Date: Wed, 10 Jan 2018 12:28:23 -0600 (CST) From: Christopher Lameter X-X-Sender: cl@nuc-kabylake To: Kees Cook cc: 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 In-Reply-To: <1515531365-37423-5-git-send-email-keescook@chromium.org> Message-ID: References: <1515531365-37423-1-git-send-email-keescook@chromium.org> <1515531365-37423-5-git-send-email-keescook@chromium.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: MS4wfD2Oen3ixGEUXOOvhsgwC3J+SI0RtfQJ7TITC36vncn02iOQMNU+McXj5rMtQBmd6RChFLnUC4l3GIPTKNS/xP2XGTRRE7W7wdelOwW6N9+Q78OIvhR1 ViNY8RYThkkXWPddqhzZ37gWYxiANAuhcK3qBut+srk3eNwJ7pUMQ8/FK+TFKH8RdMtBiU4D6onnfShnqH2beUwnfgOYEjXC089PSkza5fPT3M2whhN63FZO hsGMBNjSnPfEYeeJg1vMTSCrw1zTSOS4aFhUuua+VS8D155sJSZbqPWrBoFumbFhIRdLxZopZQPaMdSrV3meXx2Z+DlmLjpoxksNVGUVIFcLlR9fgKbX9qxK zclHubCJFwYWAQ4LMwZ9SXl9QcPiHxotG8vDPkGYn//Is8MgVCIuJhV1zntlrY/oU9jIGi9DrE4b/w7RerJyKstTnwV3D7QVb88di26x/dT7LhfrWK7pfky+ 9Vxe8in5egCnjdr+kZ6OV6vmCoykJI/ZF0UkABw3Tu7fhOFkVLIHprfcSLlFKAZV+iV+NWtimENabWvhN5nLzoKwvusMPK409DLBjTF4srrwh0z7C31Yvu3L DzcfW/fZEJ6FNdbEavhY5a99x0V4kibLY4MgLFUYHuf4cDfLkk1qf50eX2wNa7w848J3poqA5k+Q/mOY3ybognUXH1dUkRWXL3D1k3PPn/n2bOLoT3zazT+P QHubKpzJpeyFOHkC+guGhs4nXU357AAJ+HaggfBh300YFGTmxp/7zcBYVjguau98Ry6WTouqw0eMoUvT80PKPAIaiX+Eo7kJGmc+ULHgTcJ772OnacuQmM4V 65hx4UPt7FyiKiNgl+iVj0IDiG8+9+KtryE08dlh0p5g3TvBNSOJhaNff1Ac7gfV6KfzaMExgOjTLmbN4kfn5e0soF64dra8hHH9qGkw0IyBpkCvDO+BoqZL S1ZrBF7dLQU9EooY07IeP5xs2USgUMeP3q0ntEOhEFXPw99V8ja2olBOlai0VTJS3OVrWevHrRn0bHNyzGkuJqzcCi1otmYb67OUjJBMFv50REq3MJlRP2DD UoFRIzTb3jwD4Tj6tuDugRx42NA64anCNCSKbSYQOOLSYNlNso8zA6bfy5jGwzHeXLmsinDuZwEF8A== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: 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. > index 2181719fd907..70c4b4bb4d1f 100644 > --- a/include/linux/stddef.h > +++ b/include/linux/stddef.h > @@ -19,6 +19,8 @@ enum { > #define offsetof(TYPE, MEMBER) ((size_t)&((TYPE *)0)->MEMBER) > #endif > > +#define sizeof_field(structure, field) sizeof((((structure *)0)->field)) > + > /** > * offsetofend(TYPE, MEMBER) > * Have a separate patch for adding this functionality? Its not a slab maintainer file. Rest looks ok. Acked-by: Christoph Lameter