From patchwork Mon Aug 28 21:35:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 9926331 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 D4B4360375 for ; Mon, 28 Aug 2017 21:44:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C8DDA283C7 for ; Mon, 28 Aug 2017 21:44:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BDAC7287D5; Mon, 28 Aug 2017 21:44:53 +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 86302283C7 for ; Mon, 28 Aug 2017 21:44:52 +0000 (UTC) Received: (qmail 9514 invoked by uid 550); 28 Aug 2017 21:44:08 -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 9288 invoked from network); 28 Aug 2017 21:44:05 -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=9mO2toKnbGG1u8swXssdWAUtfMP8dsMbJpHvQD7ZrVo=; b=k8HO7D/y1E5UM1NgkpIgP1xO17O/MwSmQcOe+0JiJWfPz0lRtM1KT+GDfgrrrkI3x9 TlSEq56DCY9D/1F51E7AW8V6KwfQC0k1atau/ahRFcz7chVoRAeVzizGIwRoC5e/CGU+ UkicBh19ToXMxlqTO0eF07StpWIji5w0JbN1Q= 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=9mO2toKnbGG1u8swXssdWAUtfMP8dsMbJpHvQD7ZrVo=; b=dmeh4513O6XT5AL6vEMmT1Cmy65r/noYeweQxECqNoNyGOPwh9Z563TXaxd7HAGb/v s0WY1VqhpCbxRQ8ayCbshvZKr5vpDRY4+gd1d5FyE4hRPtJrYLMporYzXA48aBJ7Cvgv ViuJ1rBvFWCW0TH4vQy7izYA9Yck3W+jGqq+zWBGI9jJHlLJQ1kUIbMTFCNRMtI3LKN3 UizQpwhtAByZywfzIegUoLcjxeGhNgRpORxWQ+GDGXJpcWNSFcp726rtOJGwC05zeW+/ CwCnW/U/vD/kVMLzQ3IEqpuUjOCL0PYQE2r6CiskSU4L+sv3yjeRr+2o/D/nFQ83lEGr 6qhw== X-Gm-Message-State: AHYfb5i4weGSAdOrmbRr4T4eErYl3kSaUNq5AR/R6+P5rOcNkGp2LSow lLYScKMf4eohDIl2 X-Received: by 10.98.196.22 with SMTP id y22mr1857504pff.29.1503956634069; Mon, 28 Aug 2017 14:43:54 -0700 (PDT) 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, kernel-hardening@lists.openwall.com Date: Mon, 28 Aug 2017 14:35:11 -0700 Message-Id: <1503956111-36652-31-git-send-email-keescook@chromium.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1503956111-36652-1-git-send-email-keescook@chromium.org> References: <1503956111-36652-1-git-send-email-keescook@chromium.org> Subject: [kernel-hardening] [PATCH v2 30/30] 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 f662f4e2fa29..d51c0a36d58b 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c @@ -511,7 +511,7 @@ struct kmem_cache * kmem_cache_create(const char *name, size_t size, size_t align, unsigned long 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);