140f2fbd5SJakub Kicinski { 240f2fbd5SJakub Kicinski "jump test 1", 340f2fbd5SJakub Kicinski .insns = { 440f2fbd5SJakub Kicinski BPF_MOV64_REG(BPF_REG_2, BPF_REG_10), 540f2fbd5SJakub Kicinski BPF_STX_MEM(BPF_DW, BPF_REG_2, BPF_REG_1, -8), 640f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, 0, 1), 740f2fbd5SJakub Kicinski BPF_ST_MEM(BPF_DW, BPF_REG_2, -8, 0), 840f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, 1, 1), 940f2fbd5SJakub Kicinski BPF_ST_MEM(BPF_DW, BPF_REG_2, -16, 1), 1040f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, 2, 1), 1140f2fbd5SJakub Kicinski BPF_ST_MEM(BPF_DW, BPF_REG_2, -8, 2), 1240f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, 3, 1), 1340f2fbd5SJakub Kicinski BPF_ST_MEM(BPF_DW, BPF_REG_2, -16, 3), 1440f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, 4, 1), 1540f2fbd5SJakub Kicinski BPF_ST_MEM(BPF_DW, BPF_REG_2, -8, 4), 1640f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, 5, 1), 1740f2fbd5SJakub Kicinski BPF_ST_MEM(BPF_DW, BPF_REG_2, -32, 5), 1840f2fbd5SJakub Kicinski BPF_MOV64_IMM(BPF_REG_0, 0), 1940f2fbd5SJakub Kicinski BPF_EXIT_INSN(), 2040f2fbd5SJakub Kicinski }, 2140f2fbd5SJakub Kicinski .errstr_unpriv = "R1 pointer comparison", 2240f2fbd5SJakub Kicinski .result_unpriv = REJECT, 2340f2fbd5SJakub Kicinski .result = ACCEPT, 2440f2fbd5SJakub Kicinski }, 2540f2fbd5SJakub Kicinski { 2640f2fbd5SJakub Kicinski "jump test 2", 2740f2fbd5SJakub Kicinski .insns = { 2840f2fbd5SJakub Kicinski BPF_MOV64_REG(BPF_REG_2, BPF_REG_10), 2940f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, 0, 2), 3040f2fbd5SJakub Kicinski BPF_ST_MEM(BPF_DW, BPF_REG_2, -8, 0), 3140f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JA, 0, 0, 14), 3240f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, 1, 2), 3340f2fbd5SJakub Kicinski BPF_ST_MEM(BPF_DW, BPF_REG_2, -16, 0), 3440f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JA, 0, 0, 11), 3540f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, 2, 2), 3640f2fbd5SJakub Kicinski BPF_ST_MEM(BPF_DW, BPF_REG_2, -32, 0), 3740f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JA, 0, 0, 8), 3840f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, 3, 2), 3940f2fbd5SJakub Kicinski BPF_ST_MEM(BPF_DW, BPF_REG_2, -40, 0), 4040f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JA, 0, 0, 5), 4140f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, 4, 2), 4240f2fbd5SJakub Kicinski BPF_ST_MEM(BPF_DW, BPF_REG_2, -48, 0), 4340f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JA, 0, 0, 2), 4440f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, 5, 1), 4540f2fbd5SJakub Kicinski BPF_ST_MEM(BPF_DW, BPF_REG_2, -56, 0), 4640f2fbd5SJakub Kicinski BPF_MOV64_IMM(BPF_REG_0, 0), 4740f2fbd5SJakub Kicinski BPF_EXIT_INSN(), 4840f2fbd5SJakub Kicinski }, 4940f2fbd5SJakub Kicinski .errstr_unpriv = "R1 pointer comparison", 5040f2fbd5SJakub Kicinski .result_unpriv = REJECT, 5140f2fbd5SJakub Kicinski .result = ACCEPT, 5240f2fbd5SJakub Kicinski }, 5340f2fbd5SJakub Kicinski { 5440f2fbd5SJakub Kicinski "jump test 3", 5540f2fbd5SJakub Kicinski .insns = { 5640f2fbd5SJakub Kicinski BPF_MOV64_REG(BPF_REG_2, BPF_REG_10), 5740f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, 0, 3), 5840f2fbd5SJakub Kicinski BPF_ST_MEM(BPF_DW, BPF_REG_2, -8, 0), 5940f2fbd5SJakub Kicinski BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -8), 6040f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JA, 0, 0, 19), 6140f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, 1, 3), 6240f2fbd5SJakub Kicinski BPF_ST_MEM(BPF_DW, BPF_REG_2, -16, 0), 6340f2fbd5SJakub Kicinski BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -16), 6440f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JA, 0, 0, 15), 6540f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, 2, 3), 6640f2fbd5SJakub Kicinski BPF_ST_MEM(BPF_DW, BPF_REG_2, -32, 0), 6740f2fbd5SJakub Kicinski BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -32), 6840f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JA, 0, 0, 11), 6940f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, 3, 3), 7040f2fbd5SJakub Kicinski BPF_ST_MEM(BPF_DW, BPF_REG_2, -40, 0), 7140f2fbd5SJakub Kicinski BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -40), 7240f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JA, 0, 0, 7), 7340f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, 4, 3), 7440f2fbd5SJakub Kicinski BPF_ST_MEM(BPF_DW, BPF_REG_2, -48, 0), 7540f2fbd5SJakub Kicinski BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -48), 7640f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JA, 0, 0, 3), 7740f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, 5, 0), 7840f2fbd5SJakub Kicinski BPF_ST_MEM(BPF_DW, BPF_REG_2, -56, 0), 7940f2fbd5SJakub Kicinski BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -56), 8040f2fbd5SJakub Kicinski BPF_LD_MAP_FD(BPF_REG_1, 0), 8140f2fbd5SJakub Kicinski BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0, BPF_FUNC_map_delete_elem), 8240f2fbd5SJakub Kicinski BPF_EXIT_INSN(), 8340f2fbd5SJakub Kicinski }, 8440f2fbd5SJakub Kicinski .fixup_map_hash_8b = { 24 }, 8540f2fbd5SJakub Kicinski .errstr_unpriv = "R1 pointer comparison", 8640f2fbd5SJakub Kicinski .result_unpriv = REJECT, 8740f2fbd5SJakub Kicinski .result = ACCEPT, 8840f2fbd5SJakub Kicinski .retval = -ENOENT, 8940f2fbd5SJakub Kicinski }, 9040f2fbd5SJakub Kicinski { 9140f2fbd5SJakub Kicinski "jump test 4", 9240f2fbd5SJakub Kicinski .insns = { 9340f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 1), 9440f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 2), 9540f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 3), 9640f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 4), 9740f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 1), 9840f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 2), 9940f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 3), 10040f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 4), 10140f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 1), 10240f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 2), 10340f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 3), 10440f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 4), 10540f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 1), 10640f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 2), 10740f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 3), 10840f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 4), 10940f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 1), 11040f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 2), 11140f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 3), 11240f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 4), 11340f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 1), 11440f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 2), 11540f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 3), 11640f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 4), 11740f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 1), 11840f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 2), 11940f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 3), 12040f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 4), 12140f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 1), 12240f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 2), 12340f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 3), 12440f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 4), 12540f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 1), 12640f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 2), 12740f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 3), 12840f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 4), 12940f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 0), 13040f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 0), 13140f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 0), 13240f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, BPF_REG_10, 0), 13340f2fbd5SJakub Kicinski BPF_MOV64_IMM(BPF_REG_0, 0), 13440f2fbd5SJakub Kicinski BPF_EXIT_INSN(), 13540f2fbd5SJakub Kicinski }, 13640f2fbd5SJakub Kicinski .errstr_unpriv = "R1 pointer comparison", 13740f2fbd5SJakub Kicinski .result_unpriv = REJECT, 13840f2fbd5SJakub Kicinski .result = ACCEPT, 13940f2fbd5SJakub Kicinski }, 14040f2fbd5SJakub Kicinski { 14140f2fbd5SJakub Kicinski "jump test 5", 14240f2fbd5SJakub Kicinski .insns = { 14340f2fbd5SJakub Kicinski BPF_MOV64_REG(BPF_REG_2, BPF_REG_10), 14440f2fbd5SJakub Kicinski BPF_MOV64_REG(BPF_REG_3, BPF_REG_2), 14540f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JGE, BPF_REG_1, 0, 2), 14640f2fbd5SJakub Kicinski BPF_STX_MEM(BPF_DW, BPF_REG_2, BPF_REG_3, -8), 14740f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JA, 0, 0, 2), 14840f2fbd5SJakub Kicinski BPF_STX_MEM(BPF_DW, BPF_REG_2, BPF_REG_2, -8), 14940f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JA, 0, 0, 0), 15040f2fbd5SJakub Kicinski BPF_MOV64_IMM(BPF_REG_0, 0), 15140f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JGE, BPF_REG_1, 0, 2), 15240f2fbd5SJakub Kicinski BPF_STX_MEM(BPF_DW, BPF_REG_2, BPF_REG_3, -8), 15340f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JA, 0, 0, 2), 15440f2fbd5SJakub Kicinski BPF_STX_MEM(BPF_DW, BPF_REG_2, BPF_REG_2, -8), 15540f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JA, 0, 0, 0), 15640f2fbd5SJakub Kicinski BPF_MOV64_IMM(BPF_REG_0, 0), 15740f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JGE, BPF_REG_1, 0, 2), 15840f2fbd5SJakub Kicinski BPF_STX_MEM(BPF_DW, BPF_REG_2, BPF_REG_3, -8), 15940f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JA, 0, 0, 2), 16040f2fbd5SJakub Kicinski BPF_STX_MEM(BPF_DW, BPF_REG_2, BPF_REG_2, -8), 16140f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JA, 0, 0, 0), 16240f2fbd5SJakub Kicinski BPF_MOV64_IMM(BPF_REG_0, 0), 16340f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JGE, BPF_REG_1, 0, 2), 16440f2fbd5SJakub Kicinski BPF_STX_MEM(BPF_DW, BPF_REG_2, BPF_REG_3, -8), 16540f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JA, 0, 0, 2), 16640f2fbd5SJakub Kicinski BPF_STX_MEM(BPF_DW, BPF_REG_2, BPF_REG_2, -8), 16740f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JA, 0, 0, 0), 16840f2fbd5SJakub Kicinski BPF_MOV64_IMM(BPF_REG_0, 0), 16940f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JGE, BPF_REG_1, 0, 2), 17040f2fbd5SJakub Kicinski BPF_STX_MEM(BPF_DW, BPF_REG_2, BPF_REG_3, -8), 17140f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JA, 0, 0, 2), 17240f2fbd5SJakub Kicinski BPF_STX_MEM(BPF_DW, BPF_REG_2, BPF_REG_2, -8), 17340f2fbd5SJakub Kicinski BPF_JMP_IMM(BPF_JA, 0, 0, 0), 17440f2fbd5SJakub Kicinski BPF_MOV64_IMM(BPF_REG_0, 0), 17540f2fbd5SJakub Kicinski BPF_EXIT_INSN(), 17640f2fbd5SJakub Kicinski }, 17740f2fbd5SJakub Kicinski .errstr_unpriv = "R1 pointer comparison", 17840f2fbd5SJakub Kicinski .result_unpriv = REJECT, 17940f2fbd5SJakub Kicinski .result = ACCEPT, 18040f2fbd5SJakub Kicinski }, 18198583812SDaniel Borkmann { 18298583812SDaniel Borkmann "jump test 6", 18398583812SDaniel Borkmann .insns = { 18498583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 1), 18598583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_1, 2), 18698583812SDaniel Borkmann BPF_JMP_IMM(BPF_JA, 0, 0, 2), 18798583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 2), 18898583812SDaniel Borkmann BPF_EXIT_INSN(), 18998583812SDaniel Borkmann BPF_JMP_REG(BPF_JNE, BPF_REG_0, BPF_REG_1, 16), 19098583812SDaniel Borkmann BPF_JMP_IMM(BPF_JA, 0, 0, 0), 19198583812SDaniel Borkmann BPF_JMP_IMM(BPF_JA, 0, 0, 0), 19298583812SDaniel Borkmann BPF_JMP_IMM(BPF_JA, 0, 0, 0), 19398583812SDaniel Borkmann BPF_JMP_IMM(BPF_JA, 0, 0, 0), 19498583812SDaniel Borkmann BPF_JMP_IMM(BPF_JA, 0, 0, 0), 19598583812SDaniel Borkmann BPF_JMP_IMM(BPF_JA, 0, 0, 0), 19698583812SDaniel Borkmann BPF_JMP_IMM(BPF_JA, 0, 0, 0), 19798583812SDaniel Borkmann BPF_JMP_IMM(BPF_JA, 0, 0, 0), 19898583812SDaniel Borkmann BPF_JMP_IMM(BPF_JA, 0, 0, 0), 19998583812SDaniel Borkmann BPF_JMP_IMM(BPF_JA, 0, 0, 0), 20098583812SDaniel Borkmann BPF_JMP_IMM(BPF_JA, 0, 0, 0), 20198583812SDaniel Borkmann BPF_JMP_IMM(BPF_JA, 0, 0, 0), 20298583812SDaniel Borkmann BPF_JMP_IMM(BPF_JA, 0, 0, 0), 20398583812SDaniel Borkmann BPF_JMP_IMM(BPF_JA, 0, 0, 0), 20498583812SDaniel Borkmann BPF_JMP_IMM(BPF_JA, 0, 0, 0), 20598583812SDaniel Borkmann BPF_JMP_IMM(BPF_JA, 0, 0, 0), 20698583812SDaniel Borkmann BPF_JMP_IMM(BPF_JA, 0, 0, -20), 20798583812SDaniel Borkmann }, 20898583812SDaniel Borkmann .result = ACCEPT, 20998583812SDaniel Borkmann .retval = 2, 21098583812SDaniel Borkmann }, 21198583812SDaniel Borkmann { 21298583812SDaniel Borkmann "jump test 7", 21398583812SDaniel Borkmann .insns = { 21498583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 1), 21598583812SDaniel Borkmann BPF_JMP_IMM(BPF_JA, 0, 0, 2), 21698583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 3), 21798583812SDaniel Borkmann BPF_EXIT_INSN(), 21898583812SDaniel Borkmann BPF_JMP_IMM(BPF_JNE, BPF_REG_0, 2, 16), 21998583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 22098583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 22198583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 22298583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 22398583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 22498583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 22598583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 22698583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 22798583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 22898583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 22998583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 23098583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 23198583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 23298583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 23398583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 23498583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 23598583812SDaniel Borkmann BPF_JMP_IMM(BPF_JA, 0, 0, -20), 23698583812SDaniel Borkmann }, 23798583812SDaniel Borkmann .result = ACCEPT, 23898583812SDaniel Borkmann .retval = 3, 23998583812SDaniel Borkmann }, 24098583812SDaniel Borkmann { 24198583812SDaniel Borkmann "jump test 8", 24298583812SDaniel Borkmann .insns = { 24398583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 1), 24498583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_1, 2), 24598583812SDaniel Borkmann BPF_JMP_IMM(BPF_JA, 0, 0, 2), 24698583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 3), 24798583812SDaniel Borkmann BPF_EXIT_INSN(), 24898583812SDaniel Borkmann BPF_JMP_REG(BPF_JNE, BPF_REG_0, BPF_REG_1, 16), 24998583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 25098583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 25198583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 25298583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 25398583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 25498583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 25598583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 25698583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 25798583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 25898583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 25998583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 26098583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 26198583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 26298583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 26398583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 26498583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 26598583812SDaniel Borkmann BPF_JMP_IMM(BPF_JA, 0, 0, -20), 26698583812SDaniel Borkmann }, 26798583812SDaniel Borkmann .result = ACCEPT, 26898583812SDaniel Borkmann .retval = 3, 26998583812SDaniel Borkmann }, 27098583812SDaniel Borkmann { 27198583812SDaniel Borkmann "jump/call test 9", 27298583812SDaniel Borkmann .insns = { 27398583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 1), 27498583812SDaniel Borkmann BPF_JMP_IMM(BPF_JA, 0, 0, 2), 27598583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 3), 27698583812SDaniel Borkmann BPF_EXIT_INSN(), 27798583812SDaniel Borkmann BPF_JMP_IMM(BPF_JNE, BPF_REG_0, 2, 16), 27898583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 27998583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 28098583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 28198583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 28298583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 28398583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 28498583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 28598583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 28698583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 28798583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 28898583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 28998583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 29098583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 29198583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 29298583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 29398583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 29498583812SDaniel Borkmann BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 1, 0, -20), 29598583812SDaniel Borkmann BPF_EXIT_INSN(), 29698583812SDaniel Borkmann }, 29798583812SDaniel Borkmann .prog_type = BPF_PROG_TYPE_SCHED_CLS, 29898583812SDaniel Borkmann .result = REJECT, 29998583812SDaniel Borkmann .errstr = "jump out of range from insn 1 to 4", 30098583812SDaniel Borkmann }, 30198583812SDaniel Borkmann { 30298583812SDaniel Borkmann "jump/call test 10", 30398583812SDaniel Borkmann .insns = { 30498583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 1), 30598583812SDaniel Borkmann BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 1, 0, 2), 30698583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 3), 30798583812SDaniel Borkmann BPF_EXIT_INSN(), 30898583812SDaniel Borkmann BPF_JMP_IMM(BPF_JNE, BPF_REG_0, 2, 16), 30998583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 31098583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 31198583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 31298583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 31398583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 31498583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 31598583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 31698583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 31798583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 31898583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 31998583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 32098583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 32198583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 32298583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 32398583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 32498583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 32598583812SDaniel Borkmann BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 1, 0, -20), 32698583812SDaniel Borkmann BPF_EXIT_INSN(), 32798583812SDaniel Borkmann }, 32898583812SDaniel Borkmann .prog_type = BPF_PROG_TYPE_SCHED_CLS, 32998583812SDaniel Borkmann .result = REJECT, 33098583812SDaniel Borkmann .errstr = "last insn is not an exit or jmp", 33198583812SDaniel Borkmann }, 33298583812SDaniel Borkmann { 33398583812SDaniel Borkmann "jump/call test 11", 33498583812SDaniel Borkmann .insns = { 33598583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 1), 33698583812SDaniel Borkmann BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 1, 0, 4), 33798583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 3), 33898583812SDaniel Borkmann BPF_EXIT_INSN(), 33998583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 3), 34098583812SDaniel Borkmann BPF_EXIT_INSN(), 34198583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 1), 34298583812SDaniel Borkmann BPF_JMP_IMM(BPF_JNE, BPF_REG_0, 2, 26), 34398583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 34498583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 34598583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 34698583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 34798583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 34898583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 34998583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 35098583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 35198583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 35298583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 35398583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 35498583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 35598583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 35698583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 35798583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 35898583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 35998583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 36098583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 36198583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 36298583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 36398583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 36498583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 36598583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 36698583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 36798583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 36898583812SDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 42), 36998583812SDaniel Borkmann BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 1, 0, -31), 37098583812SDaniel Borkmann BPF_EXIT_INSN(), 37198583812SDaniel Borkmann }, 37298583812SDaniel Borkmann .prog_type = BPF_PROG_TYPE_SCHED_CLS, 37398583812SDaniel Borkmann .result = ACCEPT, 37498583812SDaniel Borkmann .retval = 3, 37598583812SDaniel Borkmann }, 376*73c4936fSDaniel Borkmann { 377*73c4936fSDaniel Borkmann "jump & dead code elimination", 378*73c4936fSDaniel Borkmann .insns = { 379*73c4936fSDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 1), 380*73c4936fSDaniel Borkmann BPF_MOV64_IMM(BPF_REG_3, 0), 381*73c4936fSDaniel Borkmann BPF_ALU64_IMM(BPF_NEG, BPF_REG_3, 0), 382*73c4936fSDaniel Borkmann BPF_ALU64_IMM(BPF_NEG, BPF_REG_3, 0), 383*73c4936fSDaniel Borkmann BPF_ALU64_IMM(BPF_OR, BPF_REG_3, 32767), 384*73c4936fSDaniel Borkmann BPF_JMP_IMM(BPF_JSGE, BPF_REG_3, 0, 1), 385*73c4936fSDaniel Borkmann BPF_EXIT_INSN(), 386*73c4936fSDaniel Borkmann BPF_JMP_IMM(BPF_JSLE, BPF_REG_3, 0x8000, 1), 387*73c4936fSDaniel Borkmann BPF_EXIT_INSN(), 388*73c4936fSDaniel Borkmann BPF_ALU64_IMM(BPF_ADD, BPF_REG_3, -32767), 389*73c4936fSDaniel Borkmann BPF_MOV64_IMM(BPF_REG_0, 2), 390*73c4936fSDaniel Borkmann BPF_JMP_IMM(BPF_JLE, BPF_REG_3, 0, 1), 391*73c4936fSDaniel Borkmann BPF_MOV64_REG(BPF_REG_0, BPF_REG_4), 392*73c4936fSDaniel Borkmann BPF_EXIT_INSN(), 393*73c4936fSDaniel Borkmann }, 394*73c4936fSDaniel Borkmann .prog_type = BPF_PROG_TYPE_SCHED_CLS, 395*73c4936fSDaniel Borkmann .result = ACCEPT, 396*73c4936fSDaniel Borkmann .retval = 2, 397*73c4936fSDaniel Borkmann }, 398