Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/806795/?format=api
{ "id": 806795, "url": "http://patchwork.ozlabs.org/api/patches/806795/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/1503956111-36652-19-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": "<1503956111-36652-19-git-send-email-keescook@chromium.org>", "list_archive_url": null, "date": "2017-08-28T21:34:59", "name": "[v2,18/30] net: Define usercopy region in struct proto slab cache", "commit_ref": null, "pull_url": null, "state": "not-applicable", "archived": true, "hash": "57f072e8284cd1cf7388ecc2f103cb7f4a54ea23", "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/1503956111-36652-19-git-send-email-keescook@chromium.org/mbox/", "series": [ { "id": 266, "url": "http://patchwork.ozlabs.org/api/series/266/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/list/?series=266", "date": "2017-08-28T21:35:01", "name": null, "version": 2, "mbox": "http://patchwork.ozlabs.org/series/266/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/806795/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/806795/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=\"KkY9e0sS\"; dkim-atps=neutral" ], "Received": [ "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xh5DQ2nlMz9s8w\n\tfor <patchwork-incoming@ozlabs.org>;\n\tTue, 29 Aug 2017 07:55:34 +1000 (AEST)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751271AbdH1Vxx (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tMon, 28 Aug 2017 17:53:53 -0400", "from mail-pf0-f181.google.com ([209.85.192.181]:34828 \"EHLO\n\tmail-pf0-f181.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1751182AbdH1Vxw (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Mon, 28 Aug 2017 17:53:52 -0400", "by mail-pf0-f181.google.com with SMTP id g13so4797276pfm.2\n\tfor <netdev@vger.kernel.org>; Mon, 28 Aug 2017 14:53:52 -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\td63sm2150007pfc.40.2017.08.28.14.53.50\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tMon, 28 Aug 2017 14:53:50 -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=vKfuE39oRowkSMb/NiZvwkS87PtPwcvGBmZDLcIcfdE=;\n\tb=KkY9e0sSqOPeuKIJOJa++6VzpJIYNj7lFK1f6KiPlzqLsmvsmJ2/cDCxOHdyBA6gNp\n\tLaRuK/b2/N/pmuooAtel6rO3qAt6daKTJvXimqs4h9Suq7V9IfqJlP7KGTywJr8rbmzh\n\tBNgMfJ6v6h1Gpoe6s4SlIokThw8439OM/Gn6w=", "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=vKfuE39oRowkSMb/NiZvwkS87PtPwcvGBmZDLcIcfdE=;\n\tb=GZAT9l/Tj2oaCG5ddmHQRGnMXZmZiZPwBQXrWr9Q/2AFlpiF1TNlNYOR1awvTcSPSF\n\t5zX0n2vsWGlugOHKmAb9sryY2CrrNVceUz35uJJ78zk8ggmmvBjTd0E5i4HhQULu7vk3\n\t1LmMY6DVdCxjL0aavB7jhDrM7a/lZYj2o229hG+wWtfaq2MhPIe3NEcWrdlsiTelGYRa\n\tq4YHGVBrr+vWYAOs6G/m55x+cXdmk/N0qxef8YsKoHkzZLd3App4RohRPEd1Fv8WE33Q\n\tPLN2XRBNUvFeSxyrJM3NUgaXWmTagpGchpZUlxq4cfqMhFGrUjyeAQ7ZN/K3NNKO9Az8\n\t+kxw==", "X-Gm-Message-State": "AHYfb5hyJOgma++iNSOLGjObjuC8lcyhrlDSKTxFhH2MhREUFxYwVjrj\n\te8nJlNxLfhxkfPrj", "X-Received": "by 10.99.6.68 with SMTP id 65mr1909146pgg.328.1503957231686;\n\tMon, 28 Aug 2017 14:53:51 -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\t\"David S. Miller\" <davem@davemloft.net>,\n\tEric Dumazet <edumazet@google.com>, Paolo Abeni <pabeni@redhat.com>,\n\tDavid Howells <dhowells@redhat.com>, netdev@vger.kernel.org,\n\tlinux-mm@kvack.org, kernel-hardening@lists.openwall.com", "Subject": "[PATCH v2 18/30] net: Define usercopy region in struct proto slab\n\tcache", "Date": "Mon, 28 Aug 2017 14:34:59 -0700", "Message-Id": "<1503956111-36652-19-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>", "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\nIn support of usercopy hardening, this patch defines a region in the\nstruct proto slab cache in which userspace copy operations are allowed.\nSome protocols need to copy objects to/from userspace, and they can\ndeclare the region via their proto structure with the new usersize and\nuseroffset fields. Initially, if no region is specified (usersize ==\n0), the entire field is marked as whitelisted. This allows protocols\nto be whitelisted in subsequent patches. Once all protocols have been\nannotated, the full-whitelist default can be removed.\n\nThis region is known as the slab cache's usercopy region. Slab caches can\nnow check that each copy operation involving cache-managed memory falls\nentirely within the slab's usercopy region.\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: adjust commit log, split off per-proto patches]\n[kees: add logic for by-default full-whitelist]\nCc: \"David S. Miller\" <davem@davemloft.net>\nCc: Eric Dumazet <edumazet@google.com>\nCc: Paolo Abeni <pabeni@redhat.com>\nCc: David Howells <dhowells@redhat.com>\nCc: netdev@vger.kernel.org\nSigned-off-by: Kees Cook <keescook@chromium.org>\n---\n include/net/sock.h | 2 ++\n net/core/sock.c | 6 +++++-\n 2 files changed, 7 insertions(+), 1 deletion(-)", "diff": "diff --git a/include/net/sock.h b/include/net/sock.h\nindex 7c0632c7e870..170d5b2dbcb6 100644\n--- a/include/net/sock.h\n+++ b/include/net/sock.h\n@@ -1106,6 +1106,8 @@ struct proto {\n \tstruct kmem_cache\t*slab;\n \tunsigned int\t\tobj_size;\n \tint\t\t\tslab_flags;\n+\tsize_t\t\t\tuseroffset;\t/* Usercopy region offset */\n+\tsize_t\t\t\tusersize;\t/* Usercopy region size */\n \n \tstruct percpu_counter\t*orphan_count;\n \ndiff --git a/net/core/sock.c b/net/core/sock.c\nindex ac2a404c73eb..02dab98ca3e3 100644\n--- a/net/core/sock.c\n+++ b/net/core/sock.c\n@@ -3109,8 +3109,12 @@ static int req_prot_init(const struct proto *prot)\n int proto_register(struct proto *prot, int alloc_slab)\n {\n \tif (alloc_slab) {\n-\t\tprot->slab = kmem_cache_create(prot->name, prot->obj_size, 0,\n+\t\tprot->slab = kmem_cache_create_usercopy(prot->name,\n+\t\t\t\t\tprot->obj_size, 0,\n \t\t\t\t\tSLAB_HWCACHE_ALIGN | prot->slab_flags,\n+\t\t\t\t\tprot->usersize ? prot->useroffset : 0,\n+\t\t\t\t\tprot->usersize ? prot->usersize\n+\t\t\t\t\t\t : prot->obj_size,\n \t\t\t\t\tNULL);\n \n \t\tif (prot->slab == NULL) {\n", "prefixes": [ "v2", "18/30" ] }