selftests/bpf: verifier/meta_access.c converted to inline assembly
authorEduard Zingerman <eddyz87@gmail.com>
Sat, 25 Mar 2023 02:55:11 +0000 (04:55 +0200)
committerAlexei Starovoitov <ast@kernel.org>
Sun, 26 Mar 2023 00:02:05 +0000 (17:02 -0700)
Test verifier/meta_access.c automatically converted to use inline assembly.

Signed-off-by: Eduard Zingerman <eddyz87@gmail.com>
Link: https://lore.kernel.org/r/20230325025524.144043-31-eddyz87@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/prog_tests/verifier.c
tools/testing/selftests/bpf/progs/verifier_meta_access.c [new file with mode: 0644]
tools/testing/selftests/bpf/verifier/meta_access.c [deleted file]

index b23fcbe4f83b4e7cfe7e579a611d84a04f830add..bd48a584a356f411f0c84674d164f97d0bf75f6f 100644 (file)
@@ -27,6 +27,7 @@
 #include "verifier_map_ptr.skel.h"
 #include "verifier_map_ret_val.skel.h"
 #include "verifier_masking.skel.h"
+#include "verifier_meta_access.skel.h"
 
 __maybe_unused
 static void run_tests_aux(const char *skel_name, skel_elf_bytes_fn elf_bytes_factory)
@@ -76,3 +77,4 @@ void test_verifier_leak_ptr(void)             { RUN(verifier_leak_ptr); }
 void test_verifier_map_ptr(void)              { RUN(verifier_map_ptr); }
 void test_verifier_map_ret_val(void)          { RUN(verifier_map_ret_val); }
 void test_verifier_masking(void)              { RUN(verifier_masking); }
+void test_verifier_meta_access(void)          { RUN(verifier_meta_access); }
diff --git a/tools/testing/selftests/bpf/progs/verifier_meta_access.c b/tools/testing/selftests/bpf/progs/verifier_meta_access.c
new file mode 100644 (file)
index 0000000..d81722f
--- /dev/null
@@ -0,0 +1,284 @@
+// SPDX-License-Identifier: GPL-2.0
+/* Converted from tools/testing/selftests/bpf/verifier/meta_access.c */
+
+#include <linux/bpf.h>
+#include <bpf/bpf_helpers.h>
+#include "bpf_misc.h"
+
+SEC("xdp")
+__description("meta access, test1")
+__success __retval(0)
+__naked void meta_access_test1(void)
+{
+       asm volatile ("                                 \
+       r2 = *(u32*)(r1 + %[xdp_md_data_meta]);         \
+       r3 = *(u32*)(r1 + %[xdp_md_data]);              \
+       r0 = r2;                                        \
+       r0 += 8;                                        \
+       if r0 > r3 goto l0_%=;                          \
+       r0 = *(u8*)(r2 + 0);                            \
+l0_%=: r0 = 0;                                         \
+       exit;                                           \
+"      :
+       : __imm_const(xdp_md_data, offsetof(struct xdp_md, data)),
+         __imm_const(xdp_md_data_meta, offsetof(struct xdp_md, data_meta))
+       : __clobber_all);
+}
+
+SEC("xdp")
+__description("meta access, test2")
+__failure __msg("invalid access to packet, off=-8")
+__naked void meta_access_test2(void)
+{
+       asm volatile ("                                 \
+       r2 = *(u32*)(r1 + %[xdp_md_data_meta]);         \
+       r3 = *(u32*)(r1 + %[xdp_md_data]);              \
+       r0 = r2;                                        \
+       r0 -= 8;                                        \
+       r4 = r2;                                        \
+       r4 += 8;                                        \
+       if r4 > r3 goto l0_%=;                          \
+       r0 = *(u8*)(r0 + 0);                            \
+l0_%=: r0 = 0;                                         \
+       exit;                                           \
+"      :
+       : __imm_const(xdp_md_data, offsetof(struct xdp_md, data)),
+         __imm_const(xdp_md_data_meta, offsetof(struct xdp_md, data_meta))
+       : __clobber_all);
+}
+
+SEC("xdp")
+__description("meta access, test3")
+__failure __msg("invalid access to packet")
+__naked void meta_access_test3(void)
+{
+       asm volatile ("                                 \
+       r2 = *(u32*)(r1 + %[xdp_md_data_meta]);         \
+       r3 = *(u32*)(r1 + %[xdp_md_data_end]);          \
+       r0 = r2;                                        \
+       r0 += 8;                                        \
+       if r0 > r3 goto l0_%=;                          \
+       r0 = *(u8*)(r2 + 0);                            \
+l0_%=: r0 = 0;                                         \
+       exit;                                           \
+"      :
+       : __imm_const(xdp_md_data_end, offsetof(struct xdp_md, data_end)),
+         __imm_const(xdp_md_data_meta, offsetof(struct xdp_md, data_meta))
+       : __clobber_all);
+}
+
+SEC("xdp")
+__description("meta access, test4")
+__failure __msg("invalid access to packet")
+__naked void meta_access_test4(void)
+{
+       asm volatile ("                                 \
+       r2 = *(u32*)(r1 + %[xdp_md_data_meta]);         \
+       r3 = *(u32*)(r1 + %[xdp_md_data_end]);          \
+       r4 = *(u32*)(r1 + %[xdp_md_data]);              \
+       r0 = r4;                                        \
+       r0 += 8;                                        \
+       if r0 > r3 goto l0_%=;                          \
+       r0 = *(u8*)(r2 + 0);                            \
+l0_%=: r0 = 0;                                         \
+       exit;                                           \
+"      :
+       : __imm_const(xdp_md_data, offsetof(struct xdp_md, data)),
+         __imm_const(xdp_md_data_end, offsetof(struct xdp_md, data_end)),
+         __imm_const(xdp_md_data_meta, offsetof(struct xdp_md, data_meta))
+       : __clobber_all);
+}
+
+SEC("xdp")
+__description("meta access, test5")
+__failure __msg("R3 !read_ok")
+__naked void meta_access_test5(void)
+{
+       asm volatile ("                                 \
+       r3 = *(u32*)(r1 + %[xdp_md_data_meta]);         \
+       r4 = *(u32*)(r1 + %[xdp_md_data]);              \
+       r0 = r3;                                        \
+       r0 += 8;                                        \
+       if r0 > r4 goto l0_%=;                          \
+       r2 = -8;                                        \
+       call %[bpf_xdp_adjust_meta];                    \
+       r0 = *(u8*)(r3 + 0);                            \
+l0_%=: r0 = 0;                                         \
+       exit;                                           \
+"      :
+       : __imm(bpf_xdp_adjust_meta),
+         __imm_const(xdp_md_data, offsetof(struct xdp_md, data)),
+         __imm_const(xdp_md_data_meta, offsetof(struct xdp_md, data_meta))
+       : __clobber_all);
+}
+
+SEC("xdp")
+__description("meta access, test6")
+__failure __msg("invalid access to packet")
+__naked void meta_access_test6(void)
+{
+       asm volatile ("                                 \
+       r2 = *(u32*)(r1 + %[xdp_md_data_meta]);         \
+       r3 = *(u32*)(r1 + %[xdp_md_data]);              \
+       r0 = r3;                                        \
+       r0 += 8;                                        \
+       r4 = r2;                                        \
+       r4 += 8;                                        \
+       if r4 > r0 goto l0_%=;                          \
+       r0 = *(u8*)(r2 + 0);                            \
+l0_%=: r0 = 0;                                         \
+       exit;                                           \
+"      :
+       : __imm_const(xdp_md_data, offsetof(struct xdp_md, data)),
+         __imm_const(xdp_md_data_meta, offsetof(struct xdp_md, data_meta))
+       : __clobber_all);
+}
+
+SEC("xdp")
+__description("meta access, test7")
+__success __retval(0)
+__naked void meta_access_test7(void)
+{
+       asm volatile ("                                 \
+       r2 = *(u32*)(r1 + %[xdp_md_data_meta]);         \
+       r3 = *(u32*)(r1 + %[xdp_md_data]);              \
+       r0 = r3;                                        \
+       r0 += 8;                                        \
+       r4 = r2;                                        \
+       r4 += 8;                                        \
+       if r4 > r3 goto l0_%=;                          \
+       r0 = *(u8*)(r2 + 0);                            \
+l0_%=: r0 = 0;                                         \
+       exit;                                           \
+"      :
+       : __imm_const(xdp_md_data, offsetof(struct xdp_md, data)),
+         __imm_const(xdp_md_data_meta, offsetof(struct xdp_md, data_meta))
+       : __clobber_all);
+}
+
+SEC("xdp")
+__description("meta access, test8")
+__success __retval(0)
+__naked void meta_access_test8(void)
+{
+       asm volatile ("                                 \
+       r2 = *(u32*)(r1 + %[xdp_md_data_meta]);         \
+       r3 = *(u32*)(r1 + %[xdp_md_data]);              \
+       r4 = r2;                                        \
+       r4 += 0xFFFF;                                   \
+       if r4 > r3 goto l0_%=;                          \
+       r0 = *(u8*)(r2 + 0);                            \
+l0_%=: r0 = 0;                                         \
+       exit;                                           \
+"      :
+       : __imm_const(xdp_md_data, offsetof(struct xdp_md, data)),
+         __imm_const(xdp_md_data_meta, offsetof(struct xdp_md, data_meta))
+       : __clobber_all);
+}
+
+SEC("xdp")
+__description("meta access, test9")
+__failure __msg("invalid access to packet")
+__naked void meta_access_test9(void)
+{
+       asm volatile ("                                 \
+       r2 = *(u32*)(r1 + %[xdp_md_data_meta]);         \
+       r3 = *(u32*)(r1 + %[xdp_md_data]);              \
+       r4 = r2;                                        \
+       r4 += 0xFFFF;                                   \
+       r4 += 1;                                        \
+       if r4 > r3 goto l0_%=;                          \
+       r0 = *(u8*)(r2 + 0);                            \
+l0_%=: r0 = 0;                                         \
+       exit;                                           \
+"      :
+       : __imm_const(xdp_md_data, offsetof(struct xdp_md, data)),
+         __imm_const(xdp_md_data_meta, offsetof(struct xdp_md, data_meta))
+       : __clobber_all);
+}
+
+SEC("xdp")
+__description("meta access, test10")
+__failure __msg("invalid access to packet")
+__naked void meta_access_test10(void)
+{
+       asm volatile ("                                 \
+       r2 = *(u32*)(r1 + %[xdp_md_data_meta]);         \
+       r3 = *(u32*)(r1 + %[xdp_md_data]);              \
+       r4 = *(u32*)(r1 + %[xdp_md_data_end]);          \
+       r5 = 42;                                        \
+       r6 = 24;                                        \
+       *(u64*)(r10 - 8) = r5;                          \
+       lock *(u64 *)(r10 - 8) += r6;                   \
+       r5 = *(u64*)(r10 - 8);                          \
+       if r5 > 100 goto l0_%=;                         \
+       r3 += r5;                                       \
+       r5 = r3;                                        \
+       r6 = r2;                                        \
+       r6 += 8;                                        \
+       if r6 > r5 goto l0_%=;                          \
+       r2 = *(u8*)(r2 + 0);                            \
+l0_%=: r0 = 0;                                         \
+       exit;                                           \
+"      :
+       : __imm_const(xdp_md_data, offsetof(struct xdp_md, data)),
+         __imm_const(xdp_md_data_end, offsetof(struct xdp_md, data_end)),
+         __imm_const(xdp_md_data_meta, offsetof(struct xdp_md, data_meta))
+       : __clobber_all);
+}
+
+SEC("xdp")
+__description("meta access, test11")
+__success __retval(0)
+__naked void meta_access_test11(void)
+{
+       asm volatile ("                                 \
+       r2 = *(u32*)(r1 + %[xdp_md_data_meta]);         \
+       r3 = *(u32*)(r1 + %[xdp_md_data]);              \
+       r5 = 42;                                        \
+       r6 = 24;                                        \
+       *(u64*)(r10 - 8) = r5;                          \
+       lock *(u64 *)(r10 - 8) += r6;                   \
+       r5 = *(u64*)(r10 - 8);                          \
+       if r5 > 100 goto l0_%=;                         \
+       r2 += r5;                                       \
+       r5 = r2;                                        \
+       r6 = r2;                                        \
+       r6 += 8;                                        \
+       if r6 > r3 goto l0_%=;                          \
+       r5 = *(u8*)(r5 + 0);                            \
+l0_%=: r0 = 0;                                         \
+       exit;                                           \
+"      :
+       : __imm_const(xdp_md_data, offsetof(struct xdp_md, data)),
+         __imm_const(xdp_md_data_meta, offsetof(struct xdp_md, data_meta))
+       : __clobber_all);
+}
+
+SEC("xdp")
+__description("meta access, test12")
+__success __retval(0)
+__naked void meta_access_test12(void)
+{
+       asm volatile ("                                 \
+       r2 = *(u32*)(r1 + %[xdp_md_data_meta]);         \
+       r3 = *(u32*)(r1 + %[xdp_md_data]);              \
+       r4 = *(u32*)(r1 + %[xdp_md_data_end]);          \
+       r5 = r3;                                        \
+       r5 += 16;                                       \
+       if r5 > r4 goto l0_%=;                          \
+       r0 = *(u8*)(r3 + 0);                            \
+       r5 = r2;                                        \
+       r5 += 16;                                       \
+       if r5 > r3 goto l0_%=;                          \
+       r0 = *(u8*)(r2 + 0);                            \
+l0_%=: r0 = 0;                                         \
+       exit;                                           \
+"      :
+       : __imm_const(xdp_md_data, offsetof(struct xdp_md, data)),
+         __imm_const(xdp_md_data_end, offsetof(struct xdp_md, data_end)),
+         __imm_const(xdp_md_data_meta, offsetof(struct xdp_md, data_meta))
+       : __clobber_all);
+}
+
+char _license[] SEC("license") = "GPL";
diff --git a/tools/testing/selftests/bpf/verifier/meta_access.c b/tools/testing/selftests/bpf/verifier/meta_access.c
deleted file mode 100644 (file)
index b45e8af..0000000
+++ /dev/null
@@ -1,235 +0,0 @@
-{
-       "meta access, test1",
-       .insns = {
-       BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1,
-                   offsetof(struct xdp_md, data_meta)),
-       BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1, offsetof(struct xdp_md, data)),
-       BPF_MOV64_REG(BPF_REG_0, BPF_REG_2),
-       BPF_ALU64_IMM(BPF_ADD, BPF_REG_0, 8),
-       BPF_JMP_REG(BPF_JGT, BPF_REG_0, BPF_REG_3, 1),
-       BPF_LDX_MEM(BPF_B, BPF_REG_0, BPF_REG_2, 0),
-       BPF_MOV64_IMM(BPF_REG_0, 0),
-       BPF_EXIT_INSN(),
-       },
-       .result = ACCEPT,
-       .prog_type = BPF_PROG_TYPE_XDP,
-},
-{
-       "meta access, test2",
-       .insns = {
-       BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1,
-                   offsetof(struct xdp_md, data_meta)),
-       BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1, offsetof(struct xdp_md, data)),
-       BPF_MOV64_REG(BPF_REG_0, BPF_REG_2),
-       BPF_ALU64_IMM(BPF_SUB, BPF_REG_0, 8),
-       BPF_MOV64_REG(BPF_REG_4, BPF_REG_2),
-       BPF_ALU64_IMM(BPF_ADD, BPF_REG_4, 8),
-       BPF_JMP_REG(BPF_JGT, BPF_REG_4, BPF_REG_3, 1),
-       BPF_LDX_MEM(BPF_B, BPF_REG_0, BPF_REG_0, 0),
-       BPF_MOV64_IMM(BPF_REG_0, 0),
-       BPF_EXIT_INSN(),
-       },
-       .result = REJECT,
-       .errstr = "invalid access to packet, off=-8",
-       .prog_type = BPF_PROG_TYPE_XDP,
-},
-{
-       "meta access, test3",
-       .insns = {
-       BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1,
-                   offsetof(struct xdp_md, data_meta)),
-       BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1,
-                   offsetof(struct xdp_md, data_end)),
-       BPF_MOV64_REG(BPF_REG_0, BPF_REG_2),
-       BPF_ALU64_IMM(BPF_ADD, BPF_REG_0, 8),
-       BPF_JMP_REG(BPF_JGT, BPF_REG_0, BPF_REG_3, 1),
-       BPF_LDX_MEM(BPF_B, BPF_REG_0, BPF_REG_2, 0),
-       BPF_MOV64_IMM(BPF_REG_0, 0),
-       BPF_EXIT_INSN(),
-       },
-       .result = REJECT,
-       .errstr = "invalid access to packet",
-       .prog_type = BPF_PROG_TYPE_XDP,
-},
-{
-       "meta access, test4",
-       .insns = {
-       BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1,
-                   offsetof(struct xdp_md, data_meta)),
-       BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1,
-                   offsetof(struct xdp_md, data_end)),
-       BPF_LDX_MEM(BPF_W, BPF_REG_4, BPF_REG_1, offsetof(struct xdp_md, data)),
-       BPF_MOV64_REG(BPF_REG_0, BPF_REG_4),
-       BPF_ALU64_IMM(BPF_ADD, BPF_REG_0, 8),
-       BPF_JMP_REG(BPF_JGT, BPF_REG_0, BPF_REG_3, 1),
-       BPF_LDX_MEM(BPF_B, BPF_REG_0, BPF_REG_2, 0),
-       BPF_MOV64_IMM(BPF_REG_0, 0),
-       BPF_EXIT_INSN(),
-       },
-       .result = REJECT,
-       .errstr = "invalid access to packet",
-       .prog_type = BPF_PROG_TYPE_XDP,
-},
-{
-       "meta access, test5",
-       .insns = {
-       BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1,
-                   offsetof(struct xdp_md, data_meta)),
-       BPF_LDX_MEM(BPF_W, BPF_REG_4, BPF_REG_1, offsetof(struct xdp_md, data)),
-       BPF_MOV64_REG(BPF_REG_0, BPF_REG_3),
-       BPF_ALU64_IMM(BPF_ADD, BPF_REG_0, 8),
-       BPF_JMP_REG(BPF_JGT, BPF_REG_0, BPF_REG_4, 3),
-       BPF_MOV64_IMM(BPF_REG_2, -8),
-       BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0, BPF_FUNC_xdp_adjust_meta),
-       BPF_LDX_MEM(BPF_B, BPF_REG_0, BPF_REG_3, 0),
-       BPF_MOV64_IMM(BPF_REG_0, 0),
-       BPF_EXIT_INSN(),
-       },
-       .result = REJECT,
-       .errstr = "R3 !read_ok",
-       .prog_type = BPF_PROG_TYPE_XDP,
-},
-{
-       "meta access, test6",
-       .insns = {
-       BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1,
-                   offsetof(struct xdp_md, data_meta)),
-       BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1, offsetof(struct xdp_md, data)),
-       BPF_MOV64_REG(BPF_REG_0, BPF_REG_3),
-       BPF_ALU64_IMM(BPF_ADD, BPF_REG_0, 8),
-       BPF_MOV64_REG(BPF_REG_4, BPF_REG_2),
-       BPF_ALU64_IMM(BPF_ADD, BPF_REG_4, 8),
-       BPF_JMP_REG(BPF_JGT, BPF_REG_4, BPF_REG_0, 1),
-       BPF_LDX_MEM(BPF_B, BPF_REG_0, BPF_REG_2, 0),
-       BPF_MOV64_IMM(BPF_REG_0, 0),
-       BPF_EXIT_INSN(),
-       },
-       .result = REJECT,
-       .errstr = "invalid access to packet",
-       .prog_type = BPF_PROG_TYPE_XDP,
-},
-{
-       "meta access, test7",
-       .insns = {
-       BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1,
-                   offsetof(struct xdp_md, data_meta)),
-       BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1, offsetof(struct xdp_md, data)),
-       BPF_MOV64_REG(BPF_REG_0, BPF_REG_3),
-       BPF_ALU64_IMM(BPF_ADD, BPF_REG_0, 8),
-       BPF_MOV64_REG(BPF_REG_4, BPF_REG_2),
-       BPF_ALU64_IMM(BPF_ADD, BPF_REG_4, 8),
-       BPF_JMP_REG(BPF_JGT, BPF_REG_4, BPF_REG_3, 1),
-       BPF_LDX_MEM(BPF_B, BPF_REG_0, BPF_REG_2, 0),
-       BPF_MOV64_IMM(BPF_REG_0, 0),
-       BPF_EXIT_INSN(),
-       },
-       .result = ACCEPT,
-       .prog_type = BPF_PROG_TYPE_XDP,
-},
-{
-       "meta access, test8",
-       .insns = {
-       BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1,
-                   offsetof(struct xdp_md, data_meta)),
-       BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1, offsetof(struct xdp_md, data)),
-       BPF_MOV64_REG(BPF_REG_4, BPF_REG_2),
-       BPF_ALU64_IMM(BPF_ADD, BPF_REG_4, 0xFFFF),
-       BPF_JMP_REG(BPF_JGT, BPF_REG_4, BPF_REG_3, 1),
-       BPF_LDX_MEM(BPF_B, BPF_REG_0, BPF_REG_2, 0),
-       BPF_MOV64_IMM(BPF_REG_0, 0),
-       BPF_EXIT_INSN(),
-       },
-       .result = ACCEPT,
-       .prog_type = BPF_PROG_TYPE_XDP,
-},
-{
-       "meta access, test9",
-       .insns = {
-       BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1,
-                   offsetof(struct xdp_md, data_meta)),
-       BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1, offsetof(struct xdp_md, data)),
-       BPF_MOV64_REG(BPF_REG_4, BPF_REG_2),
-       BPF_ALU64_IMM(BPF_ADD, BPF_REG_4, 0xFFFF),
-       BPF_ALU64_IMM(BPF_ADD, BPF_REG_4, 1),
-       BPF_JMP_REG(BPF_JGT, BPF_REG_4, BPF_REG_3, 1),
-       BPF_LDX_MEM(BPF_B, BPF_REG_0, BPF_REG_2, 0),
-       BPF_MOV64_IMM(BPF_REG_0, 0),
-       BPF_EXIT_INSN(),
-       },
-       .result = REJECT,
-       .errstr = "invalid access to packet",
-       .prog_type = BPF_PROG_TYPE_XDP,
-},
-{
-       "meta access, test10",
-       .insns = {
-       BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1,
-                   offsetof(struct xdp_md, data_meta)),
-       BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1, offsetof(struct xdp_md, data)),
-       BPF_LDX_MEM(BPF_W, BPF_REG_4, BPF_REG_1,
-                   offsetof(struct xdp_md, data_end)),
-       BPF_MOV64_IMM(BPF_REG_5, 42),
-       BPF_MOV64_IMM(BPF_REG_6, 24),
-       BPF_STX_MEM(BPF_DW, BPF_REG_10, BPF_REG_5, -8),
-       BPF_ATOMIC_OP(BPF_DW, BPF_ADD, BPF_REG_10, BPF_REG_6, -8),
-       BPF_LDX_MEM(BPF_DW, BPF_REG_5, BPF_REG_10, -8),
-       BPF_JMP_IMM(BPF_JGT, BPF_REG_5, 100, 6),
-       BPF_ALU64_REG(BPF_ADD, BPF_REG_3, BPF_REG_5),
-       BPF_MOV64_REG(BPF_REG_5, BPF_REG_3),
-       BPF_MOV64_REG(BPF_REG_6, BPF_REG_2),
-       BPF_ALU64_IMM(BPF_ADD, BPF_REG_6, 8),
-       BPF_JMP_REG(BPF_JGT, BPF_REG_6, BPF_REG_5, 1),
-       BPF_LDX_MEM(BPF_B, BPF_REG_2, BPF_REG_2, 0),
-       BPF_MOV64_IMM(BPF_REG_0, 0),
-       BPF_EXIT_INSN(),
-       },
-       .result = REJECT,
-       .errstr = "invalid access to packet",
-       .prog_type = BPF_PROG_TYPE_XDP,
-},
-{
-       "meta access, test11",
-       .insns = {
-       BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1,
-                   offsetof(struct xdp_md, data_meta)),
-       BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1, offsetof(struct xdp_md, data)),
-       BPF_MOV64_IMM(BPF_REG_5, 42),
-       BPF_MOV64_IMM(BPF_REG_6, 24),
-       BPF_STX_MEM(BPF_DW, BPF_REG_10, BPF_REG_5, -8),
-       BPF_ATOMIC_OP(BPF_DW, BPF_ADD, BPF_REG_10, BPF_REG_6, -8),
-       BPF_LDX_MEM(BPF_DW, BPF_REG_5, BPF_REG_10, -8),
-       BPF_JMP_IMM(BPF_JGT, BPF_REG_5, 100, 6),
-       BPF_ALU64_REG(BPF_ADD, BPF_REG_2, BPF_REG_5),
-       BPF_MOV64_REG(BPF_REG_5, BPF_REG_2),
-       BPF_MOV64_REG(BPF_REG_6, BPF_REG_2),
-       BPF_ALU64_IMM(BPF_ADD, BPF_REG_6, 8),
-       BPF_JMP_REG(BPF_JGT, BPF_REG_6, BPF_REG_3, 1),
-       BPF_LDX_MEM(BPF_B, BPF_REG_5, BPF_REG_5, 0),
-       BPF_MOV64_IMM(BPF_REG_0, 0),
-       BPF_EXIT_INSN(),
-       },
-       .result = ACCEPT,
-       .prog_type = BPF_PROG_TYPE_XDP,
-},
-{
-       "meta access, test12",
-       .insns = {
-       BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1,
-                   offsetof(struct xdp_md, data_meta)),
-       BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1, offsetof(struct xdp_md, data)),
-       BPF_LDX_MEM(BPF_W, BPF_REG_4, BPF_REG_1,
-                   offsetof(struct xdp_md, data_end)),
-       BPF_MOV64_REG(BPF_REG_5, BPF_REG_3),
-       BPF_ALU64_IMM(BPF_ADD, BPF_REG_5, 16),
-       BPF_JMP_REG(BPF_JGT, BPF_REG_5, BPF_REG_4, 5),
-       BPF_LDX_MEM(BPF_B, BPF_REG_0, BPF_REG_3, 0),
-       BPF_MOV64_REG(BPF_REG_5, BPF_REG_2),
-       BPF_ALU64_IMM(BPF_ADD, BPF_REG_5, 16),
-       BPF_JMP_REG(BPF_JGT, BPF_REG_5, BPF_REG_3, 1),
-       BPF_LDX_MEM(BPF_B, BPF_REG_0, BPF_REG_2, 0),
-       BPF_MOV64_IMM(BPF_REG_0, 0),
-       BPF_EXIT_INSN(),
-       },
-       .result = ACCEPT,
-       .prog_type = BPF_PROG_TYPE_XDP,
-},