Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753520AbeAJVGT (ORCPT + 1 other); Wed, 10 Jan 2018 16:06:19 -0500 Received: from mail-vk0-f65.google.com ([209.85.213.65]:37551 "EHLO mail-vk0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752424AbeAJVGP (ORCPT ); Wed, 10 Jan 2018 16:06:15 -0500 X-Google-Smtp-Source: ACJfBotVToXl+z67JViCpJ0v7Mr1NN0xeYr6eYjvHwKAfkRmCNngq34XR7OytqUouZzdHkKXYBmS++jvLyNaY8nwT8s= 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 X-Google-Sender-Auth: kfZyVHuXuCCF9Trvnqk9oQuhXyU Message-ID: Subject: Re: [PATCH 04/36] usercopy: Prepare for usercopy whitelisting 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 Content-Type: text/plain; charset="UTF-8" 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 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