From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ua0-f197.google.com (mail-ua0-f197.google.com [209.85.217.197]) by kanga.kvack.org (Postfix) with ESMTP id 1EA3B6B0266 for ; Wed, 10 Jan 2018 16:06:16 -0500 (EST) Received: by mail-ua0-f197.google.com with SMTP id x25so255730uax.16 for ; Wed, 10 Jan 2018 13:06:16 -0800 (PST) Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id d67sor6187734vka.238.2018.01.10.13.06.15 for (Google Transport Security); Wed, 10 Jan 2018 13:06:15 -0800 (PST) MIME-Version: 1.0 In-Reply-To: References: <1515531365-37423-1-git-send-email-keescook@chromium.org> <1515531365-37423-5-git-send-email-keescook@chromium.org> From: Kees Cook Date: Wed, 10 Jan 2018 13:06:13 -0800 Message-ID: Subject: Re: [PATCH 04/36] usercopy: Prepare for usercopy whitelisting Content-Type: text/plain; charset="UTF-8" Sender: owner-linux-mm@kvack.org List-ID: To: Christopher Lameter Cc: LKML , David Windsor , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Linux-MM , 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 , Network Development , kernel-hardening@lists.openwall.com On Wed, Jan 10, 2018 at 10:28 AM, 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. > >> 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. Good idea; I've done this now. > Rest looks ok. > > Acked-by: Christoph Lameter Thanks! -Kees -- Kees Cook Pixel Security -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org