From patchwork Tue Jan 9 20:56:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 10153459 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 0E3DF60596 for ; Tue, 9 Jan 2018 21:06:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0555E201CB for ; Tue, 9 Jan 2018 21:06:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EE07D24B5B; Tue, 9 Jan 2018 21:06:03 +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 01A32201CB for ; Tue, 9 Jan 2018 21:06:02 +0000 (UTC) Received: (qmail 20272 invoked by uid 550); 9 Jan 2018 21:04:35 -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 20213 invoked from network); 9 Jan 2018 21:04:34 -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=aUPWZg7fE3ZoZUJC0ko6RXy8vIvUOJujorA8jrgE9XY4gr9tUR0B/4hxsnZEjpHaRH B3eEtcsDc3kGETYCKI2gnktkRuSz1DDJHAL9eqTs/UdB3W7xRoaALIjjhs8sxepEstJb 49hNvngB0nR7VjkAKeX9lGxHNvOxSXFFhQl3Q= 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=DUAvIB0RFzvOLAa7xUX5DhRhFEqoIWkdXqXomSx+wQr9W2LOmUKladitvJMdl3cbcm URTCUm9vHTGiWiTg6Frfl2UoEjpSFsTdpCzyIihvDybVWU8TQNecAVF8UZ7VEgcg0moi wgTL6NRIA//uZBTD0sFP7OxjUyj7ySX2Whwn7qjB0Ak6YQfJVxBVtBRWgbwmszo3rv1R K6+HgRyAt8Obmb+unZnDPQhYjxqaB6++6MV5I0WuH7/mRXAlmKBZ5cx4Dl2kmocMYAlu 0ZsQqRaH80TsMxss8b6R9Onc4w+3CyMvO0xZPp5g4fqhCETIl9g0SmaipX3y/CtBF9gT JGOg== X-Gm-Message-State: AKGB3mLgvFB/KRC+C36Y1TjFazbIubik4gxOCOb6AnDNrLqNe/PCpS1L Y53RnyEH/JP5lunG6UzvNE1NBg== X-Google-Smtp-Source: ACJfBosEXCJKBOEmi8mAdJHDHktPhbR5MlAFsaxnA4oiwrxBTJ4lKLYFV9M5HU7ezM57DLwcfmwXtg== X-Received: by 10.98.144.19 with SMTP id a19mr14614629pfe.139.1515531862447; Tue, 09 Jan 2018 13:04:22 -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: Tue, 9 Jan 2018 12:56:04 -0800 Message-Id: <1515531365-37423-36-git-send-email-keescook@chromium.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515531365-37423-1-git-send-email-keescook@chromium.org> References: <1515531365-37423-1-git-send-email-keescook@chromium.org> Subject: [kernel-hardening] [PATCH 35/36] 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);