1 {
2 	"jset32: BPF_K",
3 	.insns = {
4 	BPF_DIRECT_PKT_R2,
5 	BPF_LDX_MEM(BPF_DW, BPF_REG_7, BPF_REG_2, 0),
6 	/* reg, high bits shouldn't be tested */
7 	BPF_JMP32_IMM(BPF_JSET, BPF_REG_7, -2, 1),
8 	BPF_JMP_IMM(BPF_JA, 0, 0, 1),
9 	BPF_EXIT_INSN(),
10 
11 	BPF_JMP32_IMM(BPF_JSET, BPF_REG_7, 1, 1),
12 	BPF_EXIT_INSN(),
13 	BPF_MOV64_IMM(BPF_REG_0, 2),
14 	BPF_EXIT_INSN(),
15 	},
16 	.prog_type = BPF_PROG_TYPE_SCHED_CLS,
17 	.result = ACCEPT,
18 	.runs = 3,
19 	.retvals = {
20 		{ .retval = 0,
21 		  .data64 = { 1ULL << 63, }
22 		},
23 		{ .retval = 2,
24 		  .data64 = { 1, }
25 		},
26 		{ .retval = 2,
27 		  .data64 = { 1ULL << 63 | 1, }
28 		},
29 	},
30 	.flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
31 },
32 {
33 	"jset32: BPF_X",
34 	.insns = {
35 	BPF_DIRECT_PKT_R2,
36 	BPF_LDX_MEM(BPF_DW, BPF_REG_7, BPF_REG_2, 0),
37 	BPF_LD_IMM64(BPF_REG_8, 0x8000000000000000),
38 	BPF_JMP32_REG(BPF_JSET, BPF_REG_7, BPF_REG_8, 1),
39 	BPF_JMP_IMM(BPF_JA, 0, 0, 1),
40 	BPF_EXIT_INSN(),
41 
42 	BPF_LD_IMM64(BPF_REG_8, 0x8000000000000001),
43 	BPF_JMP32_REG(BPF_JSET, BPF_REG_7, BPF_REG_8, 1),
44 	BPF_EXIT_INSN(),
45 	BPF_MOV64_IMM(BPF_REG_0, 2),
46 	BPF_EXIT_INSN(),
47 	},
48 	.prog_type = BPF_PROG_TYPE_SCHED_CLS,
49 	.result = ACCEPT,
50 	.runs = 3,
51 	.retvals = {
52 		{ .retval = 0,
53 		  .data64 = { 1ULL << 63, }
54 		},
55 		{ .retval = 2,
56 		  .data64 = { 1, }
57 		},
58 		{ .retval = 2,
59 		  .data64 = { 1ULL << 63 | 1, }
60 		},
61 	},
62 	.flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
63 },
64 {
65 	"jset32: min/max deduction",
66 	.insns = {
67 	BPF_RAND_UEXT_R7,
68 	BPF_MOV64_IMM(BPF_REG_0, 0),
69 	BPF_JMP32_IMM(BPF_JSET, BPF_REG_7, 0x10, 1),
70 	BPF_EXIT_INSN(),
71 	BPF_JMP32_IMM(BPF_JGE, BPF_REG_7, 0x10, 1),
72 	BPF_LDX_MEM(BPF_B, BPF_REG_8, BPF_REG_9, 0),
73 	BPF_EXIT_INSN(),
74 	},
75 	.result = ACCEPT,
76 },
77 {
78 	"jeq32: BPF_K",
79 	.insns = {
80 	BPF_DIRECT_PKT_R2,
81 	BPF_LDX_MEM(BPF_DW, BPF_REG_7, BPF_REG_2, 0),
82 	BPF_JMP32_IMM(BPF_JEQ, BPF_REG_7, -1, 1),
83 	BPF_EXIT_INSN(),
84 	BPF_MOV64_IMM(BPF_REG_0, 2),
85 	BPF_EXIT_INSN(),
86 	},
87 	.prog_type = BPF_PROG_TYPE_SCHED_CLS,
88 	.result = ACCEPT,
89 	.runs = 2,
90 	.retvals = {
91 		{ .retval = 0,
92 		  .data64 = { -2, }
93 		},
94 		{ .retval = 2,
95 		  .data64 = { -1, }
96 		},
97 	},
98 	.flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
99 },
100 {
101 	"jeq32: BPF_X",
102 	.insns = {
103 	BPF_DIRECT_PKT_R2,
104 	BPF_LDX_MEM(BPF_DW, BPF_REG_7, BPF_REG_2, 0),
105 	BPF_LD_IMM64(BPF_REG_8, 0x7000000000000001),
106 	BPF_JMP32_REG(BPF_JEQ, BPF_REG_7, BPF_REG_8, 1),
107 	BPF_EXIT_INSN(),
108 	BPF_MOV64_IMM(BPF_REG_0, 2),
109 	BPF_EXIT_INSN(),
110 	},
111 	.prog_type = BPF_PROG_TYPE_SCHED_CLS,
112 	.result = ACCEPT,
113 	.runs = 3,
114 	.retvals = {
115 		{ .retval = 0,
116 		  .data64 = { 2, }
117 		},
118 		{ .retval = 2,
119 		  .data64 = { 1, }
120 		},
121 		{ .retval = 2,
122 		  .data64 = { 1ULL << 63 | 1, }
123 		},
124 	},
125 	.flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
126 },
127 {
128 	"jeq32: min/max deduction",
129 	.insns = {
130 	BPF_RAND_UEXT_R7,
131 	BPF_MOV64_IMM(BPF_REG_0, 0),
132 	BPF_JMP32_IMM(BPF_JEQ, BPF_REG_7, 0x10, 1),
133 	BPF_EXIT_INSN(),
134 	BPF_JMP32_IMM(BPF_JSGE, BPF_REG_7, 0xf, 1),
135 	BPF_LDX_MEM(BPF_B, BPF_REG_8, BPF_REG_9, 0),
136 	BPF_EXIT_INSN(),
137 	},
138 	.result = ACCEPT,
139 },
140 {
141 	"jne32: BPF_K",
142 	.insns = {
143 	BPF_DIRECT_PKT_R2,
144 	BPF_LDX_MEM(BPF_DW, BPF_REG_7, BPF_REG_2, 0),
145 	BPF_JMP32_IMM(BPF_JNE, BPF_REG_7, -1, 1),
146 	BPF_EXIT_INSN(),
147 	BPF_MOV64_IMM(BPF_REG_0, 2),
148 	BPF_EXIT_INSN(),
149 	},
150 	.prog_type = BPF_PROG_TYPE_SCHED_CLS,
151 	.result = ACCEPT,
152 	.runs = 2,
153 	.retvals = {
154 		{ .retval = 2,
155 		  .data64 = { 1, }
156 		},
157 		{ .retval = 0,
158 		  .data64 = { -1, }
159 		},
160 	},
161 	.flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
162 },
163 {
164 	"jne32: BPF_X",
165 	.insns = {
166 	BPF_DIRECT_PKT_R2,
167 	BPF_LDX_MEM(BPF_DW, BPF_REG_7, BPF_REG_2, 0),
168 	BPF_LD_IMM64(BPF_REG_8, 0x8000000000000001),
169 	BPF_JMP32_REG(BPF_JNE, BPF_REG_7, BPF_REG_8, 1),
170 	BPF_EXIT_INSN(),
171 	BPF_MOV64_IMM(BPF_REG_0, 2),
172 	BPF_EXIT_INSN(),
173 	},
174 	.prog_type = BPF_PROG_TYPE_SCHED_CLS,
175 	.result = ACCEPT,
176 	.runs = 3,
177 	.retvals = {
178 		{ .retval = 0,
179 		  .data64 = { 1, }
180 		},
181 		{ .retval = 2,
182 		  .data64 = { 2, }
183 		},
184 		{ .retval = 2,
185 		  .data64 = { 1ULL << 63 | 2, }
186 		},
187 	},
188 	.flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
189 },
190 {
191 	"jne32: min/max deduction",
192 	.insns = {
193 	BPF_RAND_UEXT_R7,
194 	BPF_MOV64_IMM(BPF_REG_0, 0),
195 	BPF_JMP32_IMM(BPF_JNE, BPF_REG_7, 0x10, 1),
196 	BPF_JMP_IMM(BPF_JNE, BPF_REG_7, 0x10, 1),
197 	BPF_EXIT_INSN(),
198 	BPF_LDX_MEM(BPF_B, BPF_REG_8, BPF_REG_9, 0),
199 	BPF_EXIT_INSN(),
200 	},
201 	.result = ACCEPT,
202 },
203 {
204 	"jge32: BPF_K",
205 	.insns = {
206 	BPF_DIRECT_PKT_R2,
207 	BPF_LDX_MEM(BPF_DW, BPF_REG_7, BPF_REG_2, 0),
208 	BPF_JMP32_IMM(BPF_JGE, BPF_REG_7, UINT_MAX - 1, 1),
209 	BPF_EXIT_INSN(),
210 	BPF_ALU32_IMM(BPF_MOV, BPF_REG_0, 2),
211 	BPF_EXIT_INSN(),
212 	},
213 	.prog_type = BPF_PROG_TYPE_SCHED_CLS,
214 	.result = ACCEPT,
215 	.runs = 3,
216 	.retvals = {
217 		{ .retval = 2,
218 		  .data64 = { UINT_MAX, }
219 		},
220 		{ .retval = 2,
221 		  .data64 = { UINT_MAX - 1, }
222 		},
223 		{ .retval = 0,
224 		  .data64 = { 0, }
225 		},
226 	},
227 	.flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
228 },
229 {
230 	"jge32: BPF_X",
231 	.insns = {
232 	BPF_DIRECT_PKT_R2,
233 	BPF_LD_IMM64(BPF_REG_8, UINT_MAX | 1ULL << 32),
234 	BPF_LDX_MEM(BPF_DW, BPF_REG_7, BPF_REG_2, 0),
235 	BPF_JMP32_REG(BPF_JGE, BPF_REG_7, BPF_REG_8, 1),
236 	BPF_EXIT_INSN(),
237 	BPF_ALU32_IMM(BPF_MOV, BPF_REG_0, 2),
238 	BPF_EXIT_INSN(),
239 	},
240 	.prog_type = BPF_PROG_TYPE_SCHED_CLS,
241 	.result = ACCEPT,
242 	.runs = 3,
243 	.retvals = {
244 		{ .retval = 2,
245 		  .data64 = { UINT_MAX, }
246 		},
247 		{ .retval = 0,
248 		  .data64 = { INT_MAX, }
249 		},
250 		{ .retval = 0,
251 		  .data64 = { (UINT_MAX - 1) | 2ULL << 32, }
252 		},
253 	},
254 	.flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
255 },
256 {
257 	"jge32: min/max deduction",
258 	.insns = {
259 	BPF_RAND_UEXT_R7,
260 	BPF_ALU32_IMM(BPF_MOV, BPF_REG_0, 2),
261 	BPF_LD_IMM64(BPF_REG_8, 0x7ffffff0 | 1ULL << 32),
262 	BPF_JMP32_REG(BPF_JGE, BPF_REG_7, BPF_REG_8, 1),
263 	BPF_EXIT_INSN(),
264 	BPF_JMP32_IMM(BPF_JGE, BPF_REG_7, 0x7ffffff0, 1),
265 	BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_0, 0),
266 	BPF_EXIT_INSN(),
267 	},
268 	.result = ACCEPT,
269 	.retval = 2,
270 },
271 {
272 	"jgt32: BPF_K",
273 	.insns = {
274 	BPF_DIRECT_PKT_R2,
275 	BPF_LDX_MEM(BPF_DW, BPF_REG_7, BPF_REG_2, 0),
276 	BPF_JMP32_IMM(BPF_JGT, BPF_REG_7, UINT_MAX - 1, 1),
277 	BPF_EXIT_INSN(),
278 	BPF_ALU32_IMM(BPF_MOV, BPF_REG_0, 2),
279 	BPF_EXIT_INSN(),
280 	},
281 	.prog_type = BPF_PROG_TYPE_SCHED_CLS,
282 	.result = ACCEPT,
283 	.runs = 3,
284 	.retvals = {
285 		{ .retval = 2,
286 		  .data64 = { UINT_MAX, }
287 		},
288 		{ .retval = 0,
289 		  .data64 = { UINT_MAX - 1, }
290 		},
291 		{ .retval = 0,
292 		  .data64 = { 0, }
293 		},
294 	},
295 	.flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
296 },
297 {
298 	"jgt32: BPF_X",
299 	.insns = {
300 	BPF_DIRECT_PKT_R2,
301 	BPF_LD_IMM64(BPF_REG_8, (UINT_MAX - 1) | 1ULL << 32),
302 	BPF_LDX_MEM(BPF_DW, BPF_REG_7, BPF_REG_2, 0),
303 	BPF_JMP32_REG(BPF_JGT, BPF_REG_7, BPF_REG_8, 1),
304 	BPF_EXIT_INSN(),
305 	BPF_ALU32_IMM(BPF_MOV, BPF_REG_0, 2),
306 	BPF_EXIT_INSN(),
307 	},
308 	.prog_type = BPF_PROG_TYPE_SCHED_CLS,
309 	.result = ACCEPT,
310 	.runs = 3,
311 	.retvals = {
312 		{ .retval = 2,
313 		  .data64 = { UINT_MAX, }
314 		},
315 		{ .retval = 0,
316 		  .data64 = { UINT_MAX - 1, }
317 		},
318 		{ .retval = 0,
319 		  .data64 = { (UINT_MAX - 1) | 2ULL << 32, }
320 		},
321 	},
322 	.flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
323 },
324 {
325 	"jgt32: min/max deduction",
326 	.insns = {
327 	BPF_RAND_UEXT_R7,
328 	BPF_ALU32_IMM(BPF_MOV, BPF_REG_0, 2),
329 	BPF_LD_IMM64(BPF_REG_8, 0x7ffffff0 | 1ULL << 32),
330 	BPF_JMP32_REG(BPF_JGT, BPF_REG_7, BPF_REG_8, 1),
331 	BPF_EXIT_INSN(),
332 	BPF_JMP_IMM(BPF_JGT, BPF_REG_7, 0x7ffffff0, 1),
333 	BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_0, 0),
334 	BPF_EXIT_INSN(),
335 	},
336 	.result = ACCEPT,
337 	.retval = 2,
338 },
339 {
340 	"jle32: BPF_K",
341 	.insns = {
342 	BPF_DIRECT_PKT_R2,
343 	BPF_LDX_MEM(BPF_DW, BPF_REG_7, BPF_REG_2, 0),
344 	BPF_JMP32_IMM(BPF_JLE, BPF_REG_7, INT_MAX, 1),
345 	BPF_EXIT_INSN(),
346 	BPF_ALU32_IMM(BPF_MOV, BPF_REG_0, 2),
347 	BPF_EXIT_INSN(),
348 	},
349 	.prog_type = BPF_PROG_TYPE_SCHED_CLS,
350 	.result = ACCEPT,
351 	.runs = 3,
352 	.retvals = {
353 		{ .retval = 2,
354 		  .data64 = { INT_MAX - 1, }
355 		},
356 		{ .retval = 0,
357 		  .data64 = { UINT_MAX, }
358 		},
359 		{ .retval = 2,
360 		  .data64 = { INT_MAX, }
361 		},
362 	},
363 	.flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
364 },
365 {
366 	"jle32: BPF_X",
367 	.insns = {
368 	BPF_DIRECT_PKT_R2,
369 	BPF_LD_IMM64(BPF_REG_8, (INT_MAX - 1) | 2ULL << 32),
370 	BPF_LDX_MEM(BPF_DW, BPF_REG_7, BPF_REG_2, 0),
371 	BPF_JMP32_REG(BPF_JLE, BPF_REG_7, BPF_REG_8, 1),
372 	BPF_EXIT_INSN(),
373 	BPF_ALU32_IMM(BPF_MOV, BPF_REG_0, 2),
374 	BPF_EXIT_INSN(),
375 	},
376 	.prog_type = BPF_PROG_TYPE_SCHED_CLS,
377 	.result = ACCEPT,
378 	.runs = 3,
379 	.retvals = {
380 		{ .retval = 0,
381 		  .data64 = { INT_MAX | 1ULL << 32, }
382 		},
383 		{ .retval = 2,
384 		  .data64 = { INT_MAX - 2, }
385 		},
386 		{ .retval = 0,
387 		  .data64 = { UINT_MAX, }
388 		},
389 	},
390 	.flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
391 },
392 {
393 	"jle32: min/max deduction",
394 	.insns = {
395 	BPF_RAND_UEXT_R7,
396 	BPF_ALU32_IMM(BPF_MOV, BPF_REG_0, 2),
397 	BPF_LD_IMM64(BPF_REG_8, 0x7ffffff0 | 1ULL << 32),
398 	BPF_JMP32_REG(BPF_JLE, BPF_REG_7, BPF_REG_8, 1),
399 	BPF_EXIT_INSN(),
400 	BPF_JMP32_IMM(BPF_JLE, BPF_REG_7, 0x7ffffff0, 1),
401 	BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_0, 0),
402 	BPF_EXIT_INSN(),
403 	},
404 	.result = ACCEPT,
405 	.retval = 2,
406 },
407 {
408 	"jlt32: BPF_K",
409 	.insns = {
410 	BPF_DIRECT_PKT_R2,
411 	BPF_LDX_MEM(BPF_DW, BPF_REG_7, BPF_REG_2, 0),
412 	BPF_JMP32_IMM(BPF_JLT, BPF_REG_7, INT_MAX, 1),
413 	BPF_EXIT_INSN(),
414 	BPF_ALU32_IMM(BPF_MOV, BPF_REG_0, 2),
415 	BPF_EXIT_INSN(),
416 	},
417 	.prog_type = BPF_PROG_TYPE_SCHED_CLS,
418 	.result = ACCEPT,
419 	.runs = 3,
420 	.retvals = {
421 		{ .retval = 0,
422 		  .data64 = { INT_MAX, }
423 		},
424 		{ .retval = 0,
425 		  .data64 = { UINT_MAX, }
426 		},
427 		{ .retval = 2,
428 		  .data64 = { INT_MAX - 1, }
429 		},
430 	},
431 	.flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
432 },
433 {
434 	"jlt32: BPF_X",
435 	.insns = {
436 	BPF_DIRECT_PKT_R2,
437 	BPF_LD_IMM64(BPF_REG_8, INT_MAX | 2ULL << 32),
438 	BPF_LDX_MEM(BPF_DW, BPF_REG_7, BPF_REG_2, 0),
439 	BPF_JMP32_REG(BPF_JLT, BPF_REG_7, BPF_REG_8, 1),
440 	BPF_EXIT_INSN(),
441 	BPF_ALU32_IMM(BPF_MOV, BPF_REG_0, 2),
442 	BPF_EXIT_INSN(),
443 	},
444 	.prog_type = BPF_PROG_TYPE_SCHED_CLS,
445 	.result = ACCEPT,
446 	.runs = 3,
447 	.retvals = {
448 		{ .retval = 0,
449 		  .data64 = { INT_MAX | 1ULL << 32, }
450 		},
451 		{ .retval = 0,
452 		  .data64 = { UINT_MAX, }
453 		},
454 		{ .retval = 2,
455 		  .data64 = { (INT_MAX - 1) | 3ULL << 32, }
456 		},
457 	},
458 	.flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
459 },
460 {
461 	"jlt32: min/max deduction",
462 	.insns = {
463 	BPF_RAND_UEXT_R7,
464 	BPF_ALU32_IMM(BPF_MOV, BPF_REG_0, 2),
465 	BPF_LD_IMM64(BPF_REG_8, 0x7ffffff0 | 1ULL << 32),
466 	BPF_JMP32_REG(BPF_JLT, BPF_REG_7, BPF_REG_8, 1),
467 	BPF_EXIT_INSN(),
468 	BPF_JMP_IMM(BPF_JSLT, BPF_REG_7, 0x7ffffff0, 1),
469 	BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_0, 0),
470 	BPF_EXIT_INSN(),
471 	},
472 	.result = ACCEPT,
473 	.retval = 2,
474 },
475 {
476 	"jsge32: BPF_K",
477 	.insns = {
478 	BPF_DIRECT_PKT_R2,
479 	BPF_LDX_MEM(BPF_DW, BPF_REG_7, BPF_REG_2, 0),
480 	BPF_JMP32_IMM(BPF_JSGE, BPF_REG_7, -1, 1),
481 	BPF_EXIT_INSN(),
482 	BPF_ALU32_IMM(BPF_MOV, BPF_REG_0, 2),
483 	BPF_EXIT_INSN(),
484 	},
485 	.prog_type = BPF_PROG_TYPE_SCHED_CLS,
486 	.result = ACCEPT,
487 	.runs = 3,
488 	.retvals = {
489 		{ .retval = 2,
490 		  .data64 = { 0, }
491 		},
492 		{ .retval = 2,
493 		  .data64 = { -1, }
494 		},
495 		{ .retval = 0,
496 		  .data64 = { -2, }
497 		},
498 	},
499 	.flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
500 },
501 {
502 	"jsge32: BPF_X",
503 	.insns = {
504 	BPF_DIRECT_PKT_R2,
505 	BPF_LD_IMM64(BPF_REG_8, (__u32)-1 | 2ULL << 32),
506 	BPF_LDX_MEM(BPF_DW, BPF_REG_7, BPF_REG_2, 0),
507 	BPF_JMP32_REG(BPF_JSGE, BPF_REG_7, BPF_REG_8, 1),
508 	BPF_EXIT_INSN(),
509 	BPF_ALU32_IMM(BPF_MOV, BPF_REG_0, 2),
510 	BPF_EXIT_INSN(),
511 	},
512 	.prog_type = BPF_PROG_TYPE_SCHED_CLS,
513 	.result = ACCEPT,
514 	.runs = 3,
515 	.retvals = {
516 		{ .retval = 2,
517 		  .data64 = { -1, }
518 		},
519 		{ .retval = 2,
520 		  .data64 = { 0x7fffffff | 1ULL << 32, }
521 		},
522 		{ .retval = 0,
523 		  .data64 = { -2, }
524 		},
525 	},
526 	.flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
527 },
528 {
529 	"jsge32: min/max deduction",
530 	.insns = {
531 	BPF_RAND_UEXT_R7,
532 	BPF_ALU32_IMM(BPF_MOV, BPF_REG_0, 2),
533 	BPF_LD_IMM64(BPF_REG_8, 0x7ffffff0 | 1ULL << 32),
534 	BPF_JMP32_REG(BPF_JSGE, BPF_REG_7, BPF_REG_8, 1),
535 	BPF_EXIT_INSN(),
536 	BPF_JMP_IMM(BPF_JSGE, BPF_REG_7, 0x7ffffff0, 1),
537 	BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_0, 0),
538 	BPF_EXIT_INSN(),
539 	},
540 	.result = ACCEPT,
541 	.retval = 2,
542 },
543 {
544 	"jsgt32: BPF_K",
545 	.insns = {
546 	BPF_DIRECT_PKT_R2,
547 	BPF_LDX_MEM(BPF_DW, BPF_REG_7, BPF_REG_2, 0),
548 	BPF_JMP32_IMM(BPF_JSGT, BPF_REG_7, -1, 1),
549 	BPF_EXIT_INSN(),
550 	BPF_ALU32_IMM(BPF_MOV, BPF_REG_0, 2),
551 	BPF_EXIT_INSN(),
552 	},
553 	.prog_type = BPF_PROG_TYPE_SCHED_CLS,
554 	.result = ACCEPT,
555 	.runs = 3,
556 	.retvals = {
557 		{ .retval = 0,
558 		  .data64 = { (__u32)-2, }
559 		},
560 		{ .retval = 0,
561 		  .data64 = { -1, }
562 		},
563 		{ .retval = 2,
564 		  .data64 = { 1, }
565 		},
566 	},
567 	.flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
568 },
569 {
570 	"jsgt32: BPF_X",
571 	.insns = {
572 	BPF_DIRECT_PKT_R2,
573 	BPF_LD_IMM64(BPF_REG_8, 0x7ffffffe | 1ULL << 32),
574 	BPF_LDX_MEM(BPF_DW, BPF_REG_7, BPF_REG_2, 0),
575 	BPF_JMP32_REG(BPF_JSGT, BPF_REG_7, BPF_REG_8, 1),
576 	BPF_EXIT_INSN(),
577 	BPF_ALU32_IMM(BPF_MOV, BPF_REG_0, 2),
578 	BPF_EXIT_INSN(),
579 	},
580 	.prog_type = BPF_PROG_TYPE_SCHED_CLS,
581 	.result = ACCEPT,
582 	.runs = 3,
583 	.retvals = {
584 		{ .retval = 0,
585 		  .data64 = { 0x7ffffffe, }
586 		},
587 		{ .retval = 0,
588 		  .data64 = { 0x1ffffffffULL, }
589 		},
590 		{ .retval = 2,
591 		  .data64 = { 0x7fffffff, }
592 		},
593 	},
594 	.flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
595 },
596 {
597 	"jsgt32: min/max deduction",
598 	.insns = {
599 	BPF_RAND_SEXT_R7,
600 	BPF_ALU32_IMM(BPF_MOV, BPF_REG_0, 2),
601 	BPF_LD_IMM64(BPF_REG_8, (__u32)(-2) | 1ULL << 32),
602 	BPF_JMP32_REG(BPF_JSGT, BPF_REG_7, BPF_REG_8, 1),
603 	BPF_EXIT_INSN(),
604 	BPF_JMP_IMM(BPF_JSGT, BPF_REG_7, -2, 1),
605 	BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_0, 0),
606 	BPF_EXIT_INSN(),
607 	},
608 	.result = ACCEPT,
609 	.retval = 2,
610 },
611 {
612 	"jsle32: BPF_K",
613 	.insns = {
614 	BPF_DIRECT_PKT_R2,
615 	BPF_LDX_MEM(BPF_DW, BPF_REG_7, BPF_REG_2, 0),
616 	BPF_JMP32_IMM(BPF_JSLE, BPF_REG_7, -1, 1),
617 	BPF_EXIT_INSN(),
618 	BPF_ALU32_IMM(BPF_MOV, BPF_REG_0, 2),
619 	BPF_EXIT_INSN(),
620 	},
621 	.prog_type = BPF_PROG_TYPE_SCHED_CLS,
622 	.result = ACCEPT,
623 	.runs = 3,
624 	.retvals = {
625 		{ .retval = 2,
626 		  .data64 = { (__u32)-2, }
627 		},
628 		{ .retval = 2,
629 		  .data64 = { -1, }
630 		},
631 		{ .retval = 0,
632 		  .data64 = { 1, }
633 		},
634 	},
635 	.flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
636 },
637 {
638 	"jsle32: BPF_X",
639 	.insns = {
640 	BPF_DIRECT_PKT_R2,
641 	BPF_LD_IMM64(BPF_REG_8, 0x7ffffffe | 1ULL << 32),
642 	BPF_LDX_MEM(BPF_DW, BPF_REG_7, BPF_REG_2, 0),
643 	BPF_JMP32_REG(BPF_JSLE, BPF_REG_7, BPF_REG_8, 1),
644 	BPF_EXIT_INSN(),
645 	BPF_ALU32_IMM(BPF_MOV, BPF_REG_0, 2),
646 	BPF_EXIT_INSN(),
647 	},
648 	.prog_type = BPF_PROG_TYPE_SCHED_CLS,
649 	.result = ACCEPT,
650 	.runs = 3,
651 	.retvals = {
652 		{ .retval = 2,
653 		  .data64 = { 0x7ffffffe, }
654 		},
655 		{ .retval = 2,
656 		  .data64 = { (__u32)-1, }
657 		},
658 		{ .retval = 0,
659 		  .data64 = { 0x7fffffff | 2ULL << 32, }
660 		},
661 	},
662 	.flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
663 },
664 {
665 	"jsle32: min/max deduction",
666 	.insns = {
667 	BPF_RAND_UEXT_R7,
668 	BPF_ALU32_IMM(BPF_MOV, BPF_REG_0, 2),
669 	BPF_LD_IMM64(BPF_REG_8, 0x7ffffff0 | 1ULL << 32),
670 	BPF_JMP32_REG(BPF_JSLE, BPF_REG_7, BPF_REG_8, 1),
671 	BPF_EXIT_INSN(),
672 	BPF_JMP_IMM(BPF_JSLE, BPF_REG_7, 0x7ffffff0, 1),
673 	BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_0, 0),
674 	BPF_EXIT_INSN(),
675 	},
676 	.result = ACCEPT,
677 	.retval = 2,
678 },
679 {
680 	"jslt32: BPF_K",
681 	.insns = {
682 	BPF_DIRECT_PKT_R2,
683 	BPF_LDX_MEM(BPF_DW, BPF_REG_7, BPF_REG_2, 0),
684 	BPF_JMP32_IMM(BPF_JSLT, BPF_REG_7, -1, 1),
685 	BPF_EXIT_INSN(),
686 	BPF_ALU32_IMM(BPF_MOV, BPF_REG_0, 2),
687 	BPF_EXIT_INSN(),
688 	},
689 	.prog_type = BPF_PROG_TYPE_SCHED_CLS,
690 	.result = ACCEPT,
691 	.runs = 3,
692 	.retvals = {
693 		{ .retval = 2,
694 		  .data64 = { (__u32)-2, }
695 		},
696 		{ .retval = 0,
697 		  .data64 = { -1, }
698 		},
699 		{ .retval = 0,
700 		  .data64 = { 1, }
701 		},
702 	},
703 	.flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
704 },
705 {
706 	"jslt32: BPF_X",
707 	.insns = {
708 	BPF_DIRECT_PKT_R2,
709 	BPF_LD_IMM64(BPF_REG_8, 0x7fffffff | 1ULL << 32),
710 	BPF_LDX_MEM(BPF_DW, BPF_REG_7, BPF_REG_2, 0),
711 	BPF_JMP32_REG(BPF_JSLT, BPF_REG_7, BPF_REG_8, 1),
712 	BPF_EXIT_INSN(),
713 	BPF_ALU32_IMM(BPF_MOV, BPF_REG_0, 2),
714 	BPF_EXIT_INSN(),
715 	},
716 	.prog_type = BPF_PROG_TYPE_SCHED_CLS,
717 	.result = ACCEPT,
718 	.runs = 3,
719 	.retvals = {
720 		{ .retval = 2,
721 		  .data64 = { 0x7ffffffe, }
722 		},
723 		{ .retval = 2,
724 		  .data64 = { 0xffffffff, }
725 		},
726 		{ .retval = 0,
727 		  .data64 = { 0x7fffffff | 2ULL << 32, }
728 		},
729 	},
730 	.flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
731 },
732 {
733 	"jslt32: min/max deduction",
734 	.insns = {
735 	BPF_RAND_SEXT_R7,
736 	BPF_ALU32_IMM(BPF_MOV, BPF_REG_0, 2),
737 	BPF_LD_IMM64(BPF_REG_8, (__u32)(-1) | 1ULL << 32),
738 	BPF_JMP32_REG(BPF_JSLT, BPF_REG_7, BPF_REG_8, 1),
739 	BPF_EXIT_INSN(),
740 	BPF_JMP32_IMM(BPF_JSLT, BPF_REG_7, -1, 1),
741 	BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_0, 0),
742 	BPF_EXIT_INSN(),
743 	},
744 	.result = ACCEPT,
745 	.retval = 2,
746 },
747 {
748 	"jgt32: range bound deduction, reg op imm",
749 	.insns = {
750 	BPF_ST_MEM(BPF_DW, BPF_REG_10, -8, 0),
751 	BPF_MOV64_REG(BPF_REG_8, BPF_REG_1),
752 	BPF_MOV64_REG(BPF_REG_2, BPF_REG_10),
753 	BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -8),
754 	BPF_LD_MAP_FD(BPF_REG_1, 0),
755 	BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0, BPF_FUNC_map_lookup_elem),
756 	BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 9),
757 	BPF_MOV64_REG(BPF_REG_1, BPF_REG_8),
758 	BPF_MOV64_REG(BPF_REG_8, BPF_REG_0),
759 	BPF_EMIT_CALL(BPF_FUNC_get_cgroup_classid),
760 	BPF_JMP32_IMM(BPF_JGT, BPF_REG_0, 1, 5),
761 	BPF_MOV32_REG(BPF_REG_6, BPF_REG_0),
762 	BPF_ALU64_IMM(BPF_LSH, BPF_REG_6, 32),
763 	BPF_ALU64_IMM(BPF_RSH, BPF_REG_6, 32),
764 	BPF_ALU64_REG(BPF_ADD, BPF_REG_8, BPF_REG_6),
765 	BPF_ST_MEM(BPF_B, BPF_REG_8, 0, 0),
766 	BPF_MOV32_IMM(BPF_REG_0, 0),
767 	BPF_EXIT_INSN(),
768 	},
769 	.prog_type = BPF_PROG_TYPE_SCHED_CLS,
770 	.fixup_map_hash_48b = { 4 },
771 	.result = ACCEPT,
772 	.flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
773 },
774 {
775 	"jgt32: range bound deduction, reg1 op reg2, reg1 unknown",
776 	.insns = {
777 	BPF_ST_MEM(BPF_DW, BPF_REG_10, -8, 0),
778 	BPF_MOV64_REG(BPF_REG_8, BPF_REG_1),
779 	BPF_MOV64_REG(BPF_REG_2, BPF_REG_10),
780 	BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -8),
781 	BPF_LD_MAP_FD(BPF_REG_1, 0),
782 	BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0, BPF_FUNC_map_lookup_elem),
783 	BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 10),
784 	BPF_MOV64_REG(BPF_REG_1, BPF_REG_8),
785 	BPF_MOV64_REG(BPF_REG_8, BPF_REG_0),
786 	BPF_EMIT_CALL(BPF_FUNC_get_cgroup_classid),
787 	BPF_MOV32_IMM(BPF_REG_2, 1),
788 	BPF_JMP32_REG(BPF_JGT, BPF_REG_0, BPF_REG_2, 5),
789 	BPF_MOV32_REG(BPF_REG_6, BPF_REG_0),
790 	BPF_ALU64_IMM(BPF_LSH, BPF_REG_6, 32),
791 	BPF_ALU64_IMM(BPF_RSH, BPF_REG_6, 32),
792 	BPF_ALU64_REG(BPF_ADD, BPF_REG_8, BPF_REG_6),
793 	BPF_ST_MEM(BPF_B, BPF_REG_8, 0, 0),
794 	BPF_MOV32_IMM(BPF_REG_0, 0),
795 	BPF_EXIT_INSN(),
796 	},
797 	.prog_type = BPF_PROG_TYPE_SCHED_CLS,
798 	.fixup_map_hash_48b = { 4 },
799 	.result = ACCEPT,
800 	.flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
801 },
802 {
803 	"jle32: range bound deduction, reg1 op reg2, reg2 unknown",
804 	.insns = {
805 	BPF_ST_MEM(BPF_DW, BPF_REG_10, -8, 0),
806 	BPF_MOV64_REG(BPF_REG_8, BPF_REG_1),
807 	BPF_MOV64_REG(BPF_REG_2, BPF_REG_10),
808 	BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -8),
809 	BPF_LD_MAP_FD(BPF_REG_1, 0),
810 	BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0, BPF_FUNC_map_lookup_elem),
811 	BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 10),
812 	BPF_MOV64_REG(BPF_REG_1, BPF_REG_8),
813 	BPF_MOV64_REG(BPF_REG_8, BPF_REG_0),
814 	BPF_EMIT_CALL(BPF_FUNC_get_cgroup_classid),
815 	BPF_MOV32_IMM(BPF_REG_2, 1),
816 	BPF_JMP32_REG(BPF_JLE, BPF_REG_2, BPF_REG_0, 5),
817 	BPF_MOV32_REG(BPF_REG_6, BPF_REG_0),
818 	BPF_ALU64_IMM(BPF_LSH, BPF_REG_6, 32),
819 	BPF_ALU64_IMM(BPF_RSH, BPF_REG_6, 32),
820 	BPF_ALU64_REG(BPF_ADD, BPF_REG_8, BPF_REG_6),
821 	BPF_ST_MEM(BPF_B, BPF_REG_8, 0, 0),
822 	BPF_MOV32_IMM(BPF_REG_0, 0),
823 	BPF_EXIT_INSN(),
824 	},
825 	.prog_type = BPF_PROG_TYPE_SCHED_CLS,
826 	.fixup_map_hash_48b = { 4 },
827 	.result = ACCEPT,
828 	.flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
829 },
830