18c2ecf20Sopenharmony_ci{ 28c2ecf20Sopenharmony_ci "meta access, test1", 38c2ecf20Sopenharmony_ci .insns = { 48c2ecf20Sopenharmony_ci BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, 58c2ecf20Sopenharmony_ci offsetof(struct xdp_md, data_meta)), 68c2ecf20Sopenharmony_ci BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1, offsetof(struct xdp_md, data)), 78c2ecf20Sopenharmony_ci BPF_MOV64_REG(BPF_REG_0, BPF_REG_2), 88c2ecf20Sopenharmony_ci BPF_ALU64_IMM(BPF_ADD, BPF_REG_0, 8), 98c2ecf20Sopenharmony_ci BPF_JMP_REG(BPF_JGT, BPF_REG_0, BPF_REG_3, 1), 108c2ecf20Sopenharmony_ci BPF_LDX_MEM(BPF_B, BPF_REG_0, BPF_REG_2, 0), 118c2ecf20Sopenharmony_ci BPF_MOV64_IMM(BPF_REG_0, 0), 128c2ecf20Sopenharmony_ci BPF_EXIT_INSN(), 138c2ecf20Sopenharmony_ci }, 148c2ecf20Sopenharmony_ci .result = ACCEPT, 158c2ecf20Sopenharmony_ci .prog_type = BPF_PROG_TYPE_XDP, 168c2ecf20Sopenharmony_ci}, 178c2ecf20Sopenharmony_ci{ 188c2ecf20Sopenharmony_ci "meta access, test2", 198c2ecf20Sopenharmony_ci .insns = { 208c2ecf20Sopenharmony_ci BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, 218c2ecf20Sopenharmony_ci offsetof(struct xdp_md, data_meta)), 228c2ecf20Sopenharmony_ci BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1, offsetof(struct xdp_md, data)), 238c2ecf20Sopenharmony_ci BPF_MOV64_REG(BPF_REG_0, BPF_REG_2), 248c2ecf20Sopenharmony_ci BPF_ALU64_IMM(BPF_SUB, BPF_REG_0, 8), 258c2ecf20Sopenharmony_ci BPF_MOV64_REG(BPF_REG_4, BPF_REG_2), 268c2ecf20Sopenharmony_ci BPF_ALU64_IMM(BPF_ADD, BPF_REG_4, 8), 278c2ecf20Sopenharmony_ci BPF_JMP_REG(BPF_JGT, BPF_REG_4, BPF_REG_3, 1), 288c2ecf20Sopenharmony_ci BPF_LDX_MEM(BPF_B, BPF_REG_0, BPF_REG_0, 0), 298c2ecf20Sopenharmony_ci BPF_MOV64_IMM(BPF_REG_0, 0), 308c2ecf20Sopenharmony_ci BPF_EXIT_INSN(), 318c2ecf20Sopenharmony_ci }, 328c2ecf20Sopenharmony_ci .result = REJECT, 338c2ecf20Sopenharmony_ci .errstr = "invalid access to packet, off=-8", 348c2ecf20Sopenharmony_ci .prog_type = BPF_PROG_TYPE_XDP, 358c2ecf20Sopenharmony_ci}, 368c2ecf20Sopenharmony_ci{ 378c2ecf20Sopenharmony_ci "meta access, test3", 388c2ecf20Sopenharmony_ci .insns = { 398c2ecf20Sopenharmony_ci BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, 408c2ecf20Sopenharmony_ci offsetof(struct xdp_md, data_meta)), 418c2ecf20Sopenharmony_ci BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1, 428c2ecf20Sopenharmony_ci offsetof(struct xdp_md, data_end)), 438c2ecf20Sopenharmony_ci BPF_MOV64_REG(BPF_REG_0, BPF_REG_2), 448c2ecf20Sopenharmony_ci BPF_ALU64_IMM(BPF_ADD, BPF_REG_0, 8), 458c2ecf20Sopenharmony_ci BPF_JMP_REG(BPF_JGT, BPF_REG_0, BPF_REG_3, 1), 468c2ecf20Sopenharmony_ci BPF_LDX_MEM(BPF_B, BPF_REG_0, BPF_REG_2, 0), 478c2ecf20Sopenharmony_ci BPF_MOV64_IMM(BPF_REG_0, 0), 488c2ecf20Sopenharmony_ci BPF_EXIT_INSN(), 498c2ecf20Sopenharmony_ci }, 508c2ecf20Sopenharmony_ci .result = REJECT, 518c2ecf20Sopenharmony_ci .errstr = "invalid access to packet", 528c2ecf20Sopenharmony_ci .prog_type = BPF_PROG_TYPE_XDP, 538c2ecf20Sopenharmony_ci}, 548c2ecf20Sopenharmony_ci{ 558c2ecf20Sopenharmony_ci "meta access, test4", 568c2ecf20Sopenharmony_ci .insns = { 578c2ecf20Sopenharmony_ci BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, 588c2ecf20Sopenharmony_ci offsetof(struct xdp_md, data_meta)), 598c2ecf20Sopenharmony_ci BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1, 608c2ecf20Sopenharmony_ci offsetof(struct xdp_md, data_end)), 618c2ecf20Sopenharmony_ci BPF_LDX_MEM(BPF_W, BPF_REG_4, BPF_REG_1, offsetof(struct xdp_md, data)), 628c2ecf20Sopenharmony_ci BPF_MOV64_REG(BPF_REG_0, BPF_REG_4), 638c2ecf20Sopenharmony_ci BPF_ALU64_IMM(BPF_ADD, BPF_REG_0, 8), 648c2ecf20Sopenharmony_ci BPF_JMP_REG(BPF_JGT, BPF_REG_0, BPF_REG_3, 1), 658c2ecf20Sopenharmony_ci BPF_LDX_MEM(BPF_B, BPF_REG_0, BPF_REG_2, 0), 668c2ecf20Sopenharmony_ci BPF_MOV64_IMM(BPF_REG_0, 0), 678c2ecf20Sopenharmony_ci BPF_EXIT_INSN(), 688c2ecf20Sopenharmony_ci }, 698c2ecf20Sopenharmony_ci .result = REJECT, 708c2ecf20Sopenharmony_ci .errstr = "invalid access to packet", 718c2ecf20Sopenharmony_ci .prog_type = BPF_PROG_TYPE_XDP, 728c2ecf20Sopenharmony_ci}, 738c2ecf20Sopenharmony_ci{ 748c2ecf20Sopenharmony_ci "meta access, test5", 758c2ecf20Sopenharmony_ci .insns = { 768c2ecf20Sopenharmony_ci BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1, 778c2ecf20Sopenharmony_ci offsetof(struct xdp_md, data_meta)), 788c2ecf20Sopenharmony_ci BPF_LDX_MEM(BPF_W, BPF_REG_4, BPF_REG_1, offsetof(struct xdp_md, data)), 798c2ecf20Sopenharmony_ci BPF_MOV64_REG(BPF_REG_0, BPF_REG_3), 808c2ecf20Sopenharmony_ci BPF_ALU64_IMM(BPF_ADD, BPF_REG_0, 8), 818c2ecf20Sopenharmony_ci BPF_JMP_REG(BPF_JGT, BPF_REG_0, BPF_REG_4, 3), 828c2ecf20Sopenharmony_ci BPF_MOV64_IMM(BPF_REG_2, -8), 838c2ecf20Sopenharmony_ci BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0, BPF_FUNC_xdp_adjust_meta), 848c2ecf20Sopenharmony_ci BPF_LDX_MEM(BPF_B, BPF_REG_0, BPF_REG_3, 0), 858c2ecf20Sopenharmony_ci BPF_MOV64_IMM(BPF_REG_0, 0), 868c2ecf20Sopenharmony_ci BPF_EXIT_INSN(), 878c2ecf20Sopenharmony_ci }, 888c2ecf20Sopenharmony_ci .result = REJECT, 898c2ecf20Sopenharmony_ci .errstr = "R3 !read_ok", 908c2ecf20Sopenharmony_ci .prog_type = BPF_PROG_TYPE_XDP, 918c2ecf20Sopenharmony_ci}, 928c2ecf20Sopenharmony_ci{ 938c2ecf20Sopenharmony_ci "meta access, test6", 948c2ecf20Sopenharmony_ci .insns = { 958c2ecf20Sopenharmony_ci BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, 968c2ecf20Sopenharmony_ci offsetof(struct xdp_md, data_meta)), 978c2ecf20Sopenharmony_ci BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1, offsetof(struct xdp_md, data)), 988c2ecf20Sopenharmony_ci BPF_MOV64_REG(BPF_REG_0, BPF_REG_3), 998c2ecf20Sopenharmony_ci BPF_ALU64_IMM(BPF_ADD, BPF_REG_0, 8), 1008c2ecf20Sopenharmony_ci BPF_MOV64_REG(BPF_REG_4, BPF_REG_2), 1018c2ecf20Sopenharmony_ci BPF_ALU64_IMM(BPF_ADD, BPF_REG_4, 8), 1028c2ecf20Sopenharmony_ci BPF_JMP_REG(BPF_JGT, BPF_REG_4, BPF_REG_0, 1), 1038c2ecf20Sopenharmony_ci BPF_LDX_MEM(BPF_B, BPF_REG_0, BPF_REG_2, 0), 1048c2ecf20Sopenharmony_ci BPF_MOV64_IMM(BPF_REG_0, 0), 1058c2ecf20Sopenharmony_ci BPF_EXIT_INSN(), 1068c2ecf20Sopenharmony_ci }, 1078c2ecf20Sopenharmony_ci .result = REJECT, 1088c2ecf20Sopenharmony_ci .errstr = "invalid access to packet", 1098c2ecf20Sopenharmony_ci .prog_type = BPF_PROG_TYPE_XDP, 1108c2ecf20Sopenharmony_ci}, 1118c2ecf20Sopenharmony_ci{ 1128c2ecf20Sopenharmony_ci "meta access, test7", 1138c2ecf20Sopenharmony_ci .insns = { 1148c2ecf20Sopenharmony_ci BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, 1158c2ecf20Sopenharmony_ci offsetof(struct xdp_md, data_meta)), 1168c2ecf20Sopenharmony_ci BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1, offsetof(struct xdp_md, data)), 1178c2ecf20Sopenharmony_ci BPF_MOV64_REG(BPF_REG_0, BPF_REG_3), 1188c2ecf20Sopenharmony_ci BPF_ALU64_IMM(BPF_ADD, BPF_REG_0, 8), 1198c2ecf20Sopenharmony_ci BPF_MOV64_REG(BPF_REG_4, BPF_REG_2), 1208c2ecf20Sopenharmony_ci BPF_ALU64_IMM(BPF_ADD, BPF_REG_4, 8), 1218c2ecf20Sopenharmony_ci BPF_JMP_REG(BPF_JGT, BPF_REG_4, BPF_REG_3, 1), 1228c2ecf20Sopenharmony_ci BPF_LDX_MEM(BPF_B, BPF_REG_0, BPF_REG_2, 0), 1238c2ecf20Sopenharmony_ci BPF_MOV64_IMM(BPF_REG_0, 0), 1248c2ecf20Sopenharmony_ci BPF_EXIT_INSN(), 1258c2ecf20Sopenharmony_ci }, 1268c2ecf20Sopenharmony_ci .result = ACCEPT, 1278c2ecf20Sopenharmony_ci .prog_type = BPF_PROG_TYPE_XDP, 1288c2ecf20Sopenharmony_ci}, 1298c2ecf20Sopenharmony_ci{ 1308c2ecf20Sopenharmony_ci "meta access, test8", 1318c2ecf20Sopenharmony_ci .insns = { 1328c2ecf20Sopenharmony_ci BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, 1338c2ecf20Sopenharmony_ci offsetof(struct xdp_md, data_meta)), 1348c2ecf20Sopenharmony_ci BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1, offsetof(struct xdp_md, data)), 1358c2ecf20Sopenharmony_ci BPF_MOV64_REG(BPF_REG_4, BPF_REG_2), 1368c2ecf20Sopenharmony_ci BPF_ALU64_IMM(BPF_ADD, BPF_REG_4, 0xFFFF), 1378c2ecf20Sopenharmony_ci BPF_JMP_REG(BPF_JGT, BPF_REG_4, BPF_REG_3, 1), 1388c2ecf20Sopenharmony_ci BPF_LDX_MEM(BPF_B, BPF_REG_0, BPF_REG_2, 0), 1398c2ecf20Sopenharmony_ci BPF_MOV64_IMM(BPF_REG_0, 0), 1408c2ecf20Sopenharmony_ci BPF_EXIT_INSN(), 1418c2ecf20Sopenharmony_ci }, 1428c2ecf20Sopenharmony_ci .result = ACCEPT, 1438c2ecf20Sopenharmony_ci .prog_type = BPF_PROG_TYPE_XDP, 1448c2ecf20Sopenharmony_ci}, 1458c2ecf20Sopenharmony_ci{ 1468c2ecf20Sopenharmony_ci "meta access, test9", 1478c2ecf20Sopenharmony_ci .insns = { 1488c2ecf20Sopenharmony_ci BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, 1498c2ecf20Sopenharmony_ci offsetof(struct xdp_md, data_meta)), 1508c2ecf20Sopenharmony_ci BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1, offsetof(struct xdp_md, data)), 1518c2ecf20Sopenharmony_ci BPF_MOV64_REG(BPF_REG_4, BPF_REG_2), 1528c2ecf20Sopenharmony_ci BPF_ALU64_IMM(BPF_ADD, BPF_REG_4, 0xFFFF), 1538c2ecf20Sopenharmony_ci BPF_ALU64_IMM(BPF_ADD, BPF_REG_4, 1), 1548c2ecf20Sopenharmony_ci BPF_JMP_REG(BPF_JGT, BPF_REG_4, BPF_REG_3, 1), 1558c2ecf20Sopenharmony_ci BPF_LDX_MEM(BPF_B, BPF_REG_0, BPF_REG_2, 0), 1568c2ecf20Sopenharmony_ci BPF_MOV64_IMM(BPF_REG_0, 0), 1578c2ecf20Sopenharmony_ci BPF_EXIT_INSN(), 1588c2ecf20Sopenharmony_ci }, 1598c2ecf20Sopenharmony_ci .result = REJECT, 1608c2ecf20Sopenharmony_ci .errstr = "invalid access to packet", 1618c2ecf20Sopenharmony_ci .prog_type = BPF_PROG_TYPE_XDP, 1628c2ecf20Sopenharmony_ci}, 1638c2ecf20Sopenharmony_ci{ 1648c2ecf20Sopenharmony_ci "meta access, test10", 1658c2ecf20Sopenharmony_ci .insns = { 1668c2ecf20Sopenharmony_ci BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, 1678c2ecf20Sopenharmony_ci offsetof(struct xdp_md, data_meta)), 1688c2ecf20Sopenharmony_ci BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1, offsetof(struct xdp_md, data)), 1698c2ecf20Sopenharmony_ci BPF_LDX_MEM(BPF_W, BPF_REG_4, BPF_REG_1, 1708c2ecf20Sopenharmony_ci offsetof(struct xdp_md, data_end)), 1718c2ecf20Sopenharmony_ci BPF_MOV64_IMM(BPF_REG_5, 42), 1728c2ecf20Sopenharmony_ci BPF_MOV64_IMM(BPF_REG_6, 24), 1738c2ecf20Sopenharmony_ci BPF_STX_MEM(BPF_DW, BPF_REG_10, BPF_REG_5, -8), 1748c2ecf20Sopenharmony_ci BPF_STX_XADD(BPF_DW, BPF_REG_10, BPF_REG_6, -8), 1758c2ecf20Sopenharmony_ci BPF_LDX_MEM(BPF_DW, BPF_REG_5, BPF_REG_10, -8), 1768c2ecf20Sopenharmony_ci BPF_JMP_IMM(BPF_JGT, BPF_REG_5, 100, 6), 1778c2ecf20Sopenharmony_ci BPF_ALU64_REG(BPF_ADD, BPF_REG_3, BPF_REG_5), 1788c2ecf20Sopenharmony_ci BPF_MOV64_REG(BPF_REG_5, BPF_REG_3), 1798c2ecf20Sopenharmony_ci BPF_MOV64_REG(BPF_REG_6, BPF_REG_2), 1808c2ecf20Sopenharmony_ci BPF_ALU64_IMM(BPF_ADD, BPF_REG_6, 8), 1818c2ecf20Sopenharmony_ci BPF_JMP_REG(BPF_JGT, BPF_REG_6, BPF_REG_5, 1), 1828c2ecf20Sopenharmony_ci BPF_LDX_MEM(BPF_B, BPF_REG_2, BPF_REG_2, 0), 1838c2ecf20Sopenharmony_ci BPF_MOV64_IMM(BPF_REG_0, 0), 1848c2ecf20Sopenharmony_ci BPF_EXIT_INSN(), 1858c2ecf20Sopenharmony_ci }, 1868c2ecf20Sopenharmony_ci .result = REJECT, 1878c2ecf20Sopenharmony_ci .errstr = "invalid access to packet", 1888c2ecf20Sopenharmony_ci .prog_type = BPF_PROG_TYPE_XDP, 1898c2ecf20Sopenharmony_ci}, 1908c2ecf20Sopenharmony_ci{ 1918c2ecf20Sopenharmony_ci "meta access, test11", 1928c2ecf20Sopenharmony_ci .insns = { 1938c2ecf20Sopenharmony_ci BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, 1948c2ecf20Sopenharmony_ci offsetof(struct xdp_md, data_meta)), 1958c2ecf20Sopenharmony_ci BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1, offsetof(struct xdp_md, data)), 1968c2ecf20Sopenharmony_ci BPF_MOV64_IMM(BPF_REG_5, 42), 1978c2ecf20Sopenharmony_ci BPF_MOV64_IMM(BPF_REG_6, 24), 1988c2ecf20Sopenharmony_ci BPF_STX_MEM(BPF_DW, BPF_REG_10, BPF_REG_5, -8), 1998c2ecf20Sopenharmony_ci BPF_STX_XADD(BPF_DW, BPF_REG_10, BPF_REG_6, -8), 2008c2ecf20Sopenharmony_ci BPF_LDX_MEM(BPF_DW, BPF_REG_5, BPF_REG_10, -8), 2018c2ecf20Sopenharmony_ci BPF_JMP_IMM(BPF_JGT, BPF_REG_5, 100, 6), 2028c2ecf20Sopenharmony_ci BPF_ALU64_REG(BPF_ADD, BPF_REG_2, BPF_REG_5), 2038c2ecf20Sopenharmony_ci BPF_MOV64_REG(BPF_REG_5, BPF_REG_2), 2048c2ecf20Sopenharmony_ci BPF_MOV64_REG(BPF_REG_6, BPF_REG_2), 2058c2ecf20Sopenharmony_ci BPF_ALU64_IMM(BPF_ADD, BPF_REG_6, 8), 2068c2ecf20Sopenharmony_ci BPF_JMP_REG(BPF_JGT, BPF_REG_6, BPF_REG_3, 1), 2078c2ecf20Sopenharmony_ci BPF_LDX_MEM(BPF_B, BPF_REG_5, BPF_REG_5, 0), 2088c2ecf20Sopenharmony_ci BPF_MOV64_IMM(BPF_REG_0, 0), 2098c2ecf20Sopenharmony_ci BPF_EXIT_INSN(), 2108c2ecf20Sopenharmony_ci }, 2118c2ecf20Sopenharmony_ci .result = ACCEPT, 2128c2ecf20Sopenharmony_ci .prog_type = BPF_PROG_TYPE_XDP, 2138c2ecf20Sopenharmony_ci}, 2148c2ecf20Sopenharmony_ci{ 2158c2ecf20Sopenharmony_ci "meta access, test12", 2168c2ecf20Sopenharmony_ci .insns = { 2178c2ecf20Sopenharmony_ci BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, 2188c2ecf20Sopenharmony_ci offsetof(struct xdp_md, data_meta)), 2198c2ecf20Sopenharmony_ci BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1, offsetof(struct xdp_md, data)), 2208c2ecf20Sopenharmony_ci BPF_LDX_MEM(BPF_W, BPF_REG_4, BPF_REG_1, 2218c2ecf20Sopenharmony_ci offsetof(struct xdp_md, data_end)), 2228c2ecf20Sopenharmony_ci BPF_MOV64_REG(BPF_REG_5, BPF_REG_3), 2238c2ecf20Sopenharmony_ci BPF_ALU64_IMM(BPF_ADD, BPF_REG_5, 16), 2248c2ecf20Sopenharmony_ci BPF_JMP_REG(BPF_JGT, BPF_REG_5, BPF_REG_4, 5), 2258c2ecf20Sopenharmony_ci BPF_LDX_MEM(BPF_B, BPF_REG_0, BPF_REG_3, 0), 2268c2ecf20Sopenharmony_ci BPF_MOV64_REG(BPF_REG_5, BPF_REG_2), 2278c2ecf20Sopenharmony_ci BPF_ALU64_IMM(BPF_ADD, BPF_REG_5, 16), 2288c2ecf20Sopenharmony_ci BPF_JMP_REG(BPF_JGT, BPF_REG_5, BPF_REG_3, 1), 2298c2ecf20Sopenharmony_ci BPF_LDX_MEM(BPF_B, BPF_REG_0, BPF_REG_2, 0), 2308c2ecf20Sopenharmony_ci BPF_MOV64_IMM(BPF_REG_0, 0), 2318c2ecf20Sopenharmony_ci BPF_EXIT_INSN(), 2328c2ecf20Sopenharmony_ci }, 2338c2ecf20Sopenharmony_ci .result = ACCEPT, 2348c2ecf20Sopenharmony_ci .prog_type = BPF_PROG_TYPE_XDP, 2358c2ecf20Sopenharmony_ci}, 236