1 { 2 "jit: lsh, rsh, arsh by 1", 3 .insns = { 4 BPF_MOV64_IMM(BPF_REG_0, 1), 5 BPF_MOV64_IMM(BPF_REG_1, 0xff), 6 BPF_ALU64_IMM(BPF_LSH, BPF_REG_1, 1), 7 BPF_ALU32_IMM(BPF_LSH, BPF_REG_1, 1), 8 BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, 0x3fc, 1), 9 BPF_EXIT_INSN(), 10 BPF_ALU64_IMM(BPF_RSH, BPF_REG_1, 1), 11 BPF_ALU32_IMM(BPF_RSH, BPF_REG_1, 1), 12 BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, 0xff, 1), 13 BPF_EXIT_INSN(), 14 BPF_ALU64_IMM(BPF_ARSH, BPF_REG_1, 1), 15 BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, 0x7f, 1), 16 BPF_EXIT_INSN(), 17 BPF_MOV64_IMM(BPF_REG_0, 2), 18 BPF_EXIT_INSN(), 19 }, 20 .result = ACCEPT, 21 .retval = 2, 22 }, 23 { 24 "jit: mov32 for ldimm64, 1", 25 .insns = { 26 BPF_MOV64_IMM(BPF_REG_0, 2), 27 BPF_LD_IMM64(BPF_REG_1, 0xfeffffffffffffffULL), 28 BPF_ALU64_IMM(BPF_RSH, BPF_REG_1, 32), 29 BPF_LD_IMM64(BPF_REG_2, 0xfeffffffULL), 30 BPF_JMP_REG(BPF_JEQ, BPF_REG_1, BPF_REG_2, 1), 31 BPF_MOV64_IMM(BPF_REG_0, 1), 32 BPF_EXIT_INSN(), 33 }, 34 .result = ACCEPT, 35 .retval = 2, 36 }, 37 { 38 "jit: mov32 for ldimm64, 2", 39 .insns = { 40 BPF_MOV64_IMM(BPF_REG_0, 1), 41 BPF_LD_IMM64(BPF_REG_1, 0x1ffffffffULL), 42 BPF_LD_IMM64(BPF_REG_2, 0xffffffffULL), 43 BPF_JMP_REG(BPF_JEQ, BPF_REG_1, BPF_REG_2, 1), 44 BPF_MOV64_IMM(BPF_REG_0, 2), 45 BPF_EXIT_INSN(), 46 }, 47 .result = ACCEPT, 48 .retval = 2, 49 }, 50 { 51 "jit: various mul tests", 52 .insns = { 53 BPF_LD_IMM64(BPF_REG_2, 0xeeff0d413122ULL), 54 BPF_LD_IMM64(BPF_REG_0, 0xfefefeULL), 55 BPF_LD_IMM64(BPF_REG_1, 0xefefefULL), 56 BPF_ALU64_REG(BPF_MUL, BPF_REG_0, BPF_REG_1), 57 BPF_JMP_REG(BPF_JEQ, BPF_REG_0, BPF_REG_2, 2), 58 BPF_MOV64_IMM(BPF_REG_0, 1), 59 BPF_EXIT_INSN(), 60 BPF_LD_IMM64(BPF_REG_3, 0xfefefeULL), 61 BPF_ALU64_REG(BPF_MUL, BPF_REG_3, BPF_REG_1), 62 BPF_JMP_REG(BPF_JEQ, BPF_REG_3, BPF_REG_2, 2), 63 BPF_MOV64_IMM(BPF_REG_0, 1), 64 BPF_EXIT_INSN(), 65 BPF_LD_IMM64(BPF_REG_3, 0xfefefeULL), 66 BPF_ALU64_IMM(BPF_MUL, BPF_REG_3, 0xefefef), 67 BPF_JMP_REG(BPF_JEQ, BPF_REG_3, BPF_REG_2, 2), 68 BPF_MOV64_IMM(BPF_REG_0, 1), 69 BPF_EXIT_INSN(), 70 BPF_MOV32_REG(BPF_REG_2, BPF_REG_2), 71 BPF_LD_IMM64(BPF_REG_0, 0xfefefeULL), 72 BPF_ALU32_REG(BPF_MUL, BPF_REG_0, BPF_REG_1), 73 BPF_JMP_REG(BPF_JEQ, BPF_REG_0, BPF_REG_2, 2), 74 BPF_MOV64_IMM(BPF_REG_0, 1), 75 BPF_EXIT_INSN(), 76 BPF_LD_IMM64(BPF_REG_3, 0xfefefeULL), 77 BPF_ALU32_REG(BPF_MUL, BPF_REG_3, BPF_REG_1), 78 BPF_JMP_REG(BPF_JEQ, BPF_REG_3, BPF_REG_2, 2), 79 BPF_MOV64_IMM(BPF_REG_0, 1), 80 BPF_EXIT_INSN(), 81 BPF_LD_IMM64(BPF_REG_3, 0xfefefeULL), 82 BPF_ALU32_IMM(BPF_MUL, BPF_REG_3, 0xefefef), 83 BPF_JMP_REG(BPF_JEQ, BPF_REG_3, BPF_REG_2, 2), 84 BPF_MOV64_IMM(BPF_REG_0, 1), 85 BPF_EXIT_INSN(), 86 BPF_LD_IMM64(BPF_REG_0, 0xfefefeULL), 87 BPF_LD_IMM64(BPF_REG_2, 0x2ad4d4aaULL), 88 BPF_ALU32_IMM(BPF_MUL, BPF_REG_0, 0x2b), 89 BPF_JMP_REG(BPF_JEQ, BPF_REG_0, BPF_REG_2, 2), 90 BPF_MOV64_IMM(BPF_REG_0, 1), 91 BPF_EXIT_INSN(), 92 BPF_LD_IMM64(BPF_REG_0, 0x952a7bbcULL), 93 BPF_LD_IMM64(BPF_REG_1, 0xfefefeULL), 94 BPF_LD_IMM64(BPF_REG_5, 0xeeff0d413122ULL), 95 BPF_ALU32_REG(BPF_MUL, BPF_REG_5, BPF_REG_1), 96 BPF_JMP_REG(BPF_JEQ, BPF_REG_5, BPF_REG_0, 2), 97 BPF_MOV64_IMM(BPF_REG_0, 1), 98 BPF_EXIT_INSN(), 99 BPF_MOV64_IMM(BPF_REG_0, 2), 100 BPF_EXIT_INSN(), 101 }, 102 .result = ACCEPT, 103 .retval = 2, 104 }, 105 { 106 "jit: various div tests", 107 .insns = { 108 BPF_LD_IMM64(BPF_REG_2, 0xefeffeULL), 109 BPF_LD_IMM64(BPF_REG_0, 0xeeff0d413122ULL), 110 BPF_LD_IMM64(BPF_REG_1, 0xfefeeeULL), 111 BPF_ALU64_REG(BPF_DIV, BPF_REG_0, BPF_REG_1), 112 BPF_JMP_REG(BPF_JEQ, BPF_REG_0, BPF_REG_2, 2), 113 BPF_MOV64_IMM(BPF_REG_0, 1), 114 BPF_EXIT_INSN(), 115 BPF_LD_IMM64(BPF_REG_3, 0xeeff0d413122ULL), 116 BPF_ALU64_IMM(BPF_DIV, BPF_REG_3, 0xfefeeeULL), 117 BPF_JMP_REG(BPF_JEQ, BPF_REG_3, BPF_REG_2, 2), 118 BPF_MOV64_IMM(BPF_REG_0, 1), 119 BPF_EXIT_INSN(), 120 BPF_LD_IMM64(BPF_REG_2, 0xaa93ULL), 121 BPF_ALU64_IMM(BPF_MOD, BPF_REG_1, 0xbeefULL), 122 BPF_JMP_REG(BPF_JEQ, BPF_REG_1, BPF_REG_2, 2), 123 BPF_MOV64_IMM(BPF_REG_0, 1), 124 BPF_EXIT_INSN(), 125 BPF_LD_IMM64(BPF_REG_1, 0xfefeeeULL), 126 BPF_LD_IMM64(BPF_REG_3, 0xbeefULL), 127 BPF_ALU64_REG(BPF_MOD, BPF_REG_1, BPF_REG_3), 128 BPF_JMP_REG(BPF_JEQ, BPF_REG_1, BPF_REG_2, 2), 129 BPF_MOV64_IMM(BPF_REG_0, 1), 130 BPF_EXIT_INSN(), 131 BPF_LD_IMM64(BPF_REG_2, 0x5ee1dULL), 132 BPF_LD_IMM64(BPF_REG_1, 0xfefeeeULL), 133 BPF_LD_IMM64(BPF_REG_3, 0x2bULL), 134 BPF_ALU32_REG(BPF_DIV, BPF_REG_1, BPF_REG_3), 135 BPF_JMP_REG(BPF_JEQ, BPF_REG_1, BPF_REG_2, 2), 136 BPF_MOV64_IMM(BPF_REG_0, 1), 137 BPF_EXIT_INSN(), 138 BPF_ALU32_REG(BPF_DIV, BPF_REG_1, BPF_REG_1), 139 BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, 1, 2), 140 BPF_MOV64_IMM(BPF_REG_0, 1), 141 BPF_EXIT_INSN(), 142 BPF_ALU64_REG(BPF_MOD, BPF_REG_2, BPF_REG_2), 143 BPF_JMP_IMM(BPF_JEQ, BPF_REG_2, 0, 2), 144 BPF_MOV64_IMM(BPF_REG_0, 1), 145 BPF_EXIT_INSN(), 146 BPF_MOV64_IMM(BPF_REG_0, 2), 147 BPF_EXIT_INSN(), 148 }, 149 .result = ACCEPT, 150 .retval = 2, 151 }, 152 { 153 "jit: jsgt, jslt", 154 .insns = { 155 BPF_LD_IMM64(BPF_REG_1, 0x80000000ULL), 156 BPF_LD_IMM64(BPF_REG_2, 0x0ULL), 157 BPF_JMP_REG(BPF_JSGT, BPF_REG_1, BPF_REG_2, 2), 158 BPF_MOV64_IMM(BPF_REG_0, 1), 159 BPF_EXIT_INSN(), 160 161 BPF_JMP_REG(BPF_JSLT, BPF_REG_2, BPF_REG_1, 2), 162 BPF_MOV64_IMM(BPF_REG_0, 1), 163 BPF_EXIT_INSN(), 164 165 BPF_MOV64_IMM(BPF_REG_0, 2), 166 BPF_EXIT_INSN(), 167 }, 168 .result = ACCEPT, 169 .retval = 2, 170 }, 171 { 172 "jit: torturous jumps, imm8 nop jmp and pure jump padding", 173 .insns = { }, 174 .fill_helper = bpf_fill_torturous_jumps, 175 .prog_type = BPF_PROG_TYPE_SCHED_CLS, 176 .result = ACCEPT, 177 .retval = 1, 178 }, 179 { 180 "jit: torturous jumps, imm32 nop jmp and jmp_cond padding", 181 .insns = { }, 182 .fill_helper = bpf_fill_torturous_jumps, 183 .prog_type = BPF_PROG_TYPE_SCHED_CLS, 184 .result = ACCEPT, 185 .retval = 2, 186 }, 187 { 188 "jit: torturous jumps in subprog", 189 .insns = { }, 190 .fill_helper = bpf_fill_torturous_jumps, 191 .prog_type = BPF_PROG_TYPE_SCHED_CLS, 192 .result = ACCEPT, 193 .retval = 3, 194 }, 195