From patchwork Wed Sep 20 20:45:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 9962473 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 87B7760208 for ; Wed, 20 Sep 2017 20:49:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7B10229231 for ; Wed, 20 Sep 2017 20:49:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6FE5229233; Wed, 20 Sep 2017 20:49:51 +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 7BD0F29231 for ; Wed, 20 Sep 2017 20:49:50 +0000 (UTC) Received: (qmail 5321 invoked by uid 550); 20 Sep 2017 20:46:40 -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 3793 invoked from network); 20 Sep 2017 20:46:28 -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=JFGIw+81cKMLVmYd63iHJYscTNNsfq2wBAzFdbtdekM=; b=V3H9/HDP59j2n/hFz/7BTrvYrvWeZgLsWpublKhxU6WFdyrLn0xoFbFy3MZDaiVxl2 tx12WSb1igH1pn9zUVY9lY5unOq1qazzkpGekFmwMQ5GLWnt8c5lBSyxhd7MfpLxlomi AsH4WV0kLhJAgsCBG3n6jx3J/CRGMJj19Eyvw= 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=JFGIw+81cKMLVmYd63iHJYscTNNsfq2wBAzFdbtdekM=; b=W2T+IYfxdED86qRqvROvOCr7PvOyk1UBfAIkeOl1oVNlQi4Pyza8jJutwMYNQxgRNu Es3ZYQi0EJ7sFFmS3tC05ajPawXMXTvKHc+tsgvT5uko5TJOlzlZPDFap1Hh7y2C7zQC 0J+RC/N5wbFarHPuAr3Zcep1jt7tgyF3HKlQlMxSdjNAeI3o8myB9d62SClKnyizbWZM Dc+V3PbM1M1+C6Phynz31/vy9zYV+/Iyuy0GrhN16Cn2hfRBB3a5IQw/ajwFRROGjDOk h+3uziYH55V5iVEeZoLrygE3I+1XBxa61UeKf8/rysXtd4tFNBV/E53gp+oG98L+G+PI G50g== X-Gm-Message-State: AHPjjUgSPhLMlFjNgkflo+mUUgcmGZJpnBRXmK9x8sYfNlppSBiaFpIs 4ICzKb6GAdLb/ehleFGjawM7Bg== X-Google-Smtp-Source: AOwi7QAphAy2b0biylKOEm9dClveTWiyyS64CHS54TPunMIXQ1A7DTX3uQ1Xe75NWHUFgauLiUh+Dg== X-Received: by 10.84.129.193 with SMTP id b59mr3325130plb.43.1505940377146; Wed, 20 Sep 2017 13:46:17 -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, linux-fsdevel@vger.kernel.org, netdev@vger.kernel.org, kernel-hardening@lists.openwall.com Date: Wed, 20 Sep 2017 13:45:36 -0700 Message-Id: <1505940337-79069-31-git-send-email-keescook@chromium.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1505940337-79069-1-git-send-email-keescook@chromium.org> References: <1505940337-79069-1-git-send-email-keescook@chromium.org> Subject: [kernel-hardening] [PATCH v3 30/31] 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 d4e6442f9bbc..0ac45ba6685e 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c @@ -515,7 +515,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);