{"id":833133,"url":"http://patchwork.ozlabs.org/api/1.2/patches/833133/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/patch/e6a6d7105097854430987a2c596ad20ae73c449e.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":"<e6a6d7105097854430987a2c596ad20ae73c449e.1509576758.git.daniel@iogearbox.net>","list_archive_url":null,"date":"2017-11-01T22:58:11","name":"[net-next,3/3] bpf: add test cases to bpf selftests to cover all meta tests","commit_ref":null,"pull_url":null,"state":"accepted","archived":true,"hash":"471fa61af2a0633007cb341ece8da96e894dbfa4","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/e6a6d7105097854430987a2c596ad20ae73c449e.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/833133/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/833133/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 3yS3Y757Qtz9t34\n\tfor <patchwork-incoming@ozlabs.org>;\n\tThu,  2 Nov 2017 09:58:35 +1100 (AEDT)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S933594AbdKAW6d (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tWed, 1 Nov 2017 18:58:33 -0400","from www62.your-server.de ([213.133.104.62]:55626 \"EHLO\n\twww62.your-server.de\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S933336AbdKAW62 (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Wed, 1 Nov 2017 18:58:28 -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 1eA1xq-0005CI-Nc; Wed, 01 Nov 2017 23:58:26 +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 3/3] bpf: add test cases to bpf selftests to cover\n\tall meta tests","Date":"Wed,  1 Nov 2017 23:58:11 +0100","Message-Id":"<e6a6d7105097854430987a2c596ad20ae73c449e.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":"Lets also add test cases to cover all possible data_meta access tests\nfor good/bad access cases so we keep tracking them.\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 tools/testing/selftests/bpf/test_verifier.c | 442 ++++++++++++++++++++++++++++\n 1 file changed, 442 insertions(+)","diff":"diff --git a/tools/testing/selftests/bpf/test_verifier.c b/tools/testing/selftests/bpf/test_verifier.c\nindex 3b38a3d..bb3c4ad 100644\n--- a/tools/testing/selftests/bpf/test_verifier.c\n+++ b/tools/testing/selftests/bpf/test_verifier.c\n@@ -7399,6 +7399,448 @@ struct test_val {\n \t\t.flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,\n \t},\n \t{\n+\t\t\"XDP pkt read, pkt_meta' > pkt_data, good access\",\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 xdp_md, data_meta)),\n+\t\t\tBPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1,\n+\t\t\t\t    offsetof(struct xdp_md, data)),\n+\t\t\tBPF_MOV64_REG(BPF_REG_1, BPF_REG_2),\n+\t\t\tBPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 8),\n+\t\t\tBPF_JMP_REG(BPF_JGT, BPF_REG_1, BPF_REG_3, 1),\n+\t\t\tBPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, -8),\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_XDP,\n+\t},\n+\t{\n+\t\t\"XDP pkt read, pkt_meta' > pkt_data, bad access 1\",\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 xdp_md, data_meta)),\n+\t\t\tBPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1,\n+\t\t\t\t    offsetof(struct xdp_md, data)),\n+\t\t\tBPF_MOV64_REG(BPF_REG_1, BPF_REG_2),\n+\t\t\tBPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 8),\n+\t\t\tBPF_JMP_REG(BPF_JGT, BPF_REG_1, BPF_REG_3, 1),\n+\t\t\tBPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, -4),\n+\t\t\tBPF_MOV64_IMM(BPF_REG_0, 0),\n+\t\t\tBPF_EXIT_INSN(),\n+\t\t},\n+\t\t.errstr = \"R1 offset is outside of the packet\",\n+\t\t.result = REJECT,\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\"XDP pkt read, pkt_meta' > pkt_data, bad access 2\",\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 xdp_md, data_meta)),\n+\t\t\tBPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1,\n+\t\t\t\t    offsetof(struct xdp_md, data)),\n+\t\t\tBPF_MOV64_REG(BPF_REG_1, BPF_REG_2),\n+\t\t\tBPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 8),\n+\t\t\tBPF_JMP_REG(BPF_JGT, BPF_REG_1, BPF_REG_3, 0),\n+\t\t\tBPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, -8),\n+\t\t\tBPF_MOV64_IMM(BPF_REG_0, 0),\n+\t\t\tBPF_EXIT_INSN(),\n+\t\t},\n+\t\t.errstr = \"R1 offset is outside of the packet\",\n+\t\t.result = REJECT,\n+\t\t.prog_type = BPF_PROG_TYPE_XDP,\n+\t},\n+\t{\n+\t\t\"XDP pkt read, pkt_data > pkt_meta', good access\",\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 xdp_md, data_meta)),\n+\t\t\tBPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1,\n+\t\t\t\t    offsetof(struct xdp_md, data)),\n+\t\t\tBPF_MOV64_REG(BPF_REG_1, BPF_REG_2),\n+\t\t\tBPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 8),\n+\t\t\tBPF_JMP_REG(BPF_JGT, BPF_REG_3, BPF_REG_1, 1),\n+\t\t\tBPF_JMP_IMM(BPF_JA, 0, 0, 1),\n+\t\t\tBPF_LDX_MEM(BPF_W, BPF_REG_0, BPF_REG_1, -5),\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_XDP,\n+\t\t.flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,\n+\t},\n+\t{\n+\t\t\"XDP pkt read, pkt_data > pkt_meta', bad access 1\",\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 xdp_md, data_meta)),\n+\t\t\tBPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1,\n+\t\t\t\t    offsetof(struct xdp_md, data)),\n+\t\t\tBPF_MOV64_REG(BPF_REG_1, BPF_REG_2),\n+\t\t\tBPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 8),\n+\t\t\tBPF_JMP_REG(BPF_JGT, BPF_REG_3, BPF_REG_1, 1),\n+\t\t\tBPF_JMP_IMM(BPF_JA, 0, 0, 1),\n+\t\t\tBPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, -8),\n+\t\t\tBPF_MOV64_IMM(BPF_REG_0, 0),\n+\t\t\tBPF_EXIT_INSN(),\n+\t\t},\n+\t\t.errstr = \"R1 offset is outside of the packet\",\n+\t\t.result = REJECT,\n+\t\t.prog_type = BPF_PROG_TYPE_XDP,\n+\t},\n+\t{\n+\t\t\"XDP pkt read, pkt_data > pkt_meta', bad access 2\",\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 xdp_md, data_meta)),\n+\t\t\tBPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1,\n+\t\t\t\t    offsetof(struct xdp_md, data)),\n+\t\t\tBPF_MOV64_REG(BPF_REG_1, BPF_REG_2),\n+\t\t\tBPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 8),\n+\t\t\tBPF_JMP_REG(BPF_JGT, BPF_REG_3, BPF_REG_1, 1),\n+\t\t\tBPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, -8),\n+\t\t\tBPF_MOV64_IMM(BPF_REG_0, 0),\n+\t\t\tBPF_EXIT_INSN(),\n+\t\t},\n+\t\t.errstr = \"R1 offset is outside of the packet\",\n+\t\t.result = REJECT,\n+\t\t.prog_type = BPF_PROG_TYPE_XDP,\n+\t},\n+\t{\n+\t\t\"XDP pkt read, pkt_meta' < pkt_data, good access\",\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 xdp_md, data_meta)),\n+\t\t\tBPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1,\n+\t\t\t\t    offsetof(struct xdp_md, data)),\n+\t\t\tBPF_MOV64_REG(BPF_REG_1, BPF_REG_2),\n+\t\t\tBPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 8),\n+\t\t\tBPF_JMP_REG(BPF_JLT, BPF_REG_1, BPF_REG_3, 1),\n+\t\t\tBPF_JMP_IMM(BPF_JA, 0, 0, 1),\n+\t\t\tBPF_LDX_MEM(BPF_W, BPF_REG_0, BPF_REG_1, -5),\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_XDP,\n+\t\t.flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,\n+\t},\n+\t{\n+\t\t\"XDP pkt read, pkt_meta' < pkt_data, bad access 1\",\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 xdp_md, data_meta)),\n+\t\t\tBPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1,\n+\t\t\t\t    offsetof(struct xdp_md, data)),\n+\t\t\tBPF_MOV64_REG(BPF_REG_1, BPF_REG_2),\n+\t\t\tBPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 8),\n+\t\t\tBPF_JMP_REG(BPF_JLT, BPF_REG_1, BPF_REG_3, 1),\n+\t\t\tBPF_JMP_IMM(BPF_JA, 0, 0, 1),\n+\t\t\tBPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, -8),\n+\t\t\tBPF_MOV64_IMM(BPF_REG_0, 0),\n+\t\t\tBPF_EXIT_INSN(),\n+\t\t},\n+\t\t.errstr = \"R1 offset is outside of the packet\",\n+\t\t.result = REJECT,\n+\t\t.prog_type = BPF_PROG_TYPE_XDP,\n+\t},\n+\t{\n+\t\t\"XDP pkt read, pkt_meta' < pkt_data, bad access 2\",\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 xdp_md, data_meta)),\n+\t\t\tBPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1,\n+\t\t\t\t    offsetof(struct xdp_md, data)),\n+\t\t\tBPF_MOV64_REG(BPF_REG_1, BPF_REG_2),\n+\t\t\tBPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 8),\n+\t\t\tBPF_JMP_REG(BPF_JLT, BPF_REG_1, BPF_REG_3, 1),\n+\t\t\tBPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, -8),\n+\t\t\tBPF_MOV64_IMM(BPF_REG_0, 0),\n+\t\t\tBPF_EXIT_INSN(),\n+\t\t},\n+\t\t.errstr = \"R1 offset is outside of the packet\",\n+\t\t.result = REJECT,\n+\t\t.prog_type = BPF_PROG_TYPE_XDP,\n+\t},\n+\t{\n+\t\t\"XDP pkt read, pkt_data < pkt_meta', good access\",\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 xdp_md, data_meta)),\n+\t\t\tBPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1,\n+\t\t\t\t    offsetof(struct xdp_md, data)),\n+\t\t\tBPF_MOV64_REG(BPF_REG_1, BPF_REG_2),\n+\t\t\tBPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 8),\n+\t\t\tBPF_JMP_REG(BPF_JLT, BPF_REG_3, BPF_REG_1, 1),\n+\t\t\tBPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, -8),\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_XDP,\n+\t},\n+\t{\n+\t\t\"XDP pkt read, pkt_data < pkt_meta', bad access 1\",\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 xdp_md, data_meta)),\n+\t\t\tBPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1,\n+\t\t\t\t    offsetof(struct xdp_md, data)),\n+\t\t\tBPF_MOV64_REG(BPF_REG_1, BPF_REG_2),\n+\t\t\tBPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 8),\n+\t\t\tBPF_JMP_REG(BPF_JLT, BPF_REG_3, BPF_REG_1, 1),\n+\t\t\tBPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, -4),\n+\t\t\tBPF_MOV64_IMM(BPF_REG_0, 0),\n+\t\t\tBPF_EXIT_INSN(),\n+\t\t},\n+\t\t.errstr = \"R1 offset is outside of the packet\",\n+\t\t.result = REJECT,\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\"XDP pkt read, pkt_data < pkt_meta', bad access 2\",\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 xdp_md, data_meta)),\n+\t\t\tBPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1,\n+\t\t\t\t    offsetof(struct xdp_md, data)),\n+\t\t\tBPF_MOV64_REG(BPF_REG_1, BPF_REG_2),\n+\t\t\tBPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 8),\n+\t\t\tBPF_JMP_REG(BPF_JLT, BPF_REG_3, BPF_REG_1, 0),\n+\t\t\tBPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, -8),\n+\t\t\tBPF_MOV64_IMM(BPF_REG_0, 0),\n+\t\t\tBPF_EXIT_INSN(),\n+\t\t},\n+\t\t.errstr = \"R1 offset is outside of the packet\",\n+\t\t.result = REJECT,\n+\t\t.prog_type = BPF_PROG_TYPE_XDP,\n+\t},\n+\t{\n+\t\t\"XDP pkt read, pkt_meta' >= pkt_data, good access\",\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 xdp_md, data_meta)),\n+\t\t\tBPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1,\n+\t\t\t\t    offsetof(struct xdp_md, data)),\n+\t\t\tBPF_MOV64_REG(BPF_REG_1, BPF_REG_2),\n+\t\t\tBPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 8),\n+\t\t\tBPF_JMP_REG(BPF_JGE, BPF_REG_1, BPF_REG_3, 1),\n+\t\t\tBPF_LDX_MEM(BPF_W, BPF_REG_0, BPF_REG_1, -5),\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_XDP,\n+\t\t.flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,\n+\t},\n+\t{\n+\t\t\"XDP pkt read, pkt_meta' >= pkt_data, bad access 1\",\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 xdp_md, data_meta)),\n+\t\t\tBPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1,\n+\t\t\t\t    offsetof(struct xdp_md, data)),\n+\t\t\tBPF_MOV64_REG(BPF_REG_1, BPF_REG_2),\n+\t\t\tBPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 8),\n+\t\t\tBPF_JMP_REG(BPF_JGE, BPF_REG_1, BPF_REG_3, 1),\n+\t\t\tBPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, -8),\n+\t\t\tBPF_MOV64_IMM(BPF_REG_0, 0),\n+\t\t\tBPF_EXIT_INSN(),\n+\t\t},\n+\t\t.errstr = \"R1 offset is outside of the packet\",\n+\t\t.result = REJECT,\n+\t\t.prog_type = BPF_PROG_TYPE_XDP,\n+\t},\n+\t{\n+\t\t\"XDP pkt read, pkt_meta' >= pkt_data, bad access 2\",\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 xdp_md, data_meta)),\n+\t\t\tBPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1,\n+\t\t\t\t    offsetof(struct xdp_md, data)),\n+\t\t\tBPF_MOV64_REG(BPF_REG_1, BPF_REG_2),\n+\t\t\tBPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 8),\n+\t\t\tBPF_JMP_REG(BPF_JGE, BPF_REG_1, BPF_REG_3, 0),\n+\t\t\tBPF_LDX_MEM(BPF_W, BPF_REG_0, BPF_REG_1, -5),\n+\t\t\tBPF_MOV64_IMM(BPF_REG_0, 0),\n+\t\t\tBPF_EXIT_INSN(),\n+\t\t},\n+\t\t.errstr = \"R1 offset is outside of the packet\",\n+\t\t.result = REJECT,\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\"XDP pkt read, pkt_data >= pkt_meta', good access\",\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 xdp_md, data_meta)),\n+\t\t\tBPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1,\n+\t\t\t\t    offsetof(struct xdp_md, data)),\n+\t\t\tBPF_MOV64_REG(BPF_REG_1, BPF_REG_2),\n+\t\t\tBPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 8),\n+\t\t\tBPF_JMP_REG(BPF_JGE, BPF_REG_3, BPF_REG_1, 1),\n+\t\t\tBPF_JMP_IMM(BPF_JA, 0, 0, 1),\n+\t\t\tBPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, -8),\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_XDP,\n+\t},\n+\t{\n+\t\t\"XDP pkt read, pkt_data >= pkt_meta', bad access 1\",\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 xdp_md, data_meta)),\n+\t\t\tBPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1,\n+\t\t\t\t    offsetof(struct xdp_md, data)),\n+\t\t\tBPF_MOV64_REG(BPF_REG_1, BPF_REG_2),\n+\t\t\tBPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 8),\n+\t\t\tBPF_JMP_REG(BPF_JGE, BPF_REG_3, BPF_REG_1, 1),\n+\t\t\tBPF_JMP_IMM(BPF_JA, 0, 0, 1),\n+\t\t\tBPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, -4),\n+\t\t\tBPF_MOV64_IMM(BPF_REG_0, 0),\n+\t\t\tBPF_EXIT_INSN(),\n+\t\t},\n+\t\t.errstr = \"R1 offset is outside of the packet\",\n+\t\t.result = REJECT,\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\"XDP pkt read, pkt_data >= pkt_meta', bad access 2\",\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 xdp_md, data_meta)),\n+\t\t\tBPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1,\n+\t\t\t\t    offsetof(struct xdp_md, data)),\n+\t\t\tBPF_MOV64_REG(BPF_REG_1, BPF_REG_2),\n+\t\t\tBPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 8),\n+\t\t\tBPF_JMP_REG(BPF_JGE, BPF_REG_3, BPF_REG_1, 1),\n+\t\t\tBPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, -8),\n+\t\t\tBPF_MOV64_IMM(BPF_REG_0, 0),\n+\t\t\tBPF_EXIT_INSN(),\n+\t\t},\n+\t\t.errstr = \"R1 offset is outside of the packet\",\n+\t\t.result = REJECT,\n+\t\t.prog_type = BPF_PROG_TYPE_XDP,\n+\t},\n+\t{\n+\t\t\"XDP pkt read, pkt_meta' <= pkt_data, good access\",\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 xdp_md, data_meta)),\n+\t\t\tBPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1,\n+\t\t\t\t    offsetof(struct xdp_md, data)),\n+\t\t\tBPF_MOV64_REG(BPF_REG_1, BPF_REG_2),\n+\t\t\tBPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 8),\n+\t\t\tBPF_JMP_REG(BPF_JLE, BPF_REG_1, BPF_REG_3, 1),\n+\t\t\tBPF_JMP_IMM(BPF_JA, 0, 0, 1),\n+\t\t\tBPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, -8),\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_XDP,\n+\t},\n+\t{\n+\t\t\"XDP pkt read, pkt_meta' <= pkt_data, bad access 1\",\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 xdp_md, data_meta)),\n+\t\t\tBPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1,\n+\t\t\t\t    offsetof(struct xdp_md, data)),\n+\t\t\tBPF_MOV64_REG(BPF_REG_1, BPF_REG_2),\n+\t\t\tBPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 8),\n+\t\t\tBPF_JMP_REG(BPF_JLE, BPF_REG_1, BPF_REG_3, 1),\n+\t\t\tBPF_JMP_IMM(BPF_JA, 0, 0, 1),\n+\t\t\tBPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, -4),\n+\t\t\tBPF_MOV64_IMM(BPF_REG_0, 0),\n+\t\t\tBPF_EXIT_INSN(),\n+\t\t},\n+\t\t.errstr = \"R1 offset is outside of the packet\",\n+\t\t.result = REJECT,\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\"XDP pkt read, pkt_meta' <= pkt_data, bad access 2\",\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 xdp_md, data_meta)),\n+\t\t\tBPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1,\n+\t\t\t\t    offsetof(struct xdp_md, data)),\n+\t\t\tBPF_MOV64_REG(BPF_REG_1, BPF_REG_2),\n+\t\t\tBPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 8),\n+\t\t\tBPF_JMP_REG(BPF_JLE, BPF_REG_1, BPF_REG_3, 1),\n+\t\t\tBPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, -8),\n+\t\t\tBPF_MOV64_IMM(BPF_REG_0, 0),\n+\t\t\tBPF_EXIT_INSN(),\n+\t\t},\n+\t\t.errstr = \"R1 offset is outside of the packet\",\n+\t\t.result = REJECT,\n+\t\t.prog_type = BPF_PROG_TYPE_XDP,\n+\t},\n+\t{\n+\t\t\"XDP pkt read, pkt_data <= pkt_meta', good access\",\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 xdp_md, data_meta)),\n+\t\t\tBPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1,\n+\t\t\t\t    offsetof(struct xdp_md, data)),\n+\t\t\tBPF_MOV64_REG(BPF_REG_1, BPF_REG_2),\n+\t\t\tBPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 8),\n+\t\t\tBPF_JMP_REG(BPF_JLE, BPF_REG_3, BPF_REG_1, 1),\n+\t\t\tBPF_LDX_MEM(BPF_W, BPF_REG_0, BPF_REG_1, -5),\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_XDP,\n+\t\t.flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,\n+\t},\n+\t{\n+\t\t\"XDP pkt read, pkt_data <= pkt_meta', bad access 1\",\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 xdp_md, data_meta)),\n+\t\t\tBPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1,\n+\t\t\t\t    offsetof(struct xdp_md, data)),\n+\t\t\tBPF_MOV64_REG(BPF_REG_1, BPF_REG_2),\n+\t\t\tBPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 8),\n+\t\t\tBPF_JMP_REG(BPF_JLE, BPF_REG_3, BPF_REG_1, 1),\n+\t\t\tBPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, -8),\n+\t\t\tBPF_MOV64_IMM(BPF_REG_0, 0),\n+\t\t\tBPF_EXIT_INSN(),\n+\t\t},\n+\t\t.errstr = \"R1 offset is outside of the packet\",\n+\t\t.result = REJECT,\n+\t\t.prog_type = BPF_PROG_TYPE_XDP,\n+\t},\n+\t{\n+\t\t\"XDP pkt read, pkt_data <= pkt_meta', bad access 2\",\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 xdp_md, data_meta)),\n+\t\t\tBPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1,\n+\t\t\t\t    offsetof(struct xdp_md, data)),\n+\t\t\tBPF_MOV64_REG(BPF_REG_1, BPF_REG_2),\n+\t\t\tBPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 8),\n+\t\t\tBPF_JMP_REG(BPF_JLE, BPF_REG_3, BPF_REG_1, 0),\n+\t\t\tBPF_LDX_MEM(BPF_W, BPF_REG_0, BPF_REG_1, -5),\n+\t\t\tBPF_MOV64_IMM(BPF_REG_0, 0),\n+\t\t\tBPF_EXIT_INSN(),\n+\t\t},\n+\t\t.errstr = \"R1 offset is outside of the packet\",\n+\t\t.result = REJECT,\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","prefixes":["net-next","3/3"]}