Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/816501/?format=api
{ "id": 816501, "url": "http://patchwork.ozlabs.org/api/patches/816501/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/1505940337-79069-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": "<1505940337-79069-19-git-send-email-keescook@chromium.org>", "list_archive_url": null, "date": "2017-09-20T20:45:24", "name": "[v3,18/31] 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/1505940337-79069-19-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/816501/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/816501/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=\"Ox1qkWJH\"; dkim-atps=neutral" ], "Received": [ "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xyBn93F3qz9s83\n\tfor <patchwork-incoming@ozlabs.org>;\n\tThu, 21 Sep 2017 06:54:21 +1000 (AEST)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1752159AbdITUxJ (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tWed, 20 Sep 2017 16:53:09 -0400", "from mail-pf0-f174.google.com ([209.85.192.174]:57031 \"EHLO\n\tmail-pf0-f174.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1752092AbdITUw7 (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Wed, 20 Sep 2017 16:52:59 -0400", "by mail-pf0-f174.google.com with SMTP id g65so2108939pfe.13\n\tfor <netdev@vger.kernel.org>; Wed, 20 Sep 2017 13:52: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\t133sm10278397pfy.2.2017.09.20.13.52.50\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tWed, 20 Sep 2017 13:52:52 -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=CXYChwRknSCs7CNYF3vt55npuxJ+mFEcectRpftsX+k=;\n\tb=Ox1qkWJHCDDvhDF2qFJICNHntgkb5UFIB1ItmTDC8fB/vmMpLpQQKAfQpxHmOwaSMs\n\tzAeU5gJrvRbH11lARg7B4aYwSyi+WMg9iG4djNvZpIKX1vvmHXQI+Dp6bg56n9p9+dWj\n\tUQOeM+P+GmT2Jb/W0ktxFxuPn7yLHqh0gNGUc=", "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=CXYChwRknSCs7CNYF3vt55npuxJ+mFEcectRpftsX+k=;\n\tb=Kz8aReE0AHJZMTtTZFXVMH7GGiTZfuYf2+4Xp6R4ttQXsLnZ8X3g0XT2r03o3GUzky\n\t5v+L+NdhpISJU2c4BEqbdqX+krbTIph1XDXbrquwZsn6oKGzWiPBqbxDSUaVWRCIgRXV\n\tROOuos1jZkwU6wDjpPZ7lt3ZP8khuJzRRABPs90B30K5rK4VR6ORC41+YpbUnt+oSX8R\n\tpERT89CrvB5THk2ylprW8zHwj4m4uUDD9KCe7RH/i5uGVCpP9GwTw0dRTSyYpTZwIq0K\n\t/sOLTWxw2D24BYg9nAK8Mb5NyJgQVrpRLTbvzVBlpmvmmCF3zEMMArfGWddlLWYNNlia\n\tyNbg==", "X-Gm-Message-State": "AHPjjUh/92kaoevMD7q7pJlrE1S9SUWtOXINrPiriU+Hsm7oZMaETyAP\n\tGBmL3ogjR8FQHEsqCcW2LQK+OQ==", "X-Google-Smtp-Source": "AOwi7QAqNQqFrIuTc2L/sXMwEanj7/7DWgD7cUTumvj6ZrVjFDk+jZ72o1cx/d7EwJjiofv3fkmvLQ==", "X-Received": "by 10.99.186.74 with SMTP id l10mr3503035pgu.355.1505940778988; \n\tWed, 20 Sep 2017 13:52: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\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-fsdevel@vger.kernel.org, linux-mm@kvack.org,\n\tkernel-hardening@lists.openwall.com", "Subject": "[PATCH v3 18/31] net: Define usercopy region in struct proto slab\n\tcache", "Date": "Wed, 20 Sep 2017 13:45:24 -0700", "Message-Id": "<1505940337-79069-19-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\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 03a362568357..13c2d1b48c86 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 9b7b6bbb2a23..832dfb03102e 100644\n--- a/net/core/sock.c\n+++ b/net/core/sock.c\n@@ -3165,8 +3165,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": [ "v3", "18/31" ] }