{"id":806595,"url":"http://patchwork.ozlabs.org/api/1.0/patches/806595/?format=json","project":{"id":7,"url":"http://patchwork.ozlabs.org/api/1.0/projects/7/?format=json","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},"msgid":"<20170828141124.14143.92130.stgit@john-Precision-Tower-5810>","date":"2017-08-28T14:11:24","name":"[net-next,5/9] bpf: more SK_SKB selftests","commit_ref":null,"pull_url":null,"state":"accepted","archived":true,"hash":"52c17c8cbee4e6db5a8a466865dd96d396b02dcd","submitter":{"id":20028,"url":"http://patchwork.ozlabs.org/api/1.0/people/20028/?format=json","name":"John Fastabend","email":"john.fastabend@gmail.com"},"delegate":{"id":34,"url":"http://patchwork.ozlabs.org/api/1.0/users/34/?format=json","username":"davem","first_name":"David","last_name":"Miller","email":"davem@davemloft.net"},"mbox":"http://patchwork.ozlabs.org/project/netdev/patch/20170828141124.14143.92130.stgit@john-Precision-Tower-5810/mbox/","series":[{"id":179,"url":"http://patchwork.ozlabs.org/api/1.0/series/179/?format=json","date":"2017-08-28T14:09:45","name":"sockmap UAPI updates and fixes","version":1,"mbox":"http://patchwork.ozlabs.org/series/179/mbox/"}],"check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/806595/checks/","tags":{},"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 (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"e2PjBUOR\"; dkim-atps=neutral"],"Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xgtx86rwRz9s1h\n\tfor <patchwork-incoming@ozlabs.org>;\n\tTue, 29 Aug 2017 00:11:40 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751347AbdH1OLj (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tMon, 28 Aug 2017 10:11:39 -0400","from mail-pf0-f196.google.com ([209.85.192.196]:34142 \"EHLO\n\tmail-pf0-f196.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1751232AbdH1OLh (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Mon, 28 Aug 2017 10:11:37 -0400","by mail-pf0-f196.google.com with SMTP id p69so400817pfk.1\n\tfor <netdev@vger.kernel.org>; Mon, 28 Aug 2017 07:11:37 -0700 (PDT)","from [127.0.1.1] ([72.168.144.1]) by smtp.gmail.com with ESMTPSA id\n\tg2sm967161pgu.87.2017.08.28.07.11.30\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tMon, 28 Aug 2017 07:11:36 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=gmail.com; s=20161025;\n\th=subject:from:to:cc:date:message-id:in-reply-to:references\n\t:user-agent:mime-version:content-transfer-encoding;\n\tbh=HiznC15zi0RSCQE8BSyUDsv9e2GtTFmhSRZz3S5udiw=;\n\tb=e2PjBUORAAKv1E6Dfr93ZyapOHwnRTKyqzQGE0fjUhowusGLFR5H2dYqvyY2LCbMa3\n\to2xSoea51/MdmJlyPgt80ZINLGGFtnnk9MXEMW2msJMKzpO3LqKoWEx3KnE3xv7zpCaN\n\tE4KGEVas/HP3V/d9IvfgSalkEI8/hsqbKb6UCMyxwSVk/tou/s65m5V6luMouKxJoYrn\n\t0BR/WXPhVxt+BQeNLiB2DeulK7+44YxEaImGxcGKL4EAKYCi6nbo+MIGqP7GxfvCVLlk\n\tTSG6jJeYSo0ge45Sqi5Ks7VTYmAjVraJCg4h42WHag4mBx9Xeo9J7s69e4m5nMj+kotB\n\tzk0A==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:subject:from:to:cc:date:message-id:in-reply-to\n\t:references:user-agent:mime-version:content-transfer-encoding;\n\tbh=HiznC15zi0RSCQE8BSyUDsv9e2GtTFmhSRZz3S5udiw=;\n\tb=rMZFAHTsPovAzSCRnrDYEZX4NdoD7hzO4ZWW8QU5kMqMPnH/acPrrV+wEDZ+OMJA63\n\t9Fn+JReX/jBP1wI24EOFGrhuWnfGmOxfFkrfdk7W9CAA6wYWRDfp2Tb8P/W46eI0GvmE\n\t+zea8fvCPpFy6U9kKpIHpgdZlsPu2YnGHGpRsjVeZ32ZT2xI9cIFKRoODI6ypxNncp0J\n\tELxU9W1vzIKQHb/nE7occJj7QWXI18dF0kVvmIaiouchdD5F8tovkHHSfEmm/AaMbAy0\n\t2WCH+lwLSaWJwMWqK3/9ps9irx39x0Wri3AR8on6swAdVmGgR9DA4jRXWl7cpiER1GyO\n\ttPQQ==","X-Gm-Message-State":"AHYfb5iG6jf+bRKHw3HFxyvqvpKpe3IFP0e76VzBaBO7gvB0foMBSmWE\n\tDcc+hSMM1QMcP2WF","X-Received":"by 10.99.114.91 with SMTP id c27mr643220pgn.345.1503929497132;\n\tMon, 28 Aug 2017 07:11:37 -0700 (PDT)","Subject":"[net-next PATCH 5/9] bpf: more SK_SKB selftests","From":"John Fastabend <john.fastabend@gmail.com>","To":"ast@kernel.org, daniel@iogearbox.net, davem@davemloft.net","Cc":"netdev@vger.kernel.org, john.fastabend@gmail.com","Date":"Mon, 28 Aug 2017 07:11:24 -0700","Message-ID":"<20170828141124.14143.92130.stgit@john-Precision-Tower-5810>","In-Reply-To":"<20170828140850.14143.83953.stgit@john-Precision-Tower-5810>","References":"<20170828140850.14143.83953.stgit@john-Precision-Tower-5810>","User-Agent":"StGit/0.17.1-dirty","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"7bit","Sender":"netdev-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<netdev.vger.kernel.org>","X-Mailing-List":"netdev@vger.kernel.org"},"content":"Tests packet read/writes and additional skb fields.\n\nSigned-off-by: John Fastabend <john.fastabend@gmail.com>\n---\n tools/testing/selftests/bpf/test_verifier.c |   98 +++++++++++++++++++++++++++\n 1 file changed, 98 insertions(+)","diff":"diff --git a/tools/testing/selftests/bpf/test_verifier.c b/tools/testing/selftests/bpf/test_verifier.c\nindex 353d170..8eb0995 100644\n--- a/tools/testing/selftests/bpf/test_verifier.c\n+++ b/tools/testing/selftests/bpf/test_verifier.c\n@@ -1119,6 +1119,104 @@ struct test_val {\n \t\t.prog_type = BPF_PROG_TYPE_SK_SKB,\n \t},\n \t{\n+\t\t\"invalid access of tc_classid for SK_SKB\",\n+\t\t.insns = {\n+\t\t\tBPF_LDX_MEM(BPF_W, BPF_REG_0, BPF_REG_1,\n+\t\t\t\t    offsetof(struct __sk_buff, tc_classid)),\n+\t\t\tBPF_EXIT_INSN(),\n+\t\t},\n+\t\t.result = REJECT,\n+\t\t.prog_type = BPF_PROG_TYPE_SK_SKB,\n+\t\t.errstr = \"invalid bpf_context access\",\n+\t},\n+\t{\n+\t\t\"check skb->mark is writeable by SK_SKB\",\n+\t\t.insns = {\n+\t\t\tBPF_MOV64_IMM(BPF_REG_0, 0),\n+\t\t\tBPF_STX_MEM(BPF_W, BPF_REG_1, BPF_REG_0,\n+\t\t\t\t    offsetof(struct __sk_buff, mark)),\n+\t\t\tBPF_EXIT_INSN(),\n+\t\t},\n+\t\t.result = ACCEPT,\n+\t\t.prog_type = BPF_PROG_TYPE_SK_SKB,\n+\t},\n+\t{\n+\t\t\"check skb->tc_index is writeable by SK_SKB\",\n+\t\t.insns = {\n+\t\t\tBPF_MOV64_IMM(BPF_REG_0, 0),\n+\t\t\tBPF_STX_MEM(BPF_W, BPF_REG_1, BPF_REG_0,\n+\t\t\t\t    offsetof(struct __sk_buff, tc_index)),\n+\t\t\tBPF_EXIT_INSN(),\n+\t\t},\n+\t\t.result = ACCEPT,\n+\t\t.prog_type = BPF_PROG_TYPE_SK_SKB,\n+\t},\n+\t{\n+\t\t\"check skb->priority is writeable by SK_SKB\",\n+\t\t.insns = {\n+\t\t\tBPF_MOV64_IMM(BPF_REG_0, 0),\n+\t\t\tBPF_STX_MEM(BPF_W, BPF_REG_1, BPF_REG_0,\n+\t\t\t\t    offsetof(struct __sk_buff, priority)),\n+\t\t\tBPF_EXIT_INSN(),\n+\t\t},\n+\t\t.result = ACCEPT,\n+\t\t.prog_type = BPF_PROG_TYPE_SK_SKB,\n+\t},\n+\t{\n+\t\t\"direct packet read for SK_SKB\",\n+\t\t.insns = {\n+\t\t\tBPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1,\n+\t\t\t\t    offsetof(struct __sk_buff, data)),\n+\t\t\tBPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1,\n+\t\t\t\t    offsetof(struct __sk_buff, data_end)),\n+\t\t\tBPF_MOV64_REG(BPF_REG_0, BPF_REG_2),\n+\t\t\tBPF_ALU64_IMM(BPF_ADD, BPF_REG_0, 8),\n+\t\t\tBPF_JMP_REG(BPF_JGT, BPF_REG_0, BPF_REG_3, 1),\n+\t\t\tBPF_LDX_MEM(BPF_B, BPF_REG_0, BPF_REG_2, 0),\n+\t\t\tBPF_MOV64_IMM(BPF_REG_0, 0),\n+\t\t\tBPF_EXIT_INSN(),\n+\t\t},\n+\t\t.result = ACCEPT,\n+\t\t.prog_type = BPF_PROG_TYPE_SK_SKB,\n+\t},\n+\t{\n+\t\t\"direct packet write for SK_SKB\",\n+\t\t.insns = {\n+\t\t\tBPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1,\n+\t\t\t\t    offsetof(struct __sk_buff, data)),\n+\t\t\tBPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1,\n+\t\t\t\t    offsetof(struct __sk_buff, data_end)),\n+\t\t\tBPF_MOV64_REG(BPF_REG_0, BPF_REG_2),\n+\t\t\tBPF_ALU64_IMM(BPF_ADD, BPF_REG_0, 8),\n+\t\t\tBPF_JMP_REG(BPF_JGT, BPF_REG_0, BPF_REG_3, 1),\n+\t\t\tBPF_STX_MEM(BPF_B, BPF_REG_2, BPF_REG_2, 0),\n+\t\t\tBPF_MOV64_IMM(BPF_REG_0, 0),\n+\t\t\tBPF_EXIT_INSN(),\n+\t\t},\n+\t\t.result = ACCEPT,\n+\t\t.prog_type = BPF_PROG_TYPE_SK_SKB,\n+\t},\n+\t{\n+\t\t\"overlapping checks for direct packet access SK_SKB\",\n+\t\t.insns = {\n+\t\t\tBPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1,\n+\t\t\t\t    offsetof(struct __sk_buff, data)),\n+\t\t\tBPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1,\n+\t\t\t\t    offsetof(struct __sk_buff, data_end)),\n+\t\t\tBPF_MOV64_REG(BPF_REG_0, BPF_REG_2),\n+\t\t\tBPF_ALU64_IMM(BPF_ADD, BPF_REG_0, 8),\n+\t\t\tBPF_JMP_REG(BPF_JGT, BPF_REG_0, BPF_REG_3, 4),\n+\t\t\tBPF_MOV64_REG(BPF_REG_1, BPF_REG_2),\n+\t\t\tBPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 6),\n+\t\t\tBPF_JMP_REG(BPF_JGT, BPF_REG_1, BPF_REG_3, 1),\n+\t\t\tBPF_LDX_MEM(BPF_H, BPF_REG_0, BPF_REG_2, 6),\n+\t\t\tBPF_MOV64_IMM(BPF_REG_0, 0),\n+\t\t\tBPF_EXIT_INSN(),\n+\t\t},\n+\t\t.result = ACCEPT,\n+\t\t.prog_type = BPF_PROG_TYPE_SK_SKB,\n+\t},\n+\t{\n \t\t\"check skb->mark is not writeable by sockets\",\n \t\t.insns = {\n \t\t\tBPF_STX_MEM(BPF_W, BPF_REG_1, BPF_REG_1,\n","prefixes":["net-next","5/9"]}