From patchwork Mon Jun 19 23:36:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 9798115 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 138FE60381 for ; Mon, 19 Jun 2017 23:44:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 103AA26C9B for ; Mon, 19 Jun 2017 23:44:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 03D5327FA5; Mon, 19 Jun 2017 23:44:25 +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 AC79A26C9B for ; Mon, 19 Jun 2017 23:44:22 +0000 (UTC) Received: (qmail 6102 invoked by uid 550); 19 Jun 2017 23:43: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 5442 invoked from network); 19 Jun 2017 23:43:30 -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=KUHz8IVTVtNDDxfi884QHgHmobQ09rP5wV3hIREbiWU=; b=FbtbLUJwAOYHLLcu/UNINmC4nADvGbaQQWQRJAQ2cfd5aXnTm5te8cQ6HoqrZQXlDc D+S/LbpGo84Q6jVpsUWBoqPXjdTp0/jm7QdfhiSudSJE5yg7FOWuzJ5Q8bwaYDMd6WQR XHH69R5mBCtqNdFG4EXg9xensOrq5WC1bmBms= 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=KUHz8IVTVtNDDxfi884QHgHmobQ09rP5wV3hIREbiWU=; b=e8KdIv16XpGepGQVPr2I0hwpK6By4WFUxlP66ZgDAdBJtK1YRKdc54+GX4WEr9lDUE aFCFeOF5cicQ4S1doUq5dBlVmKx2/+M8At1Rt/TRoin/xtPIfsukaf4+yBFcKox0CYX8 WlxSFBd/YgTFWscyxSmt+BulCKIpcv1WHGppCIWv9FZs3BE2upYhamXWV4tjj8mgjOOO RIdPIKmkT9+Ce7dv8I2ck9ADKhNl0Qz7/UJTyWJ6+FIxn3mPBU6POUjlQEiHSfwWIU0T N8idpSL2jaIIOnCaDLJTctjfRdIx7VHhvgzMTxhWCXS89pT+85pPy9DVCcFuLtfhGMMC ZLwA== X-Gm-Message-State: AKS2vOyhoZ04hOMXTE4R6HRuzvhgudCEVBI57ZLYPHc3OTTsxlNMeG8U pW8Yvo63gzO26kaBwS6RIQ== X-Received: by 10.99.124.65 with SMTP id l1mr28183415pgn.279.1497915798952; Mon, 19 Jun 2017 16:43:18 -0700 (PDT) From: Kees Cook To: kernel-hardening@lists.openwall.com Cc: Kees Cook , David Windsor , linux-mm@kvack.org, linux-kernel@vger.kernel.org Date: Mon, 19 Jun 2017 16:36:35 -0700 Message-Id: <1497915397-93805-22-git-send-email-keescook@chromium.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1497915397-93805-1-git-send-email-keescook@chromium.org> References: <1497915397-93805-1-git-send-email-keescook@chromium.org> Subject: [kernel-hardening] [PATCH 21/23] 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. Signed-off-by: Kees Cook Cc: David Windsor --- 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 685321a0d355..2365dd21623d 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c @@ -512,7 +512,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);