From patchwork Thu Jan 11 02:03:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 10156589 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4D188605BA for ; Thu, 11 Jan 2018 02:12:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3833D2874B for ; Thu, 11 Jan 2018 02:12:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2C6382874E; Thu, 11 Jan 2018 02:12:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.4 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, URIBL_BLACK autolearn=ham version=3.3.1 Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by mail.wl.linuxfoundation.org (Postfix) with SMTP id 3BCCD2874B for ; Thu, 11 Jan 2018 02:12:26 +0000 (UTC) Received: (qmail 29865 invoked by uid 550); 11 Jan 2018 02:10:04 -0000 Mailing-List: contact kernel-hardening-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Delivered-To: mailing list kernel-hardening@lists.openwall.com Received: (qmail 28607 invoked from network); 11 Jan 2018 02:09:54 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=GSrlRY/ws0P0CG02WMSvf6XhtCuKpkyRu+d0z5n0ffE=; b=VpNMpapfjDsWVC8x88reHR/TXC/I/w3ytSB8sLLi7ZYj8XJBIsX4MSaa8LziPirziy yqF+xVWkSfEqzym8mg9pxCyQ0RyzG3PDa5ts70wgFg2vIo6/nmtiffRGf7IRQvR+9lVr rv6kuNP2/M3KcYoqoMIvT+unQNK1QRIpTMDs8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=GSrlRY/ws0P0CG02WMSvf6XhtCuKpkyRu+d0z5n0ffE=; b=NwO2/gq27LD5pEpg240x3RBUe75v7Qz/fHaf/tg5pxDJZ3HAqaJ67NuvgxQQGJB54I QYc1qvkFmcsfr1UF1i/+6YtvvxCbkIsZeA6Lr7uu3P2NcvWs4H4fTshocHb697SRCho7 0tt6X3RwaxoQHShwcinLyD4RXs7azpDjnfr1d5zn/VYapuamirGgzX/rGeRp1Fvz0qu0 fbcUEfdmkoXRx4YLCqLmCBa4V7fStM8d1Q3+kIUqr4NRw34YG/CFaIlPYGQIzYZw57zy i69jRAocXa6DekilyLFScORWJOxA0SQc37IQ7qX3PdQ+o/qAw3bHjeUHWJCDsHaFJakx 36Kw== X-Gm-Message-State: AKGB3mJgk2Pqh9fcrovztjtZr+qn9g4cBhZcOB3bFEY7o6v6oyH/kfSh 4e+beK2KHYKzeRDvWTq2uSUbCw== X-Google-Smtp-Source: ACJfBoupw6w4eJ3qwDsS+mXsGe87BzpGtAVEPA8HYVg5Jnjpnsr3BfW5xeZ/0i3qq5bAJMbZQJQtug== X-Received: by 10.99.1.151 with SMTP id 145mr8077343pgb.229.1515636583132; Wed, 10 Jan 2018 18:09:43 -0800 (PST) From: Kees Cook To: linux-kernel@vger.kernel.org Cc: Kees Cook , David Windsor , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , linux-mm@kvack.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 Date: Wed, 10 Jan 2018 18:03:09 -0800 Message-Id: <1515636190-24061-38-git-send-email-keescook@chromium.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515636190-24061-1-git-send-email-keescook@chromium.org> References: <1515636190-24061-1-git-send-email-keescook@chromium.org> Subject: [kernel-hardening] [PATCH 37/38] usercopy: Restrict non-usercopy caches to size 0 X-Virus-Scanned: ClamAV using ClamSMTP With all known usercopied cache whitelists now defined in the kernel, switch the default usercopy region of kmem_cache_create() to size 0. Any new caches with usercopy regions will now need to use kmem_cache_create_usercopy() instead of kmem_cache_create(). This patch is modified from Brad Spengler/PaX Team's PAX_USERCOPY whitelisting code in the last public patch of grsecurity/PaX based on my understanding of the code. Changes or omissions from the original code are mine and don't reflect the original grsecurity/PaX code. Cc: David Windsor Cc: Christoph Lameter Cc: Pekka Enberg Cc: David Rientjes Cc: Joonsoo Kim Cc: Andrew Morton Cc: linux-mm@kvack.org Signed-off-by: Kees Cook --- mm/slab_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/slab_common.c b/mm/slab_common.c index 8ac2a6320a6c..d00cd3f0f8ac 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c @@ -532,7 +532,7 @@ struct kmem_cache * kmem_cache_create(const char *name, size_t size, size_t align, slab_flags_t flags, void (*ctor)(void *)) { - return kmem_cache_create_usercopy(name, size, align, flags, 0, size, + return kmem_cache_create_usercopy(name, size, align, flags, 0, 0, ctor); } EXPORT_SYMBOL(kmem_cache_create);