1 /* This file contains sub-register zero extension checks for insns defining
2 * sub-registers, meaning:
3 * - All insns under BPF_ALU class. Their BPF_ALU32 variants or narrow width
4 * forms (BPF_END) could define sub-registers.
5 * - Narrow direct loads, BPF_B/H/W | BPF_LDX.
6 * - BPF_LD is not exposed to JIT back-ends, so no need for testing.
8 * "get_prandom_u32" is used to initialize low 32-bit of some registers to
9 * prevent potential optimizations done by verifier or JIT back-ends which could
10 * optimize register back into constant when range info shows one register is a
14 "add32 reg zero extend check",
16 BPF_RAW_INSN(BPF_JMP
| BPF_CALL
, 0, 0, 0, BPF_FUNC_get_prandom_u32
),
17 BPF_MOV64_REG(BPF_REG_1
, BPF_REG_0
),
18 BPF_LD_IMM64(BPF_REG_0
, 0x100000000ULL
),
19 BPF_ALU32_REG(BPF_ADD
, BPF_REG_0
, BPF_REG_1
),
20 BPF_ALU64_IMM(BPF_RSH
, BPF_REG_0
, 32),
27 "add32 imm zero extend check",
29 BPF_RAW_INSN(BPF_JMP
| BPF_CALL
, 0, 0, 0, BPF_FUNC_get_prandom_u32
),
30 BPF_LD_IMM64(BPF_REG_1
, 0x1000000000ULL
),
31 BPF_ALU64_REG(BPF_OR
, BPF_REG_0
, BPF_REG_1
),
32 /* An insn could have no effect on the low 32-bit, for example:
36 * But, they should still zero high 32-bit.
38 BPF_ALU32_IMM(BPF_ADD
, BPF_REG_0
, 0),
39 BPF_ALU64_IMM(BPF_RSH
, BPF_REG_0
, 32),
40 BPF_MOV64_REG(BPF_REG_6
, BPF_REG_0
),
41 BPF_RAW_INSN(BPF_JMP
| BPF_CALL
, 0, 0, 0, BPF_FUNC_get_prandom_u32
),
42 BPF_LD_IMM64(BPF_REG_1
, 0x1000000000ULL
),
43 BPF_ALU64_REG(BPF_OR
, BPF_REG_0
, BPF_REG_1
),
44 BPF_ALU32_IMM(BPF_ADD
, BPF_REG_0
, -2),
45 BPF_ALU64_IMM(BPF_RSH
, BPF_REG_0
, 32),
46 BPF_ALU64_REG(BPF_OR
, BPF_REG_0
, BPF_REG_6
),
53 "sub32 reg zero extend check",
55 BPF_RAW_INSN(BPF_JMP
| BPF_CALL
, 0, 0, 0, BPF_FUNC_get_prandom_u32
),
56 BPF_MOV64_REG(BPF_REG_1
, BPF_REG_0
),
57 BPF_LD_IMM64(BPF_REG_0
, 0x1ffffffffULL
),
58 BPF_ALU32_REG(BPF_SUB
, BPF_REG_0
, BPF_REG_1
),
59 BPF_ALU64_IMM(BPF_RSH
, BPF_REG_0
, 32),
66 "sub32 imm zero extend check",
68 BPF_RAW_INSN(BPF_JMP
| BPF_CALL
, 0, 0, 0, BPF_FUNC_get_prandom_u32
),
69 BPF_LD_IMM64(BPF_REG_1
, 0x1000000000ULL
),
70 BPF_ALU64_REG(BPF_OR
, BPF_REG_0
, BPF_REG_1
),
71 BPF_ALU32_IMM(BPF_SUB
, BPF_REG_0
, 0),
72 BPF_ALU64_IMM(BPF_RSH
, BPF_REG_0
, 32),
73 BPF_MOV64_REG(BPF_REG_6
, BPF_REG_0
),
74 BPF_RAW_INSN(BPF_JMP
| BPF_CALL
, 0, 0, 0, BPF_FUNC_get_prandom_u32
),
75 BPF_LD_IMM64(BPF_REG_1
, 0x1000000000ULL
),
76 BPF_ALU64_REG(BPF_OR
, BPF_REG_0
, BPF_REG_1
),
77 BPF_ALU32_IMM(BPF_SUB
, BPF_REG_0
, 1),
78 BPF_ALU64_IMM(BPF_RSH
, BPF_REG_0
, 32),
79 BPF_ALU64_REG(BPF_OR
, BPF_REG_0
, BPF_REG_6
),
86 "mul32 reg zero extend check",
88 BPF_RAW_INSN(BPF_JMP
| BPF_CALL
, 0, 0, 0, BPF_FUNC_get_prandom_u32
),
89 BPF_MOV64_REG(BPF_REG_1
, BPF_REG_0
),
90 BPF_LD_IMM64(BPF_REG_0
, 0x100000001ULL
),
91 BPF_ALU32_REG(BPF_MUL
, BPF_REG_0
, BPF_REG_1
),
92 BPF_ALU64_IMM(BPF_RSH
, BPF_REG_0
, 32),
99 "mul32 imm zero extend check",
101 BPF_RAW_INSN(BPF_JMP
| BPF_CALL
, 0, 0, 0, BPF_FUNC_get_prandom_u32
),
102 BPF_LD_IMM64(BPF_REG_1
, 0x1000000000ULL
),
103 BPF_ALU64_REG(BPF_OR
, BPF_REG_0
, BPF_REG_1
),
104 BPF_ALU32_IMM(BPF_MUL
, BPF_REG_0
, 1),
105 BPF_ALU64_IMM(BPF_RSH
, BPF_REG_0
, 32),
106 BPF_MOV64_REG(BPF_REG_6
, BPF_REG_0
),
107 BPF_RAW_INSN(BPF_JMP
| BPF_CALL
, 0, 0, 0, BPF_FUNC_get_prandom_u32
),
108 BPF_LD_IMM64(BPF_REG_1
, 0x1000000000ULL
),
109 BPF_ALU64_REG(BPF_OR
, BPF_REG_0
, BPF_REG_1
),
110 BPF_ALU32_IMM(BPF_MUL
, BPF_REG_0
, -1),
111 BPF_ALU64_IMM(BPF_RSH
, BPF_REG_0
, 32),
112 BPF_ALU64_REG(BPF_OR
, BPF_REG_0
, BPF_REG_6
),
119 "div32 reg zero extend check",
121 BPF_RAW_INSN(BPF_JMP
| BPF_CALL
, 0, 0, 0, BPF_FUNC_get_prandom_u32
),
122 BPF_MOV64_REG(BPF_REG_1
, BPF_REG_0
),
123 BPF_MOV64_IMM(BPF_REG_0
, -1),
124 BPF_ALU32_REG(BPF_DIV
, BPF_REG_0
, BPF_REG_1
),
125 BPF_ALU64_IMM(BPF_RSH
, BPF_REG_0
, 32),
132 "div32 imm zero extend check",
134 BPF_RAW_INSN(BPF_JMP
| BPF_CALL
, 0, 0, 0, BPF_FUNC_get_prandom_u32
),
135 BPF_LD_IMM64(BPF_REG_1
, 0x1000000000ULL
),
136 BPF_ALU64_REG(BPF_OR
, BPF_REG_0
, BPF_REG_1
),
137 BPF_ALU32_IMM(BPF_DIV
, BPF_REG_0
, 1),
138 BPF_ALU64_IMM(BPF_RSH
, BPF_REG_0
, 32),
139 BPF_MOV64_REG(BPF_REG_6
, BPF_REG_0
),
140 BPF_RAW_INSN(BPF_JMP
| BPF_CALL
, 0, 0, 0, BPF_FUNC_get_prandom_u32
),
141 BPF_LD_IMM64(BPF_REG_1
, 0x1000000000ULL
),
142 BPF_ALU64_REG(BPF_OR
, BPF_REG_0
, BPF_REG_1
),
143 BPF_ALU32_IMM(BPF_DIV
, BPF_REG_0
, 2),
144 BPF_ALU64_IMM(BPF_RSH
, BPF_REG_0
, 32),
145 BPF_ALU64_REG(BPF_OR
, BPF_REG_0
, BPF_REG_6
),
152 "or32 reg zero extend check",
154 BPF_RAW_INSN(BPF_JMP
| BPF_CALL
, 0, 0, 0, BPF_FUNC_get_prandom_u32
),
155 BPF_MOV64_REG(BPF_REG_1
, BPF_REG_0
),
156 BPF_LD_IMM64(BPF_REG_0
, 0x100000001ULL
),
157 BPF_ALU32_REG(BPF_OR
, BPF_REG_0
, BPF_REG_1
),
158 BPF_ALU64_IMM(BPF_RSH
, BPF_REG_0
, 32),
165 "or32 imm zero extend check",
167 BPF_RAW_INSN(BPF_JMP
| BPF_CALL
, 0, 0, 0, BPF_FUNC_get_prandom_u32
),
168 BPF_LD_IMM64(BPF_REG_1
, 0x1000000000ULL
),
169 BPF_ALU64_REG(BPF_OR
, BPF_REG_0
, BPF_REG_1
),
170 BPF_ALU32_IMM(BPF_OR
, BPF_REG_0
, 0),
171 BPF_ALU64_IMM(BPF_RSH
, BPF_REG_0
, 32),
172 BPF_MOV64_REG(BPF_REG_6
, BPF_REG_0
),
173 BPF_RAW_INSN(BPF_JMP
| BPF_CALL
, 0, 0, 0, BPF_FUNC_get_prandom_u32
),
174 BPF_LD_IMM64(BPF_REG_1
, 0x1000000000ULL
),
175 BPF_ALU64_REG(BPF_OR
, BPF_REG_0
, BPF_REG_1
),
176 BPF_ALU32_IMM(BPF_OR
, BPF_REG_0
, 1),
177 BPF_ALU64_IMM(BPF_RSH
, BPF_REG_0
, 32),
178 BPF_ALU64_REG(BPF_OR
, BPF_REG_0
, BPF_REG_6
),
185 "and32 reg zero extend check",
187 BPF_RAW_INSN(BPF_JMP
| BPF_CALL
, 0, 0, 0, BPF_FUNC_get_prandom_u32
),
188 BPF_LD_IMM64(BPF_REG_1
, 0x100000000ULL
),
189 BPF_ALU64_REG(BPF_OR
, BPF_REG_1
, BPF_REG_0
),
190 BPF_LD_IMM64(BPF_REG_0
, 0x1ffffffffULL
),
191 BPF_ALU32_REG(BPF_AND
, BPF_REG_0
, BPF_REG_1
),
192 BPF_ALU64_IMM(BPF_RSH
, BPF_REG_0
, 32),
199 "and32 imm zero extend check",
201 BPF_RAW_INSN(BPF_JMP
| BPF_CALL
, 0, 0, 0, BPF_FUNC_get_prandom_u32
),
202 BPF_LD_IMM64(BPF_REG_1
, 0x1000000000ULL
),
203 BPF_ALU64_REG(BPF_OR
, BPF_REG_0
, BPF_REG_1
),
204 BPF_ALU32_IMM(BPF_AND
, BPF_REG_0
, -1),
205 BPF_ALU64_IMM(BPF_RSH
, BPF_REG_0
, 32),
206 BPF_MOV64_REG(BPF_REG_6
, BPF_REG_0
),
207 BPF_RAW_INSN(BPF_JMP
| BPF_CALL
, 0, 0, 0, BPF_FUNC_get_prandom_u32
),
208 BPF_LD_IMM64(BPF_REG_1
, 0x1000000000ULL
),
209 BPF_ALU64_REG(BPF_OR
, BPF_REG_0
, BPF_REG_1
),
210 BPF_ALU32_IMM(BPF_AND
, BPF_REG_0
, -2),
211 BPF_ALU64_IMM(BPF_RSH
, BPF_REG_0
, 32),
212 BPF_ALU64_REG(BPF_OR
, BPF_REG_0
, BPF_REG_6
),
219 "lsh32 reg zero extend check",
221 BPF_RAW_INSN(BPF_JMP
| BPF_CALL
, 0, 0, 0, BPF_FUNC_get_prandom_u32
),
222 BPF_LD_IMM64(BPF_REG_1
, 0x100000000ULL
),
223 BPF_ALU64_REG(BPF_OR
, BPF_REG_0
, BPF_REG_1
),
224 BPF_MOV64_IMM(BPF_REG_1
, 1),
225 BPF_ALU32_REG(BPF_LSH
, BPF_REG_0
, BPF_REG_1
),
226 BPF_ALU64_IMM(BPF_RSH
, BPF_REG_0
, 32),
233 "lsh32 imm zero extend check",
235 BPF_RAW_INSN(BPF_JMP
| BPF_CALL
, 0, 0, 0, BPF_FUNC_get_prandom_u32
),
236 BPF_LD_IMM64(BPF_REG_1
, 0x1000000000ULL
),
237 BPF_ALU64_REG(BPF_OR
, BPF_REG_0
, BPF_REG_1
),
238 BPF_ALU32_IMM(BPF_LSH
, BPF_REG_0
, 0),
239 BPF_ALU64_IMM(BPF_RSH
, BPF_REG_0
, 32),
240 BPF_MOV64_REG(BPF_REG_6
, BPF_REG_0
),
241 BPF_RAW_INSN(BPF_JMP
| BPF_CALL
, 0, 0, 0, BPF_FUNC_get_prandom_u32
),
242 BPF_LD_IMM64(BPF_REG_1
, 0x1000000000ULL
),
243 BPF_ALU64_REG(BPF_OR
, BPF_REG_0
, BPF_REG_1
),
244 BPF_ALU32_IMM(BPF_LSH
, BPF_REG_0
, 1),
245 BPF_ALU64_IMM(BPF_RSH
, BPF_REG_0
, 32),
246 BPF_ALU64_REG(BPF_OR
, BPF_REG_0
, BPF_REG_6
),
253 "rsh32 reg zero extend check",
255 BPF_RAW_INSN(BPF_JMP
| BPF_CALL
, 0, 0, 0, BPF_FUNC_get_prandom_u32
),
256 BPF_LD_IMM64(BPF_REG_1
, 0x1000000000ULL
),
257 BPF_ALU64_REG(BPF_OR
, BPF_REG_0
, BPF_REG_1
),
258 BPF_MOV64_IMM(BPF_REG_1
, 1),
259 BPF_ALU32_REG(BPF_RSH
, BPF_REG_0
, BPF_REG_1
),
260 BPF_ALU64_IMM(BPF_RSH
, BPF_REG_0
, 32),
267 "rsh32 imm zero extend check",
269 BPF_RAW_INSN(BPF_JMP
| BPF_CALL
, 0, 0, 0, BPF_FUNC_get_prandom_u32
),
270 BPF_LD_IMM64(BPF_REG_1
, 0x1000000000ULL
),
271 BPF_ALU64_REG(BPF_OR
, BPF_REG_0
, BPF_REG_1
),
272 BPF_ALU32_IMM(BPF_RSH
, BPF_REG_0
, 0),
273 BPF_ALU64_IMM(BPF_RSH
, BPF_REG_0
, 32),
274 BPF_MOV64_REG(BPF_REG_6
, BPF_REG_0
),
275 BPF_RAW_INSN(BPF_JMP
| BPF_CALL
, 0, 0, 0, BPF_FUNC_get_prandom_u32
),
276 BPF_LD_IMM64(BPF_REG_1
, 0x1000000000ULL
),
277 BPF_ALU64_REG(BPF_OR
, BPF_REG_0
, BPF_REG_1
),
278 BPF_ALU32_IMM(BPF_RSH
, BPF_REG_0
, 1),
279 BPF_ALU64_IMM(BPF_RSH
, BPF_REG_0
, 32),
280 BPF_ALU64_REG(BPF_OR
, BPF_REG_0
, BPF_REG_6
),
287 "neg32 reg zero extend check",
289 BPF_RAW_INSN(BPF_JMP
| BPF_CALL
, 0, 0, 0, BPF_FUNC_get_prandom_u32
),
290 BPF_LD_IMM64(BPF_REG_1
, 0x1000000000ULL
),
291 BPF_ALU64_REG(BPF_OR
, BPF_REG_0
, BPF_REG_1
),
292 BPF_ALU32_IMM(BPF_NEG
, BPF_REG_0
, 0),
293 BPF_ALU64_IMM(BPF_RSH
, BPF_REG_0
, 32),
300 "mod32 reg zero extend check",
302 BPF_RAW_INSN(BPF_JMP
| BPF_CALL
, 0, 0, 0, BPF_FUNC_get_prandom_u32
),
303 BPF_MOV64_REG(BPF_REG_1
, BPF_REG_0
),
304 BPF_MOV64_IMM(BPF_REG_0
, -1),
305 BPF_ALU32_REG(BPF_MOD
, BPF_REG_0
, BPF_REG_1
),
306 BPF_ALU64_IMM(BPF_RSH
, BPF_REG_0
, 32),
313 "mod32 imm zero extend check",
315 BPF_RAW_INSN(BPF_JMP
| BPF_CALL
, 0, 0, 0, BPF_FUNC_get_prandom_u32
),
316 BPF_LD_IMM64(BPF_REG_1
, 0x1000000000ULL
),
317 BPF_ALU64_REG(BPF_OR
, BPF_REG_0
, BPF_REG_1
),
318 BPF_ALU32_IMM(BPF_MOD
, BPF_REG_0
, 1),
319 BPF_ALU64_IMM(BPF_RSH
, BPF_REG_0
, 32),
320 BPF_MOV64_REG(BPF_REG_6
, BPF_REG_0
),
321 BPF_RAW_INSN(BPF_JMP
| BPF_CALL
, 0, 0, 0, BPF_FUNC_get_prandom_u32
),
322 BPF_LD_IMM64(BPF_REG_1
, 0x1000000000ULL
),
323 BPF_ALU64_REG(BPF_OR
, BPF_REG_0
, BPF_REG_1
),
324 BPF_ALU32_IMM(BPF_MOD
, BPF_REG_0
, 2),
325 BPF_ALU64_IMM(BPF_RSH
, BPF_REG_0
, 32),
326 BPF_ALU64_REG(BPF_OR
, BPF_REG_0
, BPF_REG_6
),
333 "xor32 reg zero extend check",
335 BPF_RAW_INSN(BPF_JMP
| BPF_CALL
, 0, 0, 0, BPF_FUNC_get_prandom_u32
),
336 BPF_MOV64_REG(BPF_REG_1
, BPF_REG_0
),
337 BPF_LD_IMM64(BPF_REG_0
, 0x100000000ULL
),
338 BPF_ALU32_REG(BPF_XOR
, BPF_REG_0
, BPF_REG_1
),
339 BPF_ALU64_IMM(BPF_RSH
, BPF_REG_0
, 32),
346 "xor32 imm zero extend check",
348 BPF_RAW_INSN(BPF_JMP
| BPF_CALL
, 0, 0, 0, BPF_FUNC_get_prandom_u32
),
349 BPF_LD_IMM64(BPF_REG_1
, 0x1000000000ULL
),
350 BPF_ALU64_REG(BPF_OR
, BPF_REG_0
, BPF_REG_1
),
351 BPF_ALU32_IMM(BPF_XOR
, BPF_REG_0
, 1),
352 BPF_ALU64_IMM(BPF_RSH
, BPF_REG_0
, 32),
359 "mov32 reg zero extend check",
361 BPF_RAW_INSN(BPF_JMP
| BPF_CALL
, 0, 0, 0, BPF_FUNC_get_prandom_u32
),
362 BPF_LD_IMM64(BPF_REG_1
, 0x100000000ULL
),
363 BPF_ALU64_REG(BPF_OR
, BPF_REG_1
, BPF_REG_0
),
364 BPF_LD_IMM64(BPF_REG_0
, 0x100000000ULL
),
365 BPF_MOV32_REG(BPF_REG_0
, BPF_REG_1
),
366 BPF_ALU64_IMM(BPF_RSH
, BPF_REG_0
, 32),
373 "mov32 imm zero extend check",
375 BPF_RAW_INSN(BPF_JMP
| BPF_CALL
, 0, 0, 0, BPF_FUNC_get_prandom_u32
),
376 BPF_LD_IMM64(BPF_REG_1
, 0x1000000000ULL
),
377 BPF_ALU64_REG(BPF_OR
, BPF_REG_0
, BPF_REG_1
),
378 BPF_MOV32_IMM(BPF_REG_0
, 0),
379 BPF_ALU64_IMM(BPF_RSH
, BPF_REG_0
, 32),
380 BPF_MOV64_REG(BPF_REG_6
, BPF_REG_0
),
381 BPF_RAW_INSN(BPF_JMP
| BPF_CALL
, 0, 0, 0, BPF_FUNC_get_prandom_u32
),
382 BPF_LD_IMM64(BPF_REG_1
, 0x1000000000ULL
),
383 BPF_ALU64_REG(BPF_OR
, BPF_REG_0
, BPF_REG_1
),
384 BPF_MOV32_IMM(BPF_REG_0
, 1),
385 BPF_ALU64_IMM(BPF_RSH
, BPF_REG_0
, 32),
386 BPF_ALU64_REG(BPF_OR
, BPF_REG_0
, BPF_REG_6
),
393 "arsh32 reg zero extend check",
395 BPF_RAW_INSN(BPF_JMP
| BPF_CALL
, 0, 0, 0, BPF_FUNC_get_prandom_u32
),
396 BPF_LD_IMM64(BPF_REG_1
, 0x1000000000ULL
),
397 BPF_ALU64_REG(BPF_OR
, BPF_REG_0
, BPF_REG_1
),
398 BPF_MOV64_IMM(BPF_REG_1
, 1),
399 BPF_ALU32_REG(BPF_ARSH
, BPF_REG_0
, BPF_REG_1
),
400 BPF_ALU64_IMM(BPF_RSH
, BPF_REG_0
, 32),
407 "arsh32 imm zero extend check",
409 BPF_RAW_INSN(BPF_JMP
| BPF_CALL
, 0, 0, 0, BPF_FUNC_get_prandom_u32
),
410 BPF_LD_IMM64(BPF_REG_1
, 0x1000000000ULL
),
411 BPF_ALU64_REG(BPF_OR
, BPF_REG_0
, BPF_REG_1
),
412 BPF_ALU32_IMM(BPF_ARSH
, BPF_REG_0
, 0),
413 BPF_ALU64_IMM(BPF_RSH
, BPF_REG_0
, 32),
414 BPF_MOV64_REG(BPF_REG_6
, BPF_REG_0
),
415 BPF_RAW_INSN(BPF_JMP
| BPF_CALL
, 0, 0, 0, BPF_FUNC_get_prandom_u32
),
416 BPF_LD_IMM64(BPF_REG_1
, 0x1000000000ULL
),
417 BPF_ALU64_REG(BPF_OR
, BPF_REG_0
, BPF_REG_1
),
418 BPF_ALU32_IMM(BPF_ARSH
, BPF_REG_0
, 1),
419 BPF_ALU64_IMM(BPF_RSH
, BPF_REG_0
, 32),
420 BPF_ALU64_REG(BPF_OR
, BPF_REG_0
, BPF_REG_6
),
427 "end16 (to_le) reg zero extend check",
429 BPF_RAW_INSN(BPF_JMP
| BPF_CALL
, 0, 0, 0, BPF_FUNC_get_prandom_u32
),
430 BPF_MOV64_REG(BPF_REG_6
, BPF_REG_0
),
431 BPF_ALU64_IMM(BPF_LSH
, BPF_REG_6
, 32),
432 BPF_RAW_INSN(BPF_JMP
| BPF_CALL
, 0, 0, 0, BPF_FUNC_get_prandom_u32
),
433 BPF_ALU64_REG(BPF_OR
, BPF_REG_0
, BPF_REG_6
),
434 BPF_ENDIAN(BPF_TO_LE
, BPF_REG_0
, 16),
435 BPF_ALU64_IMM(BPF_RSH
, BPF_REG_0
, 32),
442 "end32 (to_le) reg zero extend check",
444 BPF_RAW_INSN(BPF_JMP
| BPF_CALL
, 0, 0, 0, BPF_FUNC_get_prandom_u32
),
445 BPF_MOV64_REG(BPF_REG_6
, BPF_REG_0
),
446 BPF_ALU64_IMM(BPF_LSH
, BPF_REG_6
, 32),
447 BPF_RAW_INSN(BPF_JMP
| BPF_CALL
, 0, 0, 0, BPF_FUNC_get_prandom_u32
),
448 BPF_ALU64_REG(BPF_OR
, BPF_REG_0
, BPF_REG_6
),
449 BPF_ENDIAN(BPF_TO_LE
, BPF_REG_0
, 32),
450 BPF_ALU64_IMM(BPF_RSH
, BPF_REG_0
, 32),
457 "end16 (to_be) reg zero extend check",
459 BPF_RAW_INSN(BPF_JMP
| BPF_CALL
, 0, 0, 0, BPF_FUNC_get_prandom_u32
),
460 BPF_MOV64_REG(BPF_REG_6
, BPF_REG_0
),
461 BPF_ALU64_IMM(BPF_LSH
, BPF_REG_6
, 32),
462 BPF_RAW_INSN(BPF_JMP
| BPF_CALL
, 0, 0, 0, BPF_FUNC_get_prandom_u32
),
463 BPF_ALU64_REG(BPF_OR
, BPF_REG_0
, BPF_REG_6
),
464 BPF_ENDIAN(BPF_TO_BE
, BPF_REG_0
, 16),
465 BPF_ALU64_IMM(BPF_RSH
, BPF_REG_0
, 32),
472 "end32 (to_be) reg zero extend check",
474 BPF_RAW_INSN(BPF_JMP
| BPF_CALL
, 0, 0, 0, BPF_FUNC_get_prandom_u32
),
475 BPF_MOV64_REG(BPF_REG_6
, BPF_REG_0
),
476 BPF_ALU64_IMM(BPF_LSH
, BPF_REG_6
, 32),
477 BPF_RAW_INSN(BPF_JMP
| BPF_CALL
, 0, 0, 0, BPF_FUNC_get_prandom_u32
),
478 BPF_ALU64_REG(BPF_OR
, BPF_REG_0
, BPF_REG_6
),
479 BPF_ENDIAN(BPF_TO_BE
, BPF_REG_0
, 32),
480 BPF_ALU64_IMM(BPF_RSH
, BPF_REG_0
, 32),
487 "ldx_b zero extend check",
489 BPF_MOV64_REG(BPF_REG_6
, BPF_REG_10
),
490 BPF_ALU64_IMM(BPF_ADD
, BPF_REG_6
, -4),
491 BPF_ST_MEM(BPF_W
, BPF_REG_6
, 0, 0xfaceb00c),
492 BPF_RAW_INSN(BPF_JMP
| BPF_CALL
, 0, 0, 0, BPF_FUNC_get_prandom_u32
),
493 BPF_LD_IMM64(BPF_REG_1
, 0x1000000000ULL
),
494 BPF_ALU64_REG(BPF_OR
, BPF_REG_0
, BPF_REG_1
),
495 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_6
, 0),
496 BPF_ALU64_IMM(BPF_RSH
, BPF_REG_0
, 32),
503 "ldx_h zero extend check",
505 BPF_MOV64_REG(BPF_REG_6
, BPF_REG_10
),
506 BPF_ALU64_IMM(BPF_ADD
, BPF_REG_6
, -4),
507 BPF_ST_MEM(BPF_W
, BPF_REG_6
, 0, 0xfaceb00c),
508 BPF_RAW_INSN(BPF_JMP
| BPF_CALL
, 0, 0, 0, BPF_FUNC_get_prandom_u32
),
509 BPF_LD_IMM64(BPF_REG_1
, 0x1000000000ULL
),
510 BPF_ALU64_REG(BPF_OR
, BPF_REG_0
, BPF_REG_1
),
511 BPF_LDX_MEM(BPF_H
, BPF_REG_0
, BPF_REG_6
, 0),
512 BPF_ALU64_IMM(BPF_RSH
, BPF_REG_0
, 32),
519 "ldx_w zero extend check",
521 BPF_MOV64_REG(BPF_REG_6
, BPF_REG_10
),
522 BPF_ALU64_IMM(BPF_ADD
, BPF_REG_6
, -4),
523 BPF_ST_MEM(BPF_W
, BPF_REG_6
, 0, 0xfaceb00c),
524 BPF_RAW_INSN(BPF_JMP
| BPF_CALL
, 0, 0, 0, BPF_FUNC_get_prandom_u32
),
525 BPF_LD_IMM64(BPF_REG_1
, 0x1000000000ULL
),
526 BPF_ALU64_REG(BPF_OR
, BPF_REG_0
, BPF_REG_1
),
527 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_6
, 0),
528 BPF_ALU64_IMM(BPF_RSH
, BPF_REG_0
, 32),