Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/816514/?format=api
{ "id": 816514, "url": "http://patchwork.ozlabs.org/api/patches/816514/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/1505940337-79069-4-git-send-email-keescook@chromium.org/", "project": { "id": 7, "url": "http://patchwork.ozlabs.org/api/projects/7/?format=api", "name": "Linux network development", "link_name": "netdev", "list_id": "netdev.vger.kernel.org", "list_email": "netdev@vger.kernel.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<1505940337-79069-4-git-send-email-keescook@chromium.org>", "list_archive_url": null, "date": "2017-09-20T20:45:09", "name": "[v3,03/31] usercopy: Mark kmalloc caches as usercopy caches", "commit_ref": null, "pull_url": null, "state": "not-applicable", "archived": true, "hash": "a279efba656fcf0f0dbcc50c7986c6e3c264dac3", "submitter": { "id": 10641, "url": "http://patchwork.ozlabs.org/api/people/10641/?format=api", "name": "Kees Cook", "email": "keescook@chromium.org" }, "delegate": { "id": 34, "url": "http://patchwork.ozlabs.org/api/users/34/?format=api", "username": "davem", "first_name": "David", "last_name": "Miller", "email": "davem@davemloft.net" }, "mbox": "http://patchwork.ozlabs.org/project/netdev/patch/1505940337-79069-4-git-send-email-keescook@chromium.org/mbox/", "series": [ { "id": 4231, "url": "http://patchwork.ozlabs.org/api/series/4231/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/list/?series=4231", "date": "2017-09-20T20:45:22", "name": "Hardened usercopy whitelisting", "version": 3, "mbox": "http://patchwork.ozlabs.org/series/4231/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/816514/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/816514/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<netdev-owner@vger.kernel.org>", "X-Original-To": "patchwork-incoming@ozlabs.org", "Delivered-To": "patchwork-incoming@ozlabs.org", "Authentication-Results": [ "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netdev-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)", "ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"NUYVP68A\"; dkim-atps=neutral" ], "Received": [ "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xyByh5QcSz9s8J\n\tfor <patchwork-incoming@ozlabs.org>;\n\tThu, 21 Sep 2017 07:02:36 +1000 (AEST)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751810AbdITVCe (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tWed, 20 Sep 2017 17:02:34 -0400", "from mail-pg0-f43.google.com ([74.125.83.43]:48179 \"EHLO\n\tmail-pg0-f43.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1751715AbdITUp7 (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Wed, 20 Sep 2017 16:45:59 -0400", "by mail-pg0-f43.google.com with SMTP id v23so2333557pgc.5\n\tfor <netdev@vger.kernel.org>; Wed, 20 Sep 2017 13:45:59 -0700 (PDT)", "from www.outflux.net\n\t(173-164-112-133-Oregon.hfc.comcastbusiness.net. [173.164.112.133])\n\tby smtp.gmail.com with ESMTPSA id\n\te13sm9373191pgt.14.2017.09.20.13.45.53\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tWed, 20 Sep 2017 13:45:54 -0700 (PDT)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=chromium.org; s=google;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=mBQklQ4xqs4+wiyyaTCtSaQrrQ6cot0LKmSYvJBnT64=;\n\tb=NUYVP68ACXcBfoonMticqta35UeLW7yRnVv3BLKxNUjKEAdJn8p1x95BQPE0L4PU2E\n\tps6qjP9MHPrYfusQBRlTwTRcDxfl7r3WlCQ42cmAgq1QK1e3x07QsXJlf94D02aLKSwd\n\t9STrSN16bMU7Hm4opp8dGup9P0w09+N5OrVfM=", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=mBQklQ4xqs4+wiyyaTCtSaQrrQ6cot0LKmSYvJBnT64=;\n\tb=qRsH6/0/vqt8pNwkukWVAveZeJyAlfFO2krAUuKIK8YXDR4yHuR4B50KrjAe+fg7ul\n\tQwehEekAx4x4XTMO9bbNnulYdGSJXmQlPCod+GwLgjPXD9zSUel9h9z1Vb4bZmr6sIUH\n\tkW/kc4cvfp461m8v7NQihtP7CdgfGAqYcIt7EqWknHflbXY7f80J5PeRjSegLnWHoRz1\n\tbgGx3PYwML5ojV2m5tvaLyjXRcvsEwG5ebUMWsmGsj1jiIlPGYnTepNSC07qxHoyjfcu\n\tI2MuboRctALQVq0+xh1URp6oZwyPXHfQAawMmJ14WPviQjCyNYvsfkU62CsYKyP40rTm\n\thhog==", "X-Gm-Message-State": "AHPjjUjqStApb0tNPSx9Ivo8b2UgGjCHVcbEJycPMDPIA8lhCAFAqh9Z\n\t1u1jpR3VYJEc9nYIXfp8XQ+hwA==", "X-Google-Smtp-Source": "AOwi7QAzN1kvev9GohizVHROiZwonRAZQsB3jy2aiY874TAZEUAy5xOjgBwWasuXlh0wPA+oCM4/bQ==", "X-Received": "by 10.99.122.29 with SMTP id v29mr3387458pgc.434.1505940358671; \n\tWed, 20 Sep 2017 13:45:58 -0700 (PDT)", "From": "Kees Cook <keescook@chromium.org>", "To": "linux-kernel@vger.kernel.org", "Cc": "Kees Cook <keescook@chromium.org>, David Windsor <dave@nullcore.net>,\n\tChristoph Lameter <cl@linux.com>, Pekka Enberg <penberg@kernel.org>,\n\tDavid Rientjes <rientjes@google.com>,\n\tJoonsoo Kim <iamjoonsoo.kim@lge.com>,\n\tAndrew Morton <akpm@linux-foundation.org>, linux-mm@kvack.org,\n\tlinux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org,\n\tnetdev@vger.kernel.org, kernel-hardening@lists.openwall.com", "Subject": "[PATCH v3 03/31] usercopy: Mark kmalloc caches as usercopy caches", "Date": "Wed, 20 Sep 2017 13:45:09 -0700", "Message-Id": "<1505940337-79069-4-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>", "Sender": "netdev-owner@vger.kernel.org", "Precedence": "bulk", "List-ID": "<netdev.vger.kernel.org>", "X-Mailing-List": "netdev@vger.kernel.org" }, "content": "From: David Windsor <dave@nullcore.net>\n\nMark the kmalloc slab caches as entirely whitelisted. These caches\nare frequently used to fulfill kernel allocations that contain data\nto be copied to/from userspace. Internal-only uses are also common,\nbut are scattered in the kernel. For now, mark all the kmalloc caches\nas whitelisted.\n\nThis patch is modified from Brad Spengler/PaX Team's PAX_USERCOPY\nwhitelisting code in the last public patch of grsecurity/PaX based on my\nunderstanding of the code. Changes or omissions from the original code are\nmine and don't reflect the original grsecurity/PaX code.\n\nSigned-off-by: David Windsor <dave@nullcore.net>\n[kees: merged in moved kmalloc hunks, adjust commit log]\nCc: Christoph Lameter <cl@linux.com>\nCc: Pekka Enberg <penberg@kernel.org>\nCc: David Rientjes <rientjes@google.com>\nCc: Joonsoo Kim <iamjoonsoo.kim@lge.com>\nCc: Andrew Morton <akpm@linux-foundation.org>\nCc: linux-mm@kvack.org\nCc: linux-xfs@vger.kernel.org\nSigned-off-by: Kees Cook <keescook@chromium.org>\n---\n mm/slab.c | 3 ++-\n mm/slab.h | 3 ++-\n mm/slab_common.c | 10 ++++++----\n 3 files changed, 10 insertions(+), 6 deletions(-)", "diff": "diff --git a/mm/slab.c b/mm/slab.c\nindex df268999cf02..9af16f675927 100644\n--- a/mm/slab.c\n+++ b/mm/slab.c\n@@ -1291,7 +1291,8 @@ void __init kmem_cache_init(void)\n \t */\n \tkmalloc_caches[INDEX_NODE] = create_kmalloc_cache(\n \t\t\t\tkmalloc_info[INDEX_NODE].name,\n-\t\t\t\tkmalloc_size(INDEX_NODE), ARCH_KMALLOC_FLAGS);\n+\t\t\t\tkmalloc_size(INDEX_NODE), ARCH_KMALLOC_FLAGS,\n+\t\t\t\t0, kmalloc_size(INDEX_NODE));\n \tslab_state = PARTIAL_NODE;\n \tsetup_kmalloc_cache_index_table();\n \ndiff --git a/mm/slab.h b/mm/slab.h\nindex 044755ff9632..2e0fe357d777 100644\n--- a/mm/slab.h\n+++ b/mm/slab.h\n@@ -97,7 +97,8 @@ struct kmem_cache *kmalloc_slab(size_t, gfp_t);\n extern int __kmem_cache_create(struct kmem_cache *, unsigned long flags);\n \n extern struct kmem_cache *create_kmalloc_cache(const char *name, size_t size,\n-\t\t\tunsigned long flags);\n+\t\t\tunsigned long flags, size_t useroffset,\n+\t\t\tsize_t usersize);\n extern void create_boot_cache(struct kmem_cache *, const char *name,\n \t\t\tsize_t size, unsigned long flags, size_t useroffset,\n \t\t\tsize_t usersize);\ndiff --git a/mm/slab_common.c b/mm/slab_common.c\nindex 36408f5f2a34..d4e6442f9bbc 100644\n--- a/mm/slab_common.c\n+++ b/mm/slab_common.c\n@@ -920,14 +920,15 @@ void __init create_boot_cache(struct kmem_cache *s, const char *name, size_t siz\n }\n \n struct kmem_cache *__init create_kmalloc_cache(const char *name, size_t size,\n-\t\t\t\tunsigned long flags)\n+\t\t\t\tunsigned long flags, size_t useroffset,\n+\t\t\t\tsize_t usersize)\n {\n \tstruct kmem_cache *s = kmem_cache_zalloc(kmem_cache, GFP_NOWAIT);\n \n \tif (!s)\n \t\tpanic(\"Out of memory when creating slab %s\\n\", name);\n \n-\tcreate_boot_cache(s, name, size, flags, 0, size);\n+\tcreate_boot_cache(s, name, size, flags, useroffset, usersize);\n \tlist_add(&s->list, &slab_caches);\n \tmemcg_link_cache(s);\n \ts->refcount = 1;\n@@ -1081,7 +1082,8 @@ void __init setup_kmalloc_cache_index_table(void)\n static void __init new_kmalloc_cache(int idx, unsigned long flags)\n {\n \tkmalloc_caches[idx] = create_kmalloc_cache(kmalloc_info[idx].name,\n-\t\t\t\t\tkmalloc_info[idx].size, flags);\n+\t\t\t\t\tkmalloc_info[idx].size, flags, 0,\n+\t\t\t\t\tkmalloc_info[idx].size);\n }\n \n /*\n@@ -1122,7 +1124,7 @@ void __init create_kmalloc_caches(unsigned long flags)\n \n \t\t\tBUG_ON(!n);\n \t\t\tkmalloc_dma_caches[i] = create_kmalloc_cache(n,\n-\t\t\t\tsize, SLAB_CACHE_DMA | flags);\n+\t\t\t\tsize, SLAB_CACHE_DMA | flags, 0, 0);\n \t\t}\n \t}\n #endif\n", "prefixes": [ "v3", "03/31" ] }