{"id":833132,"url":"http://patchwork.ozlabs.org/api/1.2/patches/833132/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/patch/d8fa1fc37a2c8b39eee142c5dd0e6de36a58493d.1509576758.git.daniel@iogearbox.net/","project":{"id":7,"url":"http://patchwork.ozlabs.org/api/1.2/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,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<d8fa1fc37a2c8b39eee142c5dd0e6de36a58493d.1509576758.git.daniel@iogearbox.net>","list_archive_url":null,"date":"2017-11-01T22:58:09","name":"[net-next,1/3] bpf: minor cleanups after merge","commit_ref":null,"pull_url":null,"state":"accepted","archived":true,"hash":"f636593759642271321abfd0d62ccd938755e111","submitter":{"id":65705,"url":"http://patchwork.ozlabs.org/api/1.2/people/65705/?format=json","name":"Daniel Borkmann","email":"daniel@iogearbox.net"},"delegate":{"id":34,"url":"http://patchwork.ozlabs.org/api/1.2/users/34/?format=json","username":"davem","first_name":"David","last_name":"Miller","email":"davem@davemloft.net"},"mbox":"http://patchwork.ozlabs.org/project/netdev/patch/d8fa1fc37a2c8b39eee142c5dd0e6de36a58493d.1509576758.git.daniel@iogearbox.net/mbox/","series":[{"id":11406,"url":"http://patchwork.ozlabs.org/api/1.2/series/11406/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/list/?series=11406","date":"2017-11-01T22:58:09","name":"BPF range marking improvements for meta data","version":1,"mbox":"http://patchwork.ozlabs.org/series/11406/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/833132/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/833132/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>)","Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3yS3Y26sYnz9t34\n\tfor <patchwork-incoming@ozlabs.org>;\n\tThu,  2 Nov 2017 09:58:30 +1100 (AEDT)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S933572AbdKAW62 (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tWed, 1 Nov 2017 18:58:28 -0400","from www62.your-server.de ([213.133.104.62]:55614 \"EHLO\n\twww62.your-server.de\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1753175AbdKAW60 (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Wed, 1 Nov 2017 18:58:26 -0400","from [194.230.159.142] (helo=localhost)\n\tby www62.your-server.de with esmtpsa\n\t(TLSv1.2:DHE-RSA-AES128-GCM-SHA256:128) (Exim 4.85_2)\n\t(envelope-from <daniel@iogearbox.net>)\n\tid 1eA1xp-0005By-5Y; Wed, 01 Nov 2017 23:58:25 +0100"],"From":"Daniel Borkmann <daniel@iogearbox.net>","To":"davem@davemloft.net","Cc":"alexei.starovoitov@gmail.com, john.r.fastabend@gmail.com,\n\tnetdev@vger.kernel.org, Daniel Borkmann <daniel@iogearbox.net>","Subject":"[PATCH net-next 1/3] bpf: minor cleanups after merge","Date":"Wed,  1 Nov 2017 23:58:09 +0100","Message-Id":"<d8fa1fc37a2c8b39eee142c5dd0e6de36a58493d.1509576758.git.daniel@iogearbox.net>","X-Mailer":"git-send-email 1.9.3","In-Reply-To":["<cover.1509576758.git.daniel@iogearbox.net>","<cover.1509576758.git.daniel@iogearbox.net>"],"References":["<cover.1509576758.git.daniel@iogearbox.net>","<cover.1509576758.git.daniel@iogearbox.net>"],"X-Authenticated-Sender":"daniel@iogearbox.net","X-Virus-Scanned":"Clear (ClamAV 0.99.2/24008/Wed Nov  1 21:07:58 2017)","Sender":"netdev-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<netdev.vger.kernel.org>","X-Mailing-List":"netdev@vger.kernel.org"},"content":"Two minor cleanups after Dave's recent merge in f8ddadc4db6c\n(\"Merge git://git.kernel.org...\") of net into net-next in\norder to get the code in line with what was done originally\nin the net tree: i) use max() instead of max_t() since both\nranges are u16, ii) don't split the direct access test cases\nin the middle with bpf_exit test cases from 390ee7e29fc\n(\"bpf: enforce return code for cgroup-bpf programs\").\n\nSigned-off-by: Daniel Borkmann <daniel@iogearbox.net>\nAcked-by: Alexei Starovoitov <ast@kernel.org>\nAcked-by: John Fastabend <john.fastabend@gmail.com>\n---\n kernel/bpf/verifier.c                       |   2 +-\n tools/testing/selftests/bpf/test_verifier.c | 144 ++++++++++++++--------------\n 2 files changed, 73 insertions(+), 73 deletions(-)","diff":"diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c\nindex 2bb6d6a..2cc3e94 100644\n--- a/kernel/bpf/verifier.c\n+++ b/kernel/bpf/verifier.c\n@@ -2532,7 +2532,7 @@ static void find_good_pkt_pointers(struct bpf_verifier_state *state,\n \t\t\tcontinue;\n \t\treg = &state->stack[i].spilled_ptr;\n \t\tif (reg->type == type && reg->id == dst_reg->id)\n-\t\t\treg->range = max_t(u16, reg->range, new_range);\n+\t\t\treg->range = max(reg->range, new_range);\n \t}\n }\n \ndiff --git a/tools/testing/selftests/bpf/test_verifier.c b/tools/testing/selftests/bpf/test_verifier.c\nindex 1b93941..3b38a3d 100644\n--- a/tools/testing/selftests/bpf/test_verifier.c\n+++ b/tools/testing/selftests/bpf/test_verifier.c\n@@ -7250,78 +7250,6 @@ struct test_val {\n \t\t.prog_type = BPF_PROG_TYPE_XDP,\n \t},\n \t{\n-\t\t\"bpf_exit with invalid return code. test1\",\n-\t\t.insns = {\n-\t\t\tBPF_LDX_MEM(BPF_W, BPF_REG_0, BPF_REG_1, 0),\n-\t\t\tBPF_EXIT_INSN(),\n-\t\t},\n-\t\t.errstr = \"R0 has value (0x0; 0xffffffff)\",\n-\t\t.result = REJECT,\n-\t\t.prog_type = BPF_PROG_TYPE_CGROUP_SOCK,\n-\t},\n-\t{\n-\t\t\"bpf_exit with invalid return code. test2\",\n-\t\t.insns = {\n-\t\t\tBPF_LDX_MEM(BPF_W, BPF_REG_0, BPF_REG_1, 0),\n-\t\t\tBPF_ALU64_IMM(BPF_AND, BPF_REG_0, 1),\n-\t\t\tBPF_EXIT_INSN(),\n-\t\t},\n-\t\t.result = ACCEPT,\n-\t\t.prog_type = BPF_PROG_TYPE_CGROUP_SOCK,\n-\t},\n-\t{\n-\t\t\"bpf_exit with invalid return code. test3\",\n-\t\t.insns = {\n-\t\t\tBPF_LDX_MEM(BPF_W, BPF_REG_0, BPF_REG_1, 0),\n-\t\t\tBPF_ALU64_IMM(BPF_AND, BPF_REG_0, 3),\n-\t\t\tBPF_EXIT_INSN(),\n-\t\t},\n-\t\t.errstr = \"R0 has value (0x0; 0x3)\",\n-\t\t.result = REJECT,\n-\t\t.prog_type = BPF_PROG_TYPE_CGROUP_SOCK,\n-\t},\n-\t{\n-\t\t\"bpf_exit with invalid return code. test4\",\n-\t\t.insns = {\n-\t\t\tBPF_MOV64_IMM(BPF_REG_0, 1),\n-\t\t\tBPF_EXIT_INSN(),\n-\t\t},\n-\t\t.result = ACCEPT,\n-\t\t.prog_type = BPF_PROG_TYPE_CGROUP_SOCK,\n-\t},\n-\t{\n-\t\t\"bpf_exit with invalid return code. test5\",\n-\t\t.insns = {\n-\t\t\tBPF_MOV64_IMM(BPF_REG_0, 2),\n-\t\t\tBPF_EXIT_INSN(),\n-\t\t},\n-\t\t.errstr = \"R0 has value (0x2; 0x0)\",\n-\t\t.result = REJECT,\n-\t\t.prog_type = BPF_PROG_TYPE_CGROUP_SOCK,\n-\t},\n-\t{\n-\t\t\"bpf_exit with invalid return code. test6\",\n-\t\t.insns = {\n-\t\t\tBPF_MOV64_REG(BPF_REG_0, BPF_REG_1),\n-\t\t\tBPF_EXIT_INSN(),\n-\t\t},\n-\t\t.errstr = \"R0 is not a known value (ctx)\",\n-\t\t.result = REJECT,\n-\t\t.prog_type = BPF_PROG_TYPE_CGROUP_SOCK,\n-\t},\n-\t{\n-\t\t\"bpf_exit with invalid return code. test7\",\n-\t\t.insns = {\n-\t\t\tBPF_LDX_MEM(BPF_W, BPF_REG_0, BPF_REG_1, 0),\n-\t\t\tBPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, 4),\n-\t\t\tBPF_ALU64_REG(BPF_MUL, BPF_REG_0, BPF_REG_2),\n-\t\t\tBPF_EXIT_INSN(),\n-\t\t},\n-\t\t.errstr = \"R0 has unknown scalar value\",\n-\t\t.result = REJECT,\n-\t\t.prog_type = BPF_PROG_TYPE_CGROUP_SOCK,\n-\t},\n-\t{\n \t\t\"XDP pkt read, pkt_end >= pkt_data', bad access 1\",\n \t\t.insns = {\n \t\t\tBPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1,\n@@ -7470,6 +7398,78 @@ struct test_val {\n \t\t.prog_type = BPF_PROG_TYPE_XDP,\n \t\t.flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,\n \t},\n+\t{\n+\t\t\"bpf_exit with invalid return code. test1\",\n+\t\t.insns = {\n+\t\t\tBPF_LDX_MEM(BPF_W, BPF_REG_0, BPF_REG_1, 0),\n+\t\t\tBPF_EXIT_INSN(),\n+\t\t},\n+\t\t.errstr = \"R0 has value (0x0; 0xffffffff)\",\n+\t\t.result = REJECT,\n+\t\t.prog_type = BPF_PROG_TYPE_CGROUP_SOCK,\n+\t},\n+\t{\n+\t\t\"bpf_exit with invalid return code. test2\",\n+\t\t.insns = {\n+\t\t\tBPF_LDX_MEM(BPF_W, BPF_REG_0, BPF_REG_1, 0),\n+\t\t\tBPF_ALU64_IMM(BPF_AND, BPF_REG_0, 1),\n+\t\t\tBPF_EXIT_INSN(),\n+\t\t},\n+\t\t.result = ACCEPT,\n+\t\t.prog_type = BPF_PROG_TYPE_CGROUP_SOCK,\n+\t},\n+\t{\n+\t\t\"bpf_exit with invalid return code. test3\",\n+\t\t.insns = {\n+\t\t\tBPF_LDX_MEM(BPF_W, BPF_REG_0, BPF_REG_1, 0),\n+\t\t\tBPF_ALU64_IMM(BPF_AND, BPF_REG_0, 3),\n+\t\t\tBPF_EXIT_INSN(),\n+\t\t},\n+\t\t.errstr = \"R0 has value (0x0; 0x3)\",\n+\t\t.result = REJECT,\n+\t\t.prog_type = BPF_PROG_TYPE_CGROUP_SOCK,\n+\t},\n+\t{\n+\t\t\"bpf_exit with invalid return code. test4\",\n+\t\t.insns = {\n+\t\t\tBPF_MOV64_IMM(BPF_REG_0, 1),\n+\t\t\tBPF_EXIT_INSN(),\n+\t\t},\n+\t\t.result = ACCEPT,\n+\t\t.prog_type = BPF_PROG_TYPE_CGROUP_SOCK,\n+\t},\n+\t{\n+\t\t\"bpf_exit with invalid return code. test5\",\n+\t\t.insns = {\n+\t\t\tBPF_MOV64_IMM(BPF_REG_0, 2),\n+\t\t\tBPF_EXIT_INSN(),\n+\t\t},\n+\t\t.errstr = \"R0 has value (0x2; 0x0)\",\n+\t\t.result = REJECT,\n+\t\t.prog_type = BPF_PROG_TYPE_CGROUP_SOCK,\n+\t},\n+\t{\n+\t\t\"bpf_exit with invalid return code. test6\",\n+\t\t.insns = {\n+\t\t\tBPF_MOV64_REG(BPF_REG_0, BPF_REG_1),\n+\t\t\tBPF_EXIT_INSN(),\n+\t\t},\n+\t\t.errstr = \"R0 is not a known value (ctx)\",\n+\t\t.result = REJECT,\n+\t\t.prog_type = BPF_PROG_TYPE_CGROUP_SOCK,\n+\t},\n+\t{\n+\t\t\"bpf_exit with invalid return code. test7\",\n+\t\t.insns = {\n+\t\t\tBPF_LDX_MEM(BPF_W, BPF_REG_0, BPF_REG_1, 0),\n+\t\t\tBPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, 4),\n+\t\t\tBPF_ALU64_REG(BPF_MUL, BPF_REG_0, BPF_REG_2),\n+\t\t\tBPF_EXIT_INSN(),\n+\t\t},\n+\t\t.errstr = \"R0 has unknown scalar value\",\n+\t\t.result = REJECT,\n+\t\t.prog_type = BPF_PROG_TYPE_CGROUP_SOCK,\n+\t},\n };\n \n static int probe_filter_length(const struct bpf_insn *fp)\n","prefixes":["net-next","1/3"]}