xref: /openbmc/linux/lib/test_bpf.c (revision f7d84fa7)
1 /*
2  * Testsuite for BPF interpreter and BPF JIT compiler
3  *
4  * Copyright (c) 2011-2014 PLUMgrid, http://plumgrid.com
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of version 2 of the GNU General Public
8  * License as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * General Public License for more details.
14  */
15 
16 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
17 
18 #include <linux/init.h>
19 #include <linux/module.h>
20 #include <linux/filter.h>
21 #include <linux/bpf.h>
22 #include <linux/skbuff.h>
23 #include <linux/netdevice.h>
24 #include <linux/if_vlan.h>
25 #include <linux/random.h>
26 #include <linux/highmem.h>
27 
28 /* General test specific settings */
29 #define MAX_SUBTESTS	3
30 #define MAX_TESTRUNS	10000
31 #define MAX_DATA	128
32 #define MAX_INSNS	512
33 #define MAX_K		0xffffFFFF
34 
35 /* Few constants used to init test 'skb' */
36 #define SKB_TYPE	3
37 #define SKB_MARK	0x1234aaaa
38 #define SKB_HASH	0x1234aaab
39 #define SKB_QUEUE_MAP	123
40 #define SKB_VLAN_TCI	0xffff
41 #define SKB_DEV_IFINDEX	577
42 #define SKB_DEV_TYPE	588
43 
44 /* Redefine REGs to make tests less verbose */
45 #define R0		BPF_REG_0
46 #define R1		BPF_REG_1
47 #define R2		BPF_REG_2
48 #define R3		BPF_REG_3
49 #define R4		BPF_REG_4
50 #define R5		BPF_REG_5
51 #define R6		BPF_REG_6
52 #define R7		BPF_REG_7
53 #define R8		BPF_REG_8
54 #define R9		BPF_REG_9
55 #define R10		BPF_REG_10
56 
57 /* Flags that can be passed to test cases */
58 #define FLAG_NO_DATA		BIT(0)
59 #define FLAG_EXPECTED_FAIL	BIT(1)
60 #define FLAG_SKB_FRAG		BIT(2)
61 
62 enum {
63 	CLASSIC  = BIT(6),	/* Old BPF instructions only. */
64 	INTERNAL = BIT(7),	/* Extended instruction set.  */
65 };
66 
67 #define TEST_TYPE_MASK		(CLASSIC | INTERNAL)
68 
69 struct bpf_test {
70 	const char *descr;
71 	union {
72 		struct sock_filter insns[MAX_INSNS];
73 		struct bpf_insn insns_int[MAX_INSNS];
74 		struct {
75 			void *insns;
76 			unsigned int len;
77 		} ptr;
78 	} u;
79 	__u8 aux;
80 	__u8 data[MAX_DATA];
81 	struct {
82 		int data_size;
83 		__u32 result;
84 	} test[MAX_SUBTESTS];
85 	int (*fill_helper)(struct bpf_test *self);
86 	__u8 frag_data[MAX_DATA];
87 };
88 
89 /* Large test cases need separate allocation and fill handler. */
90 
91 static int bpf_fill_maxinsns1(struct bpf_test *self)
92 {
93 	unsigned int len = BPF_MAXINSNS;
94 	struct sock_filter *insn;
95 	__u32 k = ~0;
96 	int i;
97 
98 	insn = kmalloc_array(len, sizeof(*insn), GFP_KERNEL);
99 	if (!insn)
100 		return -ENOMEM;
101 
102 	for (i = 0; i < len; i++, k--)
103 		insn[i] = __BPF_STMT(BPF_RET | BPF_K, k);
104 
105 	self->u.ptr.insns = insn;
106 	self->u.ptr.len = len;
107 
108 	return 0;
109 }
110 
111 static int bpf_fill_maxinsns2(struct bpf_test *self)
112 {
113 	unsigned int len = BPF_MAXINSNS;
114 	struct sock_filter *insn;
115 	int i;
116 
117 	insn = kmalloc_array(len, sizeof(*insn), GFP_KERNEL);
118 	if (!insn)
119 		return -ENOMEM;
120 
121 	for (i = 0; i < len; i++)
122 		insn[i] = __BPF_STMT(BPF_RET | BPF_K, 0xfefefefe);
123 
124 	self->u.ptr.insns = insn;
125 	self->u.ptr.len = len;
126 
127 	return 0;
128 }
129 
130 static int bpf_fill_maxinsns3(struct bpf_test *self)
131 {
132 	unsigned int len = BPF_MAXINSNS;
133 	struct sock_filter *insn;
134 	struct rnd_state rnd;
135 	int i;
136 
137 	insn = kmalloc_array(len, sizeof(*insn), GFP_KERNEL);
138 	if (!insn)
139 		return -ENOMEM;
140 
141 	prandom_seed_state(&rnd, 3141592653589793238ULL);
142 
143 	for (i = 0; i < len - 1; i++) {
144 		__u32 k = prandom_u32_state(&rnd);
145 
146 		insn[i] = __BPF_STMT(BPF_ALU | BPF_ADD | BPF_K, k);
147 	}
148 
149 	insn[len - 1] = __BPF_STMT(BPF_RET | BPF_A, 0);
150 
151 	self->u.ptr.insns = insn;
152 	self->u.ptr.len = len;
153 
154 	return 0;
155 }
156 
157 static int bpf_fill_maxinsns4(struct bpf_test *self)
158 {
159 	unsigned int len = BPF_MAXINSNS + 1;
160 	struct sock_filter *insn;
161 	int i;
162 
163 	insn = kmalloc_array(len, sizeof(*insn), GFP_KERNEL);
164 	if (!insn)
165 		return -ENOMEM;
166 
167 	for (i = 0; i < len; i++)
168 		insn[i] = __BPF_STMT(BPF_RET | BPF_K, 0xfefefefe);
169 
170 	self->u.ptr.insns = insn;
171 	self->u.ptr.len = len;
172 
173 	return 0;
174 }
175 
176 static int bpf_fill_maxinsns5(struct bpf_test *self)
177 {
178 	unsigned int len = BPF_MAXINSNS;
179 	struct sock_filter *insn;
180 	int i;
181 
182 	insn = kmalloc_array(len, sizeof(*insn), GFP_KERNEL);
183 	if (!insn)
184 		return -ENOMEM;
185 
186 	insn[0] = __BPF_JUMP(BPF_JMP | BPF_JA, len - 2, 0, 0);
187 
188 	for (i = 1; i < len - 1; i++)
189 		insn[i] = __BPF_STMT(BPF_RET | BPF_K, 0xfefefefe);
190 
191 	insn[len - 1] = __BPF_STMT(BPF_RET | BPF_K, 0xabababab);
192 
193 	self->u.ptr.insns = insn;
194 	self->u.ptr.len = len;
195 
196 	return 0;
197 }
198 
199 static int bpf_fill_maxinsns6(struct bpf_test *self)
200 {
201 	unsigned int len = BPF_MAXINSNS;
202 	struct sock_filter *insn;
203 	int i;
204 
205 	insn = kmalloc_array(len, sizeof(*insn), GFP_KERNEL);
206 	if (!insn)
207 		return -ENOMEM;
208 
209 	for (i = 0; i < len - 1; i++)
210 		insn[i] = __BPF_STMT(BPF_LD | BPF_W | BPF_ABS, SKF_AD_OFF +
211 				     SKF_AD_VLAN_TAG_PRESENT);
212 
213 	insn[len - 1] = __BPF_STMT(BPF_RET | BPF_A, 0);
214 
215 	self->u.ptr.insns = insn;
216 	self->u.ptr.len = len;
217 
218 	return 0;
219 }
220 
221 static int bpf_fill_maxinsns7(struct bpf_test *self)
222 {
223 	unsigned int len = BPF_MAXINSNS;
224 	struct sock_filter *insn;
225 	int i;
226 
227 	insn = kmalloc_array(len, sizeof(*insn), GFP_KERNEL);
228 	if (!insn)
229 		return -ENOMEM;
230 
231 	for (i = 0; i < len - 4; i++)
232 		insn[i] = __BPF_STMT(BPF_LD | BPF_W | BPF_ABS, SKF_AD_OFF +
233 				     SKF_AD_CPU);
234 
235 	insn[len - 4] = __BPF_STMT(BPF_MISC | BPF_TAX, 0);
236 	insn[len - 3] = __BPF_STMT(BPF_LD | BPF_W | BPF_ABS, SKF_AD_OFF +
237 				   SKF_AD_CPU);
238 	insn[len - 2] = __BPF_STMT(BPF_ALU | BPF_SUB | BPF_X, 0);
239 	insn[len - 1] = __BPF_STMT(BPF_RET | BPF_A, 0);
240 
241 	self->u.ptr.insns = insn;
242 	self->u.ptr.len = len;
243 
244 	return 0;
245 }
246 
247 static int bpf_fill_maxinsns8(struct bpf_test *self)
248 {
249 	unsigned int len = BPF_MAXINSNS;
250 	struct sock_filter *insn;
251 	int i, jmp_off = len - 3;
252 
253 	insn = kmalloc_array(len, sizeof(*insn), GFP_KERNEL);
254 	if (!insn)
255 		return -ENOMEM;
256 
257 	insn[0] = __BPF_STMT(BPF_LD | BPF_IMM, 0xffffffff);
258 
259 	for (i = 1; i < len - 1; i++)
260 		insn[i] = __BPF_JUMP(BPF_JMP | BPF_JGT, 0xffffffff, jmp_off--, 0);
261 
262 	insn[len - 1] = __BPF_STMT(BPF_RET | BPF_A, 0);
263 
264 	self->u.ptr.insns = insn;
265 	self->u.ptr.len = len;
266 
267 	return 0;
268 }
269 
270 static int bpf_fill_maxinsns9(struct bpf_test *self)
271 {
272 	unsigned int len = BPF_MAXINSNS;
273 	struct bpf_insn *insn;
274 	int i;
275 
276 	insn = kmalloc_array(len, sizeof(*insn), GFP_KERNEL);
277 	if (!insn)
278 		return -ENOMEM;
279 
280 	insn[0] = BPF_JMP_IMM(BPF_JA, 0, 0, len - 2);
281 	insn[1] = BPF_ALU32_IMM(BPF_MOV, R0, 0xcbababab);
282 	insn[2] = BPF_EXIT_INSN();
283 
284 	for (i = 3; i < len - 2; i++)
285 		insn[i] = BPF_ALU32_IMM(BPF_MOV, R0, 0xfefefefe);
286 
287 	insn[len - 2] = BPF_EXIT_INSN();
288 	insn[len - 1] = BPF_JMP_IMM(BPF_JA, 0, 0, -(len - 1));
289 
290 	self->u.ptr.insns = insn;
291 	self->u.ptr.len = len;
292 
293 	return 0;
294 }
295 
296 static int bpf_fill_maxinsns10(struct bpf_test *self)
297 {
298 	unsigned int len = BPF_MAXINSNS, hlen = len - 2;
299 	struct bpf_insn *insn;
300 	int i;
301 
302 	insn = kmalloc_array(len, sizeof(*insn), GFP_KERNEL);
303 	if (!insn)
304 		return -ENOMEM;
305 
306 	for (i = 0; i < hlen / 2; i++)
307 		insn[i] = BPF_JMP_IMM(BPF_JA, 0, 0, hlen - 2 - 2 * i);
308 	for (i = hlen - 1; i > hlen / 2; i--)
309 		insn[i] = BPF_JMP_IMM(BPF_JA, 0, 0, hlen - 1 - 2 * i);
310 
311 	insn[hlen / 2] = BPF_JMP_IMM(BPF_JA, 0, 0, hlen / 2 - 1);
312 	insn[hlen]     = BPF_ALU32_IMM(BPF_MOV, R0, 0xabababac);
313 	insn[hlen + 1] = BPF_EXIT_INSN();
314 
315 	self->u.ptr.insns = insn;
316 	self->u.ptr.len = len;
317 
318 	return 0;
319 }
320 
321 static int __bpf_fill_ja(struct bpf_test *self, unsigned int len,
322 			 unsigned int plen)
323 {
324 	struct sock_filter *insn;
325 	unsigned int rlen;
326 	int i, j;
327 
328 	insn = kmalloc_array(len, sizeof(*insn), GFP_KERNEL);
329 	if (!insn)
330 		return -ENOMEM;
331 
332 	rlen = (len % plen) - 1;
333 
334 	for (i = 0; i + plen < len; i += plen)
335 		for (j = 0; j < plen; j++)
336 			insn[i + j] = __BPF_JUMP(BPF_JMP | BPF_JA,
337 						 plen - 1 - j, 0, 0);
338 	for (j = 0; j < rlen; j++)
339 		insn[i + j] = __BPF_JUMP(BPF_JMP | BPF_JA, rlen - 1 - j,
340 					 0, 0);
341 
342 	insn[len - 1] = __BPF_STMT(BPF_RET | BPF_K, 0xababcbac);
343 
344 	self->u.ptr.insns = insn;
345 	self->u.ptr.len = len;
346 
347 	return 0;
348 }
349 
350 static int bpf_fill_maxinsns11(struct bpf_test *self)
351 {
352 	/* Hits 70 passes on x86_64, so cannot get JITed there. */
353 	return __bpf_fill_ja(self, BPF_MAXINSNS, 68);
354 }
355 
356 static int bpf_fill_ja(struct bpf_test *self)
357 {
358 	/* Hits exactly 11 passes on x86_64 JIT. */
359 	return __bpf_fill_ja(self, 12, 9);
360 }
361 
362 static int bpf_fill_ld_abs_get_processor_id(struct bpf_test *self)
363 {
364 	unsigned int len = BPF_MAXINSNS;
365 	struct sock_filter *insn;
366 	int i;
367 
368 	insn = kmalloc_array(len, sizeof(*insn), GFP_KERNEL);
369 	if (!insn)
370 		return -ENOMEM;
371 
372 	for (i = 0; i < len - 1; i += 2) {
373 		insn[i] = __BPF_STMT(BPF_LD | BPF_B | BPF_ABS, 0);
374 		insn[i + 1] = __BPF_STMT(BPF_LD | BPF_W | BPF_ABS,
375 					 SKF_AD_OFF + SKF_AD_CPU);
376 	}
377 
378 	insn[len - 1] = __BPF_STMT(BPF_RET | BPF_K, 0xbee);
379 
380 	self->u.ptr.insns = insn;
381 	self->u.ptr.len = len;
382 
383 	return 0;
384 }
385 
386 #define PUSH_CNT 68
387 /* test: {skb->data[0], vlan_push} x 68 + {skb->data[0], vlan_pop} x 68 */
388 static int bpf_fill_ld_abs_vlan_push_pop(struct bpf_test *self)
389 {
390 	unsigned int len = BPF_MAXINSNS;
391 	struct bpf_insn *insn;
392 	int i = 0, j, k = 0;
393 
394 	insn = kmalloc_array(len, sizeof(*insn), GFP_KERNEL);
395 	if (!insn)
396 		return -ENOMEM;
397 
398 	insn[i++] = BPF_MOV64_REG(R6, R1);
399 loop:
400 	for (j = 0; j < PUSH_CNT; j++) {
401 		insn[i++] = BPF_LD_ABS(BPF_B, 0);
402 		insn[i] = BPF_JMP_IMM(BPF_JNE, R0, 0x34, len - i - 2);
403 		i++;
404 		insn[i++] = BPF_MOV64_REG(R1, R6);
405 		insn[i++] = BPF_MOV64_IMM(R2, 1);
406 		insn[i++] = BPF_MOV64_IMM(R3, 2);
407 		insn[i++] = BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0,
408 					 bpf_skb_vlan_push_proto.func - __bpf_call_base);
409 		insn[i] = BPF_JMP_IMM(BPF_JNE, R0, 0, len - i - 2);
410 		i++;
411 	}
412 
413 	for (j = 0; j < PUSH_CNT; j++) {
414 		insn[i++] = BPF_LD_ABS(BPF_B, 0);
415 		insn[i] = BPF_JMP_IMM(BPF_JNE, R0, 0x34, len - i - 2);
416 		i++;
417 		insn[i++] = BPF_MOV64_REG(R1, R6);
418 		insn[i++] = BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0,
419 					 bpf_skb_vlan_pop_proto.func - __bpf_call_base);
420 		insn[i] = BPF_JMP_IMM(BPF_JNE, R0, 0, len - i - 2);
421 		i++;
422 	}
423 	if (++k < 5)
424 		goto loop;
425 
426 	for (; i < len - 1; i++)
427 		insn[i] = BPF_ALU32_IMM(BPF_MOV, R0, 0xbef);
428 
429 	insn[len - 1] = BPF_EXIT_INSN();
430 
431 	self->u.ptr.insns = insn;
432 	self->u.ptr.len = len;
433 
434 	return 0;
435 }
436 
437 static int __bpf_fill_stxdw(struct bpf_test *self, int size)
438 {
439 	unsigned int len = BPF_MAXINSNS;
440 	struct bpf_insn *insn;
441 	int i;
442 
443 	insn = kmalloc_array(len, sizeof(*insn), GFP_KERNEL);
444 	if (!insn)
445 		return -ENOMEM;
446 
447 	insn[0] = BPF_ALU32_IMM(BPF_MOV, R0, 1);
448 	insn[1] = BPF_ST_MEM(size, R10, -40, 42);
449 
450 	for (i = 2; i < len - 2; i++)
451 		insn[i] = BPF_STX_XADD(size, R10, R0, -40);
452 
453 	insn[len - 2] = BPF_LDX_MEM(size, R0, R10, -40);
454 	insn[len - 1] = BPF_EXIT_INSN();
455 
456 	self->u.ptr.insns = insn;
457 	self->u.ptr.len = len;
458 
459 	return 0;
460 }
461 
462 static int bpf_fill_stxw(struct bpf_test *self)
463 {
464 	return __bpf_fill_stxdw(self, BPF_W);
465 }
466 
467 static int bpf_fill_stxdw(struct bpf_test *self)
468 {
469 	return __bpf_fill_stxdw(self, BPF_DW);
470 }
471 
472 static struct bpf_test tests[] = {
473 	{
474 		"TAX",
475 		.u.insns = {
476 			BPF_STMT(BPF_LD | BPF_IMM, 1),
477 			BPF_STMT(BPF_MISC | BPF_TAX, 0),
478 			BPF_STMT(BPF_LD | BPF_IMM, 2),
479 			BPF_STMT(BPF_ALU | BPF_ADD | BPF_X, 0),
480 			BPF_STMT(BPF_ALU | BPF_NEG, 0), /* A == -3 */
481 			BPF_STMT(BPF_MISC | BPF_TAX, 0),
482 			BPF_STMT(BPF_LD | BPF_LEN, 0),
483 			BPF_STMT(BPF_ALU | BPF_ADD | BPF_X, 0),
484 			BPF_STMT(BPF_MISC | BPF_TAX, 0), /* X == len - 3 */
485 			BPF_STMT(BPF_LD | BPF_B | BPF_IND, 1),
486 			BPF_STMT(BPF_RET | BPF_A, 0)
487 		},
488 		CLASSIC,
489 		{ 10, 20, 30, 40, 50 },
490 		{ { 2, 10 }, { 3, 20 }, { 4, 30 } },
491 	},
492 	{
493 		"TXA",
494 		.u.insns = {
495 			BPF_STMT(BPF_LDX | BPF_LEN, 0),
496 			BPF_STMT(BPF_MISC | BPF_TXA, 0),
497 			BPF_STMT(BPF_ALU | BPF_ADD | BPF_X, 0),
498 			BPF_STMT(BPF_RET | BPF_A, 0) /* A == len * 2 */
499 		},
500 		CLASSIC,
501 		{ 10, 20, 30, 40, 50 },
502 		{ { 1, 2 }, { 3, 6 }, { 4, 8 } },
503 	},
504 	{
505 		"ADD_SUB_MUL_K",
506 		.u.insns = {
507 			BPF_STMT(BPF_LD | BPF_IMM, 1),
508 			BPF_STMT(BPF_ALU | BPF_ADD | BPF_K, 2),
509 			BPF_STMT(BPF_LDX | BPF_IMM, 3),
510 			BPF_STMT(BPF_ALU | BPF_SUB | BPF_X, 0),
511 			BPF_STMT(BPF_ALU | BPF_ADD | BPF_K, 0xffffffff),
512 			BPF_STMT(BPF_ALU | BPF_MUL | BPF_K, 3),
513 			BPF_STMT(BPF_RET | BPF_A, 0)
514 		},
515 		CLASSIC | FLAG_NO_DATA,
516 		{ },
517 		{ { 0, 0xfffffffd } }
518 	},
519 	{
520 		"DIV_MOD_KX",
521 		.u.insns = {
522 			BPF_STMT(BPF_LD | BPF_IMM, 8),
523 			BPF_STMT(BPF_ALU | BPF_DIV | BPF_K, 2),
524 			BPF_STMT(BPF_MISC | BPF_TAX, 0),
525 			BPF_STMT(BPF_LD | BPF_IMM, 0xffffffff),
526 			BPF_STMT(BPF_ALU | BPF_DIV | BPF_X, 0),
527 			BPF_STMT(BPF_MISC | BPF_TAX, 0),
528 			BPF_STMT(BPF_LD | BPF_IMM, 0xffffffff),
529 			BPF_STMT(BPF_ALU | BPF_DIV | BPF_K, 0x70000000),
530 			BPF_STMT(BPF_MISC | BPF_TAX, 0),
531 			BPF_STMT(BPF_LD | BPF_IMM, 0xffffffff),
532 			BPF_STMT(BPF_ALU | BPF_MOD | BPF_X, 0),
533 			BPF_STMT(BPF_MISC | BPF_TAX, 0),
534 			BPF_STMT(BPF_LD | BPF_IMM, 0xffffffff),
535 			BPF_STMT(BPF_ALU | BPF_MOD | BPF_K, 0x70000000),
536 			BPF_STMT(BPF_ALU | BPF_ADD | BPF_X, 0),
537 			BPF_STMT(BPF_RET | BPF_A, 0)
538 		},
539 		CLASSIC | FLAG_NO_DATA,
540 		{ },
541 		{ { 0, 0x20000000 } }
542 	},
543 	{
544 		"AND_OR_LSH_K",
545 		.u.insns = {
546 			BPF_STMT(BPF_LD | BPF_IMM, 0xff),
547 			BPF_STMT(BPF_ALU | BPF_AND | BPF_K, 0xf0),
548 			BPF_STMT(BPF_ALU | BPF_LSH | BPF_K, 27),
549 			BPF_STMT(BPF_MISC | BPF_TAX, 0),
550 			BPF_STMT(BPF_LD | BPF_IMM, 0xf),
551 			BPF_STMT(BPF_ALU | BPF_OR | BPF_K, 0xf0),
552 			BPF_STMT(BPF_ALU | BPF_ADD | BPF_X, 0),
553 			BPF_STMT(BPF_RET | BPF_A, 0)
554 		},
555 		CLASSIC | FLAG_NO_DATA,
556 		{ },
557 		{ { 0, 0x800000ff }, { 1, 0x800000ff } },
558 	},
559 	{
560 		"LD_IMM_0",
561 		.u.insns = {
562 			BPF_STMT(BPF_LD | BPF_IMM, 0), /* ld #0 */
563 			BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, 0, 1, 0),
564 			BPF_STMT(BPF_RET | BPF_K, 0),
565 			BPF_STMT(BPF_RET | BPF_K, 1),
566 		},
567 		CLASSIC,
568 		{ },
569 		{ { 1, 1 } },
570 	},
571 	{
572 		"LD_IND",
573 		.u.insns = {
574 			BPF_STMT(BPF_LDX | BPF_LEN, 0),
575 			BPF_STMT(BPF_LD | BPF_H | BPF_IND, MAX_K),
576 			BPF_STMT(BPF_RET | BPF_K, 1)
577 		},
578 		CLASSIC,
579 		{ },
580 		{ { 1, 0 }, { 10, 0 }, { 60, 0 } },
581 	},
582 	{
583 		"LD_ABS",
584 		.u.insns = {
585 			BPF_STMT(BPF_LD | BPF_W | BPF_ABS, 1000),
586 			BPF_STMT(BPF_RET | BPF_K, 1)
587 		},
588 		CLASSIC,
589 		{ },
590 		{ { 1, 0 }, { 10, 0 }, { 60, 0 } },
591 	},
592 	{
593 		"LD_ABS_LL",
594 		.u.insns = {
595 			BPF_STMT(BPF_LD | BPF_B | BPF_ABS, SKF_LL_OFF),
596 			BPF_STMT(BPF_MISC | BPF_TAX, 0),
597 			BPF_STMT(BPF_LD | BPF_B | BPF_ABS, SKF_LL_OFF + 1),
598 			BPF_STMT(BPF_ALU | BPF_ADD | BPF_X, 0),
599 			BPF_STMT(BPF_RET | BPF_A, 0)
600 		},
601 		CLASSIC,
602 		{ 1, 2, 3 },
603 		{ { 1, 0 }, { 2, 3 } },
604 	},
605 	{
606 		"LD_IND_LL",
607 		.u.insns = {
608 			BPF_STMT(BPF_LD | BPF_IMM, SKF_LL_OFF - 1),
609 			BPF_STMT(BPF_LDX | BPF_LEN, 0),
610 			BPF_STMT(BPF_ALU | BPF_ADD | BPF_X, 0),
611 			BPF_STMT(BPF_MISC | BPF_TAX, 0),
612 			BPF_STMT(BPF_LD | BPF_B | BPF_IND, 0),
613 			BPF_STMT(BPF_RET | BPF_A, 0)
614 		},
615 		CLASSIC,
616 		{ 1, 2, 3, 0xff },
617 		{ { 1, 1 }, { 3, 3 }, { 4, 0xff } },
618 	},
619 	{
620 		"LD_ABS_NET",
621 		.u.insns = {
622 			BPF_STMT(BPF_LD | BPF_B | BPF_ABS, SKF_NET_OFF),
623 			BPF_STMT(BPF_MISC | BPF_TAX, 0),
624 			BPF_STMT(BPF_LD | BPF_B | BPF_ABS, SKF_NET_OFF + 1),
625 			BPF_STMT(BPF_ALU | BPF_ADD | BPF_X, 0),
626 			BPF_STMT(BPF_RET | BPF_A, 0)
627 		},
628 		CLASSIC,
629 		{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3 },
630 		{ { 15, 0 }, { 16, 3 } },
631 	},
632 	{
633 		"LD_IND_NET",
634 		.u.insns = {
635 			BPF_STMT(BPF_LD | BPF_IMM, SKF_NET_OFF - 15),
636 			BPF_STMT(BPF_LDX | BPF_LEN, 0),
637 			BPF_STMT(BPF_ALU | BPF_ADD | BPF_X, 0),
638 			BPF_STMT(BPF_MISC | BPF_TAX, 0),
639 			BPF_STMT(BPF_LD | BPF_B | BPF_IND, 0),
640 			BPF_STMT(BPF_RET | BPF_A, 0)
641 		},
642 		CLASSIC,
643 		{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3 },
644 		{ { 14, 0 }, { 15, 1 }, { 17, 3 } },
645 	},
646 	{
647 		"LD_PKTTYPE",
648 		.u.insns = {
649 			BPF_STMT(BPF_LD | BPF_W | BPF_ABS,
650 				 SKF_AD_OFF + SKF_AD_PKTTYPE),
651 			BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, SKB_TYPE, 1, 0),
652 			BPF_STMT(BPF_RET | BPF_K, 1),
653 			BPF_STMT(BPF_LD | BPF_W | BPF_ABS,
654 				 SKF_AD_OFF + SKF_AD_PKTTYPE),
655 			BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, SKB_TYPE, 1, 0),
656 			BPF_STMT(BPF_RET | BPF_K, 1),
657 			BPF_STMT(BPF_LD | BPF_W | BPF_ABS,
658 				 SKF_AD_OFF + SKF_AD_PKTTYPE),
659 			BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, SKB_TYPE, 1, 0),
660 			BPF_STMT(BPF_RET | BPF_K, 1),
661 			BPF_STMT(BPF_RET | BPF_A, 0)
662 		},
663 		CLASSIC,
664 		{ },
665 		{ { 1, 3 }, { 10, 3 } },
666 	},
667 	{
668 		"LD_MARK",
669 		.u.insns = {
670 			BPF_STMT(BPF_LD | BPF_W | BPF_ABS,
671 				 SKF_AD_OFF + SKF_AD_MARK),
672 			BPF_STMT(BPF_RET | BPF_A, 0)
673 		},
674 		CLASSIC,
675 		{ },
676 		{ { 1, SKB_MARK}, { 10, SKB_MARK} },
677 	},
678 	{
679 		"LD_RXHASH",
680 		.u.insns = {
681 			BPF_STMT(BPF_LD | BPF_W | BPF_ABS,
682 				 SKF_AD_OFF + SKF_AD_RXHASH),
683 			BPF_STMT(BPF_RET | BPF_A, 0)
684 		},
685 		CLASSIC,
686 		{ },
687 		{ { 1, SKB_HASH}, { 10, SKB_HASH} },
688 	},
689 	{
690 		"LD_QUEUE",
691 		.u.insns = {
692 			BPF_STMT(BPF_LD | BPF_W | BPF_ABS,
693 				 SKF_AD_OFF + SKF_AD_QUEUE),
694 			BPF_STMT(BPF_RET | BPF_A, 0)
695 		},
696 		CLASSIC,
697 		{ },
698 		{ { 1, SKB_QUEUE_MAP }, { 10, SKB_QUEUE_MAP } },
699 	},
700 	{
701 		"LD_PROTOCOL",
702 		.u.insns = {
703 			BPF_STMT(BPF_LD | BPF_B | BPF_ABS, 1),
704 			BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, 20, 1, 0),
705 			BPF_STMT(BPF_RET | BPF_K, 0),
706 			BPF_STMT(BPF_LD | BPF_W | BPF_ABS,
707 				 SKF_AD_OFF + SKF_AD_PROTOCOL),
708 			BPF_STMT(BPF_MISC | BPF_TAX, 0),
709 			BPF_STMT(BPF_LD | BPF_B | BPF_ABS, 2),
710 			BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, 30, 1, 0),
711 			BPF_STMT(BPF_RET | BPF_K, 0),
712 			BPF_STMT(BPF_MISC | BPF_TXA, 0),
713 			BPF_STMT(BPF_RET | BPF_A, 0)
714 		},
715 		CLASSIC,
716 		{ 10, 20, 30 },
717 		{ { 10, ETH_P_IP }, { 100, ETH_P_IP } },
718 	},
719 	{
720 		"LD_VLAN_TAG",
721 		.u.insns = {
722 			BPF_STMT(BPF_LD | BPF_W | BPF_ABS,
723 				 SKF_AD_OFF + SKF_AD_VLAN_TAG),
724 			BPF_STMT(BPF_RET | BPF_A, 0)
725 		},
726 		CLASSIC,
727 		{ },
728 		{
729 			{ 1, SKB_VLAN_TCI & ~VLAN_TAG_PRESENT },
730 			{ 10, SKB_VLAN_TCI & ~VLAN_TAG_PRESENT }
731 		},
732 	},
733 	{
734 		"LD_VLAN_TAG_PRESENT",
735 		.u.insns = {
736 			BPF_STMT(BPF_LD | BPF_W | BPF_ABS,
737 				 SKF_AD_OFF + SKF_AD_VLAN_TAG_PRESENT),
738 			BPF_STMT(BPF_RET | BPF_A, 0)
739 		},
740 		CLASSIC,
741 		{ },
742 		{
743 			{ 1, !!(SKB_VLAN_TCI & VLAN_TAG_PRESENT) },
744 			{ 10, !!(SKB_VLAN_TCI & VLAN_TAG_PRESENT) }
745 		},
746 	},
747 	{
748 		"LD_IFINDEX",
749 		.u.insns = {
750 			BPF_STMT(BPF_LD | BPF_W | BPF_ABS,
751 				 SKF_AD_OFF + SKF_AD_IFINDEX),
752 			BPF_STMT(BPF_RET | BPF_A, 0)
753 		},
754 		CLASSIC,
755 		{ },
756 		{ { 1, SKB_DEV_IFINDEX }, { 10, SKB_DEV_IFINDEX } },
757 	},
758 	{
759 		"LD_HATYPE",
760 		.u.insns = {
761 			BPF_STMT(BPF_LD | BPF_W | BPF_ABS,
762 				 SKF_AD_OFF + SKF_AD_HATYPE),
763 			BPF_STMT(BPF_RET | BPF_A, 0)
764 		},
765 		CLASSIC,
766 		{ },
767 		{ { 1, SKB_DEV_TYPE }, { 10, SKB_DEV_TYPE } },
768 	},
769 	{
770 		"LD_CPU",
771 		.u.insns = {
772 			BPF_STMT(BPF_LD | BPF_W | BPF_ABS,
773 				 SKF_AD_OFF + SKF_AD_CPU),
774 			BPF_STMT(BPF_MISC | BPF_TAX, 0),
775 			BPF_STMT(BPF_LD | BPF_W | BPF_ABS,
776 				 SKF_AD_OFF + SKF_AD_CPU),
777 			BPF_STMT(BPF_ALU | BPF_SUB | BPF_X, 0),
778 			BPF_STMT(BPF_RET | BPF_A, 0)
779 		},
780 		CLASSIC,
781 		{ },
782 		{ { 1, 0 }, { 10, 0 } },
783 	},
784 	{
785 		"LD_NLATTR",
786 		.u.insns = {
787 			BPF_STMT(BPF_LDX | BPF_IMM, 2),
788 			BPF_STMT(BPF_MISC | BPF_TXA, 0),
789 			BPF_STMT(BPF_LDX | BPF_IMM, 3),
790 			BPF_STMT(BPF_LD | BPF_W | BPF_ABS,
791 				 SKF_AD_OFF + SKF_AD_NLATTR),
792 			BPF_STMT(BPF_RET | BPF_A, 0)
793 		},
794 		CLASSIC,
795 #ifdef __BIG_ENDIAN
796 		{ 0xff, 0xff, 0, 4, 0, 2, 0, 4, 0, 3 },
797 #else
798 		{ 0xff, 0xff, 4, 0, 2, 0, 4, 0, 3, 0 },
799 #endif
800 		{ { 4, 0 }, { 20, 6 } },
801 	},
802 	{
803 		"LD_NLATTR_NEST",
804 		.u.insns = {
805 			BPF_STMT(BPF_LD | BPF_IMM, 2),
806 			BPF_STMT(BPF_LDX | BPF_IMM, 3),
807 			BPF_STMT(BPF_LD | BPF_W | BPF_ABS,
808 				 SKF_AD_OFF + SKF_AD_NLATTR_NEST),
809 			BPF_STMT(BPF_LD | BPF_IMM, 2),
810 			BPF_STMT(BPF_LD | BPF_W | BPF_ABS,
811 				 SKF_AD_OFF + SKF_AD_NLATTR_NEST),
812 			BPF_STMT(BPF_LD | BPF_IMM, 2),
813 			BPF_STMT(BPF_LD | BPF_W | BPF_ABS,
814 				 SKF_AD_OFF + SKF_AD_NLATTR_NEST),
815 			BPF_STMT(BPF_LD | BPF_IMM, 2),
816 			BPF_STMT(BPF_LD | BPF_W | BPF_ABS,
817 				 SKF_AD_OFF + SKF_AD_NLATTR_NEST),
818 			BPF_STMT(BPF_LD | BPF_IMM, 2),
819 			BPF_STMT(BPF_LD | BPF_W | BPF_ABS,
820 				 SKF_AD_OFF + SKF_AD_NLATTR_NEST),
821 			BPF_STMT(BPF_LD | BPF_IMM, 2),
822 			BPF_STMT(BPF_LD | BPF_W | BPF_ABS,
823 				 SKF_AD_OFF + SKF_AD_NLATTR_NEST),
824 			BPF_STMT(BPF_LD | BPF_IMM, 2),
825 			BPF_STMT(BPF_LD | BPF_W | BPF_ABS,
826 				 SKF_AD_OFF + SKF_AD_NLATTR_NEST),
827 			BPF_STMT(BPF_LD | BPF_IMM, 2),
828 			BPF_STMT(BPF_LD | BPF_W | BPF_ABS,
829 				 SKF_AD_OFF + SKF_AD_NLATTR_NEST),
830 			BPF_STMT(BPF_RET | BPF_A, 0)
831 		},
832 		CLASSIC,
833 #ifdef __BIG_ENDIAN
834 		{ 0xff, 0xff, 0, 12, 0, 1, 0, 4, 0, 2, 0, 4, 0, 3 },
835 #else
836 		{ 0xff, 0xff, 12, 0, 1, 0, 4, 0, 2, 0, 4, 0, 3, 0 },
837 #endif
838 		{ { 4, 0 }, { 20, 10 } },
839 	},
840 	{
841 		"LD_PAYLOAD_OFF",
842 		.u.insns = {
843 			BPF_STMT(BPF_LD | BPF_W | BPF_ABS,
844 				 SKF_AD_OFF + SKF_AD_PAY_OFFSET),
845 			BPF_STMT(BPF_LD | BPF_W | BPF_ABS,
846 				 SKF_AD_OFF + SKF_AD_PAY_OFFSET),
847 			BPF_STMT(BPF_LD | BPF_W | BPF_ABS,
848 				 SKF_AD_OFF + SKF_AD_PAY_OFFSET),
849 			BPF_STMT(BPF_LD | BPF_W | BPF_ABS,
850 				 SKF_AD_OFF + SKF_AD_PAY_OFFSET),
851 			BPF_STMT(BPF_LD | BPF_W | BPF_ABS,
852 				 SKF_AD_OFF + SKF_AD_PAY_OFFSET),
853 			BPF_STMT(BPF_RET | BPF_A, 0)
854 		},
855 		CLASSIC,
856 		/* 00:00:00:00:00:00 > 00:00:00:00:00:00, ethtype IPv4 (0x0800),
857 		 * length 98: 127.0.0.1 > 127.0.0.1: ICMP echo request,
858 		 * id 9737, seq 1, length 64
859 		 */
860 		{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
861 		  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
862 		  0x08, 0x00,
863 		  0x45, 0x00, 0x00, 0x54, 0xac, 0x8b, 0x40, 0x00, 0x40,
864 		  0x01, 0x90, 0x1b, 0x7f, 0x00, 0x00, 0x01 },
865 		{ { 30, 0 }, { 100, 42 } },
866 	},
867 	{
868 		"LD_ANC_XOR",
869 		.u.insns = {
870 			BPF_STMT(BPF_LD | BPF_IMM, 10),
871 			BPF_STMT(BPF_LDX | BPF_IMM, 300),
872 			BPF_STMT(BPF_LD | BPF_W | BPF_ABS,
873 				 SKF_AD_OFF + SKF_AD_ALU_XOR_X),
874 			BPF_STMT(BPF_RET | BPF_A, 0)
875 		},
876 		CLASSIC,
877 		{ },
878 		{ { 4, 10 ^ 300 }, { 20, 10 ^ 300 } },
879 	},
880 	{
881 		"SPILL_FILL",
882 		.u.insns = {
883 			BPF_STMT(BPF_LDX | BPF_LEN, 0),
884 			BPF_STMT(BPF_LD | BPF_IMM, 2),
885 			BPF_STMT(BPF_ALU | BPF_RSH, 1),
886 			BPF_STMT(BPF_ALU | BPF_XOR | BPF_X, 0),
887 			BPF_STMT(BPF_ST, 1), /* M1 = 1 ^ len */
888 			BPF_STMT(BPF_ALU | BPF_XOR | BPF_K, 0x80000000),
889 			BPF_STMT(BPF_ST, 2), /* M2 = 1 ^ len ^ 0x80000000 */
890 			BPF_STMT(BPF_STX, 15), /* M3 = len */
891 			BPF_STMT(BPF_LDX | BPF_MEM, 1),
892 			BPF_STMT(BPF_LD | BPF_MEM, 2),
893 			BPF_STMT(BPF_ALU | BPF_XOR | BPF_X, 0),
894 			BPF_STMT(BPF_LDX | BPF_MEM, 15),
895 			BPF_STMT(BPF_ALU | BPF_XOR | BPF_X, 0),
896 			BPF_STMT(BPF_RET | BPF_A, 0)
897 		},
898 		CLASSIC,
899 		{ },
900 		{ { 1, 0x80000001 }, { 2, 0x80000002 }, { 60, 0x80000000 ^ 60 } }
901 	},
902 	{
903 		"JEQ",
904 		.u.insns = {
905 			BPF_STMT(BPF_LDX | BPF_LEN, 0),
906 			BPF_STMT(BPF_LD | BPF_B | BPF_ABS, 2),
907 			BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_X, 0, 0, 1),
908 			BPF_STMT(BPF_RET | BPF_K, 1),
909 			BPF_STMT(BPF_RET | BPF_K, MAX_K)
910 		},
911 		CLASSIC,
912 		{ 3, 3, 3, 3, 3 },
913 		{ { 1, 0 }, { 3, 1 }, { 4, MAX_K } },
914 	},
915 	{
916 		"JGT",
917 		.u.insns = {
918 			BPF_STMT(BPF_LDX | BPF_LEN, 0),
919 			BPF_STMT(BPF_LD | BPF_B | BPF_ABS, 2),
920 			BPF_JUMP(BPF_JMP | BPF_JGT | BPF_X, 0, 0, 1),
921 			BPF_STMT(BPF_RET | BPF_K, 1),
922 			BPF_STMT(BPF_RET | BPF_K, MAX_K)
923 		},
924 		CLASSIC,
925 		{ 4, 4, 4, 3, 3 },
926 		{ { 2, 0 }, { 3, 1 }, { 4, MAX_K } },
927 	},
928 	{
929 		"JGE",
930 		.u.insns = {
931 			BPF_STMT(BPF_LDX | BPF_LEN, 0),
932 			BPF_STMT(BPF_LD | BPF_B | BPF_IND, MAX_K),
933 			BPF_JUMP(BPF_JMP | BPF_JGE | BPF_K, 1, 1, 0),
934 			BPF_STMT(BPF_RET | BPF_K, 10),
935 			BPF_JUMP(BPF_JMP | BPF_JGE | BPF_K, 2, 1, 0),
936 			BPF_STMT(BPF_RET | BPF_K, 20),
937 			BPF_JUMP(BPF_JMP | BPF_JGE | BPF_K, 3, 1, 0),
938 			BPF_STMT(BPF_RET | BPF_K, 30),
939 			BPF_JUMP(BPF_JMP | BPF_JGE | BPF_K, 4, 1, 0),
940 			BPF_STMT(BPF_RET | BPF_K, 40),
941 			BPF_STMT(BPF_RET | BPF_K, MAX_K)
942 		},
943 		CLASSIC,
944 		{ 1, 2, 3, 4, 5 },
945 		{ { 1, 20 }, { 3, 40 }, { 5, MAX_K } },
946 	},
947 	{
948 		"JSET",
949 		.u.insns = {
950 			BPF_JUMP(BPF_JMP | BPF_JA, 0, 0, 0),
951 			BPF_JUMP(BPF_JMP | BPF_JA, 1, 1, 1),
952 			BPF_JUMP(BPF_JMP | BPF_JA, 0, 0, 0),
953 			BPF_JUMP(BPF_JMP | BPF_JA, 0, 0, 0),
954 			BPF_STMT(BPF_LDX | BPF_LEN, 0),
955 			BPF_STMT(BPF_MISC | BPF_TXA, 0),
956 			BPF_STMT(BPF_ALU | BPF_SUB | BPF_K, 4),
957 			BPF_STMT(BPF_MISC | BPF_TAX, 0),
958 			BPF_STMT(BPF_LD | BPF_W | BPF_IND, 0),
959 			BPF_JUMP(BPF_JMP | BPF_JSET | BPF_K, 1, 0, 1),
960 			BPF_STMT(BPF_RET | BPF_K, 10),
961 			BPF_JUMP(BPF_JMP | BPF_JSET | BPF_K, 0x80000000, 0, 1),
962 			BPF_STMT(BPF_RET | BPF_K, 20),
963 			BPF_JUMP(BPF_JMP | BPF_JSET | BPF_K, 0xffffff, 1, 0),
964 			BPF_STMT(BPF_RET | BPF_K, 30),
965 			BPF_JUMP(BPF_JMP | BPF_JSET | BPF_K, 0xffffff, 1, 0),
966 			BPF_STMT(BPF_RET | BPF_K, 30),
967 			BPF_JUMP(BPF_JMP | BPF_JSET | BPF_K, 0xffffff, 1, 0),
968 			BPF_STMT(BPF_RET | BPF_K, 30),
969 			BPF_JUMP(BPF_JMP | BPF_JSET | BPF_K, 0xffffff, 1, 0),
970 			BPF_STMT(BPF_RET | BPF_K, 30),
971 			BPF_JUMP(BPF_JMP | BPF_JSET | BPF_K, 0xffffff, 1, 0),
972 			BPF_STMT(BPF_RET | BPF_K, 30),
973 			BPF_STMT(BPF_RET | BPF_K, MAX_K)
974 		},
975 		CLASSIC,
976 		{ 0, 0xAA, 0x55, 1 },
977 		{ { 4, 10 }, { 5, 20 }, { 6, MAX_K } },
978 	},
979 	{
980 		"tcpdump port 22",
981 		.u.insns = {
982 			BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 12),
983 			BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, 0x86dd, 0, 8), /* IPv6 */
984 			BPF_STMT(BPF_LD | BPF_B | BPF_ABS, 20),
985 			BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, 0x84, 2, 0),
986 			BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, 0x6, 1, 0),
987 			BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, 0x11, 0, 17),
988 			BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 54),
989 			BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, 22, 14, 0),
990 			BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 56),
991 			BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, 22, 12, 13),
992 			BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, 0x0800, 0, 12), /* IPv4 */
993 			BPF_STMT(BPF_LD | BPF_B | BPF_ABS, 23),
994 			BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, 0x84, 2, 0),
995 			BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, 0x6, 1, 0),
996 			BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, 0x11, 0, 8),
997 			BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 20),
998 			BPF_JUMP(BPF_JMP | BPF_JSET | BPF_K, 0x1fff, 6, 0),
999 			BPF_STMT(BPF_LDX | BPF_B | BPF_MSH, 14),
1000 			BPF_STMT(BPF_LD | BPF_H | BPF_IND, 14),
1001 			BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, 22, 2, 0),
1002 			BPF_STMT(BPF_LD | BPF_H | BPF_IND, 16),
1003 			BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, 22, 0, 1),
1004 			BPF_STMT(BPF_RET | BPF_K, 0xffff),
1005 			BPF_STMT(BPF_RET | BPF_K, 0),
1006 		},
1007 		CLASSIC,
1008 		/* 3c:07:54:43:e5:76 > 10:bf:48:d6:43:d6, ethertype IPv4(0x0800)
1009 		 * length 114: 10.1.1.149.49700 > 10.1.2.10.22: Flags [P.],
1010 		 * seq 1305692979:1305693027, ack 3650467037, win 65535,
1011 		 * options [nop,nop,TS val 2502645400 ecr 3971138], length 48
1012 		 */
1013 		{ 0x10, 0xbf, 0x48, 0xd6, 0x43, 0xd6,
1014 		  0x3c, 0x07, 0x54, 0x43, 0xe5, 0x76,
1015 		  0x08, 0x00,
1016 		  0x45, 0x10, 0x00, 0x64, 0x75, 0xb5,
1017 		  0x40, 0x00, 0x40, 0x06, 0xad, 0x2e, /* IP header */
1018 		  0x0a, 0x01, 0x01, 0x95, /* ip src */
1019 		  0x0a, 0x01, 0x02, 0x0a, /* ip dst */
1020 		  0xc2, 0x24,
1021 		  0x00, 0x16 /* dst port */ },
1022 		{ { 10, 0 }, { 30, 0 }, { 100, 65535 } },
1023 	},
1024 	{
1025 		"tcpdump complex",
1026 		.u.insns = {
1027 			/* tcpdump -nei eth0 'tcp port 22 and (((ip[2:2] -
1028 			 * ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0) and
1029 			 * (len > 115 or len < 30000000000)' -d
1030 			 */
1031 			BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 12),
1032 			BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, 0x86dd, 30, 0),
1033 			BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, 0x800, 0, 29),
1034 			BPF_STMT(BPF_LD | BPF_B | BPF_ABS, 23),
1035 			BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, 0x6, 0, 27),
1036 			BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 20),
1037 			BPF_JUMP(BPF_JMP | BPF_JSET | BPF_K, 0x1fff, 25, 0),
1038 			BPF_STMT(BPF_LDX | BPF_B | BPF_MSH, 14),
1039 			BPF_STMT(BPF_LD | BPF_H | BPF_IND, 14),
1040 			BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, 22, 2, 0),
1041 			BPF_STMT(BPF_LD | BPF_H | BPF_IND, 16),
1042 			BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, 22, 0, 20),
1043 			BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 16),
1044 			BPF_STMT(BPF_ST, 1),
1045 			BPF_STMT(BPF_LD | BPF_B | BPF_ABS, 14),
1046 			BPF_STMT(BPF_ALU | BPF_AND | BPF_K, 0xf),
1047 			BPF_STMT(BPF_ALU | BPF_LSH | BPF_K, 2),
1048 			BPF_STMT(BPF_MISC | BPF_TAX, 0x5), /* libpcap emits K on TAX */
1049 			BPF_STMT(BPF_LD | BPF_MEM, 1),
1050 			BPF_STMT(BPF_ALU | BPF_SUB | BPF_X, 0),
1051 			BPF_STMT(BPF_ST, 5),
1052 			BPF_STMT(BPF_LDX | BPF_B | BPF_MSH, 14),
1053 			BPF_STMT(BPF_LD | BPF_B | BPF_IND, 26),
1054 			BPF_STMT(BPF_ALU | BPF_AND | BPF_K, 0xf0),
1055 			BPF_STMT(BPF_ALU | BPF_RSH | BPF_K, 2),
1056 			BPF_STMT(BPF_MISC | BPF_TAX, 0x9), /* libpcap emits K on TAX */
1057 			BPF_STMT(BPF_LD | BPF_MEM, 5),
1058 			BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_X, 0, 4, 0),
1059 			BPF_STMT(BPF_LD | BPF_LEN, 0),
1060 			BPF_JUMP(BPF_JMP | BPF_JGT | BPF_K, 0x73, 1, 0),
1061 			BPF_JUMP(BPF_JMP | BPF_JGE | BPF_K, 0xfc23ac00, 1, 0),
1062 			BPF_STMT(BPF_RET | BPF_K, 0xffff),
1063 			BPF_STMT(BPF_RET | BPF_K, 0),
1064 		},
1065 		CLASSIC,
1066 		{ 0x10, 0xbf, 0x48, 0xd6, 0x43, 0xd6,
1067 		  0x3c, 0x07, 0x54, 0x43, 0xe5, 0x76,
1068 		  0x08, 0x00,
1069 		  0x45, 0x10, 0x00, 0x64, 0x75, 0xb5,
1070 		  0x40, 0x00, 0x40, 0x06, 0xad, 0x2e, /* IP header */
1071 		  0x0a, 0x01, 0x01, 0x95, /* ip src */
1072 		  0x0a, 0x01, 0x02, 0x0a, /* ip dst */
1073 		  0xc2, 0x24,
1074 		  0x00, 0x16 /* dst port */ },
1075 		{ { 10, 0 }, { 30, 0 }, { 100, 65535 } },
1076 	},
1077 	{
1078 		"RET_A",
1079 		.u.insns = {
1080 			/* check that unitialized X and A contain zeros */
1081 			BPF_STMT(BPF_MISC | BPF_TXA, 0),
1082 			BPF_STMT(BPF_RET | BPF_A, 0)
1083 		},
1084 		CLASSIC,
1085 		{ },
1086 		{ {1, 0}, {2, 0} },
1087 	},
1088 	{
1089 		"INT: ADD trivial",
1090 		.u.insns_int = {
1091 			BPF_ALU64_IMM(BPF_MOV, R1, 1),
1092 			BPF_ALU64_IMM(BPF_ADD, R1, 2),
1093 			BPF_ALU64_IMM(BPF_MOV, R2, 3),
1094 			BPF_ALU64_REG(BPF_SUB, R1, R2),
1095 			BPF_ALU64_IMM(BPF_ADD, R1, -1),
1096 			BPF_ALU64_IMM(BPF_MUL, R1, 3),
1097 			BPF_ALU64_REG(BPF_MOV, R0, R1),
1098 			BPF_EXIT_INSN(),
1099 		},
1100 		INTERNAL,
1101 		{ },
1102 		{ { 0, 0xfffffffd } }
1103 	},
1104 	{
1105 		"INT: MUL_X",
1106 		.u.insns_int = {
1107 			BPF_ALU64_IMM(BPF_MOV, R0, -1),
1108 			BPF_ALU64_IMM(BPF_MOV, R1, -1),
1109 			BPF_ALU64_IMM(BPF_MOV, R2, 3),
1110 			BPF_ALU64_REG(BPF_MUL, R1, R2),
1111 			BPF_JMP_IMM(BPF_JEQ, R1, 0xfffffffd, 1),
1112 			BPF_EXIT_INSN(),
1113 			BPF_ALU64_IMM(BPF_MOV, R0, 1),
1114 			BPF_EXIT_INSN(),
1115 		},
1116 		INTERNAL,
1117 		{ },
1118 		{ { 0, 1 } }
1119 	},
1120 	{
1121 		"INT: MUL_X2",
1122 		.u.insns_int = {
1123 			BPF_ALU32_IMM(BPF_MOV, R0, -1),
1124 			BPF_ALU32_IMM(BPF_MOV, R1, -1),
1125 			BPF_ALU32_IMM(BPF_MOV, R2, 3),
1126 			BPF_ALU64_REG(BPF_MUL, R1, R2),
1127 			BPF_ALU64_IMM(BPF_RSH, R1, 8),
1128 			BPF_JMP_IMM(BPF_JEQ, R1, 0x2ffffff, 1),
1129 			BPF_EXIT_INSN(),
1130 			BPF_ALU32_IMM(BPF_MOV, R0, 1),
1131 			BPF_EXIT_INSN(),
1132 		},
1133 		INTERNAL,
1134 		{ },
1135 		{ { 0, 1 } }
1136 	},
1137 	{
1138 		"INT: MUL32_X",
1139 		.u.insns_int = {
1140 			BPF_ALU32_IMM(BPF_MOV, R0, -1),
1141 			BPF_ALU64_IMM(BPF_MOV, R1, -1),
1142 			BPF_ALU32_IMM(BPF_MOV, R2, 3),
1143 			BPF_ALU32_REG(BPF_MUL, R1, R2),
1144 			BPF_ALU64_IMM(BPF_RSH, R1, 8),
1145 			BPF_JMP_IMM(BPF_JEQ, R1, 0xffffff, 1),
1146 			BPF_EXIT_INSN(),
1147 			BPF_ALU32_IMM(BPF_MOV, R0, 1),
1148 			BPF_EXIT_INSN(),
1149 		},
1150 		INTERNAL,
1151 		{ },
1152 		{ { 0, 1 } }
1153 	},
1154 	{
1155 		/* Have to test all register combinations, since
1156 		 * JITing of different registers will produce
1157 		 * different asm code.
1158 		 */
1159 		"INT: ADD 64-bit",
1160 		.u.insns_int = {
1161 			BPF_ALU64_IMM(BPF_MOV, R0, 0),
1162 			BPF_ALU64_IMM(BPF_MOV, R1, 1),
1163 			BPF_ALU64_IMM(BPF_MOV, R2, 2),
1164 			BPF_ALU64_IMM(BPF_MOV, R3, 3),
1165 			BPF_ALU64_IMM(BPF_MOV, R4, 4),
1166 			BPF_ALU64_IMM(BPF_MOV, R5, 5),
1167 			BPF_ALU64_IMM(BPF_MOV, R6, 6),
1168 			BPF_ALU64_IMM(BPF_MOV, R7, 7),
1169 			BPF_ALU64_IMM(BPF_MOV, R8, 8),
1170 			BPF_ALU64_IMM(BPF_MOV, R9, 9),
1171 			BPF_ALU64_IMM(BPF_ADD, R0, 20),
1172 			BPF_ALU64_IMM(BPF_ADD, R1, 20),
1173 			BPF_ALU64_IMM(BPF_ADD, R2, 20),
1174 			BPF_ALU64_IMM(BPF_ADD, R3, 20),
1175 			BPF_ALU64_IMM(BPF_ADD, R4, 20),
1176 			BPF_ALU64_IMM(BPF_ADD, R5, 20),
1177 			BPF_ALU64_IMM(BPF_ADD, R6, 20),
1178 			BPF_ALU64_IMM(BPF_ADD, R7, 20),
1179 			BPF_ALU64_IMM(BPF_ADD, R8, 20),
1180 			BPF_ALU64_IMM(BPF_ADD, R9, 20),
1181 			BPF_ALU64_IMM(BPF_SUB, R0, 10),
1182 			BPF_ALU64_IMM(BPF_SUB, R1, 10),
1183 			BPF_ALU64_IMM(BPF_SUB, R2, 10),
1184 			BPF_ALU64_IMM(BPF_SUB, R3, 10),
1185 			BPF_ALU64_IMM(BPF_SUB, R4, 10),
1186 			BPF_ALU64_IMM(BPF_SUB, R5, 10),
1187 			BPF_ALU64_IMM(BPF_SUB, R6, 10),
1188 			BPF_ALU64_IMM(BPF_SUB, R7, 10),
1189 			BPF_ALU64_IMM(BPF_SUB, R8, 10),
1190 			BPF_ALU64_IMM(BPF_SUB, R9, 10),
1191 			BPF_ALU64_REG(BPF_ADD, R0, R0),
1192 			BPF_ALU64_REG(BPF_ADD, R0, R1),
1193 			BPF_ALU64_REG(BPF_ADD, R0, R2),
1194 			BPF_ALU64_REG(BPF_ADD, R0, R3),
1195 			BPF_ALU64_REG(BPF_ADD, R0, R4),
1196 			BPF_ALU64_REG(BPF_ADD, R0, R5),
1197 			BPF_ALU64_REG(BPF_ADD, R0, R6),
1198 			BPF_ALU64_REG(BPF_ADD, R0, R7),
1199 			BPF_ALU64_REG(BPF_ADD, R0, R8),
1200 			BPF_ALU64_REG(BPF_ADD, R0, R9), /* R0 == 155 */
1201 			BPF_JMP_IMM(BPF_JEQ, R0, 155, 1),
1202 			BPF_EXIT_INSN(),
1203 			BPF_ALU64_REG(BPF_ADD, R1, R0),
1204 			BPF_ALU64_REG(BPF_ADD, R1, R1),
1205 			BPF_ALU64_REG(BPF_ADD, R1, R2),
1206 			BPF_ALU64_REG(BPF_ADD, R1, R3),
1207 			BPF_ALU64_REG(BPF_ADD, R1, R4),
1208 			BPF_ALU64_REG(BPF_ADD, R1, R5),
1209 			BPF_ALU64_REG(BPF_ADD, R1, R6),
1210 			BPF_ALU64_REG(BPF_ADD, R1, R7),
1211 			BPF_ALU64_REG(BPF_ADD, R1, R8),
1212 			BPF_ALU64_REG(BPF_ADD, R1, R9), /* R1 == 456 */
1213 			BPF_JMP_IMM(BPF_JEQ, R1, 456, 1),
1214 			BPF_EXIT_INSN(),
1215 			BPF_ALU64_REG(BPF_ADD, R2, R0),
1216 			BPF_ALU64_REG(BPF_ADD, R2, R1),
1217 			BPF_ALU64_REG(BPF_ADD, R2, R2),
1218 			BPF_ALU64_REG(BPF_ADD, R2, R3),
1219 			BPF_ALU64_REG(BPF_ADD, R2, R4),
1220 			BPF_ALU64_REG(BPF_ADD, R2, R5),
1221 			BPF_ALU64_REG(BPF_ADD, R2, R6),
1222 			BPF_ALU64_REG(BPF_ADD, R2, R7),
1223 			BPF_ALU64_REG(BPF_ADD, R2, R8),
1224 			BPF_ALU64_REG(BPF_ADD, R2, R9), /* R2 == 1358 */
1225 			BPF_JMP_IMM(BPF_JEQ, R2, 1358, 1),
1226 			BPF_EXIT_INSN(),
1227 			BPF_ALU64_REG(BPF_ADD, R3, R0),
1228 			BPF_ALU64_REG(BPF_ADD, R3, R1),
1229 			BPF_ALU64_REG(BPF_ADD, R3, R2),
1230 			BPF_ALU64_REG(BPF_ADD, R3, R3),
1231 			BPF_ALU64_REG(BPF_ADD, R3, R4),
1232 			BPF_ALU64_REG(BPF_ADD, R3, R5),
1233 			BPF_ALU64_REG(BPF_ADD, R3, R6),
1234 			BPF_ALU64_REG(BPF_ADD, R3, R7),
1235 			BPF_ALU64_REG(BPF_ADD, R3, R8),
1236 			BPF_ALU64_REG(BPF_ADD, R3, R9), /* R3 == 4063 */
1237 			BPF_JMP_IMM(BPF_JEQ, R3, 4063, 1),
1238 			BPF_EXIT_INSN(),
1239 			BPF_ALU64_REG(BPF_ADD, R4, R0),
1240 			BPF_ALU64_REG(BPF_ADD, R4, R1),
1241 			BPF_ALU64_REG(BPF_ADD, R4, R2),
1242 			BPF_ALU64_REG(BPF_ADD, R4, R3),
1243 			BPF_ALU64_REG(BPF_ADD, R4, R4),
1244 			BPF_ALU64_REG(BPF_ADD, R4, R5),
1245 			BPF_ALU64_REG(BPF_ADD, R4, R6),
1246 			BPF_ALU64_REG(BPF_ADD, R4, R7),
1247 			BPF_ALU64_REG(BPF_ADD, R4, R8),
1248 			BPF_ALU64_REG(BPF_ADD, R4, R9), /* R4 == 12177 */
1249 			BPF_JMP_IMM(BPF_JEQ, R4, 12177, 1),
1250 			BPF_EXIT_INSN(),
1251 			BPF_ALU64_REG(BPF_ADD, R5, R0),
1252 			BPF_ALU64_REG(BPF_ADD, R5, R1),
1253 			BPF_ALU64_REG(BPF_ADD, R5, R2),
1254 			BPF_ALU64_REG(BPF_ADD, R5, R3),
1255 			BPF_ALU64_REG(BPF_ADD, R5, R4),
1256 			BPF_ALU64_REG(BPF_ADD, R5, R5),
1257 			BPF_ALU64_REG(BPF_ADD, R5, R6),
1258 			BPF_ALU64_REG(BPF_ADD, R5, R7),
1259 			BPF_ALU64_REG(BPF_ADD, R5, R8),
1260 			BPF_ALU64_REG(BPF_ADD, R5, R9), /* R5 == 36518 */
1261 			BPF_JMP_IMM(BPF_JEQ, R5, 36518, 1),
1262 			BPF_EXIT_INSN(),
1263 			BPF_ALU64_REG(BPF_ADD, R6, R0),
1264 			BPF_ALU64_REG(BPF_ADD, R6, R1),
1265 			BPF_ALU64_REG(BPF_ADD, R6, R2),
1266 			BPF_ALU64_REG(BPF_ADD, R6, R3),
1267 			BPF_ALU64_REG(BPF_ADD, R6, R4),
1268 			BPF_ALU64_REG(BPF_ADD, R6, R5),
1269 			BPF_ALU64_REG(BPF_ADD, R6, R6),
1270 			BPF_ALU64_REG(BPF_ADD, R6, R7),
1271 			BPF_ALU64_REG(BPF_ADD, R6, R8),
1272 			BPF_ALU64_REG(BPF_ADD, R6, R9), /* R6 == 109540 */
1273 			BPF_JMP_IMM(BPF_JEQ, R6, 109540, 1),
1274 			BPF_EXIT_INSN(),
1275 			BPF_ALU64_REG(BPF_ADD, R7, R0),
1276 			BPF_ALU64_REG(BPF_ADD, R7, R1),
1277 			BPF_ALU64_REG(BPF_ADD, R7, R2),
1278 			BPF_ALU64_REG(BPF_ADD, R7, R3),
1279 			BPF_ALU64_REG(BPF_ADD, R7, R4),
1280 			BPF_ALU64_REG(BPF_ADD, R7, R5),
1281 			BPF_ALU64_REG(BPF_ADD, R7, R6),
1282 			BPF_ALU64_REG(BPF_ADD, R7, R7),
1283 			BPF_ALU64_REG(BPF_ADD, R7, R8),
1284 			BPF_ALU64_REG(BPF_ADD, R7, R9), /* R7 == 328605 */
1285 			BPF_JMP_IMM(BPF_JEQ, R7, 328605, 1),
1286 			BPF_EXIT_INSN(),
1287 			BPF_ALU64_REG(BPF_ADD, R8, R0),
1288 			BPF_ALU64_REG(BPF_ADD, R8, R1),
1289 			BPF_ALU64_REG(BPF_ADD, R8, R2),
1290 			BPF_ALU64_REG(BPF_ADD, R8, R3),
1291 			BPF_ALU64_REG(BPF_ADD, R8, R4),
1292 			BPF_ALU64_REG(BPF_ADD, R8, R5),
1293 			BPF_ALU64_REG(BPF_ADD, R8, R6),
1294 			BPF_ALU64_REG(BPF_ADD, R8, R7),
1295 			BPF_ALU64_REG(BPF_ADD, R8, R8),
1296 			BPF_ALU64_REG(BPF_ADD, R8, R9), /* R8 == 985799 */
1297 			BPF_JMP_IMM(BPF_JEQ, R8, 985799, 1),
1298 			BPF_EXIT_INSN(),
1299 			BPF_ALU64_REG(BPF_ADD, R9, R0),
1300 			BPF_ALU64_REG(BPF_ADD, R9, R1),
1301 			BPF_ALU64_REG(BPF_ADD, R9, R2),
1302 			BPF_ALU64_REG(BPF_ADD, R9, R3),
1303 			BPF_ALU64_REG(BPF_ADD, R9, R4),
1304 			BPF_ALU64_REG(BPF_ADD, R9, R5),
1305 			BPF_ALU64_REG(BPF_ADD, R9, R6),
1306 			BPF_ALU64_REG(BPF_ADD, R9, R7),
1307 			BPF_ALU64_REG(BPF_ADD, R9, R8),
1308 			BPF_ALU64_REG(BPF_ADD, R9, R9), /* R9 == 2957380 */
1309 			BPF_ALU64_REG(BPF_MOV, R0, R9),
1310 			BPF_EXIT_INSN(),
1311 		},
1312 		INTERNAL,
1313 		{ },
1314 		{ { 0, 2957380 } }
1315 	},
1316 	{
1317 		"INT: ADD 32-bit",
1318 		.u.insns_int = {
1319 			BPF_ALU32_IMM(BPF_MOV, R0, 20),
1320 			BPF_ALU32_IMM(BPF_MOV, R1, 1),
1321 			BPF_ALU32_IMM(BPF_MOV, R2, 2),
1322 			BPF_ALU32_IMM(BPF_MOV, R3, 3),
1323 			BPF_ALU32_IMM(BPF_MOV, R4, 4),
1324 			BPF_ALU32_IMM(BPF_MOV, R5, 5),
1325 			BPF_ALU32_IMM(BPF_MOV, R6, 6),
1326 			BPF_ALU32_IMM(BPF_MOV, R7, 7),
1327 			BPF_ALU32_IMM(BPF_MOV, R8, 8),
1328 			BPF_ALU32_IMM(BPF_MOV, R9, 9),
1329 			BPF_ALU64_IMM(BPF_ADD, R1, 10),
1330 			BPF_ALU64_IMM(BPF_ADD, R2, 10),
1331 			BPF_ALU64_IMM(BPF_ADD, R3, 10),
1332 			BPF_ALU64_IMM(BPF_ADD, R4, 10),
1333 			BPF_ALU64_IMM(BPF_ADD, R5, 10),
1334 			BPF_ALU64_IMM(BPF_ADD, R6, 10),
1335 			BPF_ALU64_IMM(BPF_ADD, R7, 10),
1336 			BPF_ALU64_IMM(BPF_ADD, R8, 10),
1337 			BPF_ALU64_IMM(BPF_ADD, R9, 10),
1338 			BPF_ALU32_REG(BPF_ADD, R0, R1),
1339 			BPF_ALU32_REG(BPF_ADD, R0, R2),
1340 			BPF_ALU32_REG(BPF_ADD, R0, R3),
1341 			BPF_ALU32_REG(BPF_ADD, R0, R4),
1342 			BPF_ALU32_REG(BPF_ADD, R0, R5),
1343 			BPF_ALU32_REG(BPF_ADD, R0, R6),
1344 			BPF_ALU32_REG(BPF_ADD, R0, R7),
1345 			BPF_ALU32_REG(BPF_ADD, R0, R8),
1346 			BPF_ALU32_REG(BPF_ADD, R0, R9), /* R0 == 155 */
1347 			BPF_JMP_IMM(BPF_JEQ, R0, 155, 1),
1348 			BPF_EXIT_INSN(),
1349 			BPF_ALU32_REG(BPF_ADD, R1, R0),
1350 			BPF_ALU32_REG(BPF_ADD, R1, R1),
1351 			BPF_ALU32_REG(BPF_ADD, R1, R2),
1352 			BPF_ALU32_REG(BPF_ADD, R1, R3),
1353 			BPF_ALU32_REG(BPF_ADD, R1, R4),
1354 			BPF_ALU32_REG(BPF_ADD, R1, R5),
1355 			BPF_ALU32_REG(BPF_ADD, R1, R6),
1356 			BPF_ALU32_REG(BPF_ADD, R1, R7),
1357 			BPF_ALU32_REG(BPF_ADD, R1, R8),
1358 			BPF_ALU32_REG(BPF_ADD, R1, R9), /* R1 == 456 */
1359 			BPF_JMP_IMM(BPF_JEQ, R1, 456, 1),
1360 			BPF_EXIT_INSN(),
1361 			BPF_ALU32_REG(BPF_ADD, R2, R0),
1362 			BPF_ALU32_REG(BPF_ADD, R2, R1),
1363 			BPF_ALU32_REG(BPF_ADD, R2, R2),
1364 			BPF_ALU32_REG(BPF_ADD, R2, R3),
1365 			BPF_ALU32_REG(BPF_ADD, R2, R4),
1366 			BPF_ALU32_REG(BPF_ADD, R2, R5),
1367 			BPF_ALU32_REG(BPF_ADD, R2, R6),
1368 			BPF_ALU32_REG(BPF_ADD, R2, R7),
1369 			BPF_ALU32_REG(BPF_ADD, R2, R8),
1370 			BPF_ALU32_REG(BPF_ADD, R2, R9), /* R2 == 1358 */
1371 			BPF_JMP_IMM(BPF_JEQ, R2, 1358, 1),
1372 			BPF_EXIT_INSN(),
1373 			BPF_ALU32_REG(BPF_ADD, R3, R0),
1374 			BPF_ALU32_REG(BPF_ADD, R3, R1),
1375 			BPF_ALU32_REG(BPF_ADD, R3, R2),
1376 			BPF_ALU32_REG(BPF_ADD, R3, R3),
1377 			BPF_ALU32_REG(BPF_ADD, R3, R4),
1378 			BPF_ALU32_REG(BPF_ADD, R3, R5),
1379 			BPF_ALU32_REG(BPF_ADD, R3, R6),
1380 			BPF_ALU32_REG(BPF_ADD, R3, R7),
1381 			BPF_ALU32_REG(BPF_ADD, R3, R8),
1382 			BPF_ALU32_REG(BPF_ADD, R3, R9), /* R3 == 4063 */
1383 			BPF_JMP_IMM(BPF_JEQ, R3, 4063, 1),
1384 			BPF_EXIT_INSN(),
1385 			BPF_ALU32_REG(BPF_ADD, R4, R0),
1386 			BPF_ALU32_REG(BPF_ADD, R4, R1),
1387 			BPF_ALU32_REG(BPF_ADD, R4, R2),
1388 			BPF_ALU32_REG(BPF_ADD, R4, R3),
1389 			BPF_ALU32_REG(BPF_ADD, R4, R4),
1390 			BPF_ALU32_REG(BPF_ADD, R4, R5),
1391 			BPF_ALU32_REG(BPF_ADD, R4, R6),
1392 			BPF_ALU32_REG(BPF_ADD, R4, R7),
1393 			BPF_ALU32_REG(BPF_ADD, R4, R8),
1394 			BPF_ALU32_REG(BPF_ADD, R4, R9), /* R4 == 12177 */
1395 			BPF_JMP_IMM(BPF_JEQ, R4, 12177, 1),
1396 			BPF_EXIT_INSN(),
1397 			BPF_ALU32_REG(BPF_ADD, R5, R0),
1398 			BPF_ALU32_REG(BPF_ADD, R5, R1),
1399 			BPF_ALU32_REG(BPF_ADD, R5, R2),
1400 			BPF_ALU32_REG(BPF_ADD, R5, R3),
1401 			BPF_ALU32_REG(BPF_ADD, R5, R4),
1402 			BPF_ALU32_REG(BPF_ADD, R5, R5),
1403 			BPF_ALU32_REG(BPF_ADD, R5, R6),
1404 			BPF_ALU32_REG(BPF_ADD, R5, R7),
1405 			BPF_ALU32_REG(BPF_ADD, R5, R8),
1406 			BPF_ALU32_REG(BPF_ADD, R5, R9), /* R5 == 36518 */
1407 			BPF_JMP_IMM(BPF_JEQ, R5, 36518, 1),
1408 			BPF_EXIT_INSN(),
1409 			BPF_ALU32_REG(BPF_ADD, R6, R0),
1410 			BPF_ALU32_REG(BPF_ADD, R6, R1),
1411 			BPF_ALU32_REG(BPF_ADD, R6, R2),
1412 			BPF_ALU32_REG(BPF_ADD, R6, R3),
1413 			BPF_ALU32_REG(BPF_ADD, R6, R4),
1414 			BPF_ALU32_REG(BPF_ADD, R6, R5),
1415 			BPF_ALU32_REG(BPF_ADD, R6, R6),
1416 			BPF_ALU32_REG(BPF_ADD, R6, R7),
1417 			BPF_ALU32_REG(BPF_ADD, R6, R8),
1418 			BPF_ALU32_REG(BPF_ADD, R6, R9), /* R6 == 109540 */
1419 			BPF_JMP_IMM(BPF_JEQ, R6, 109540, 1),
1420 			BPF_EXIT_INSN(),
1421 			BPF_ALU32_REG(BPF_ADD, R7, R0),
1422 			BPF_ALU32_REG(BPF_ADD, R7, R1),
1423 			BPF_ALU32_REG(BPF_ADD, R7, R2),
1424 			BPF_ALU32_REG(BPF_ADD, R7, R3),
1425 			BPF_ALU32_REG(BPF_ADD, R7, R4),
1426 			BPF_ALU32_REG(BPF_ADD, R7, R5),
1427 			BPF_ALU32_REG(BPF_ADD, R7, R6),
1428 			BPF_ALU32_REG(BPF_ADD, R7, R7),
1429 			BPF_ALU32_REG(BPF_ADD, R7, R8),
1430 			BPF_ALU32_REG(BPF_ADD, R7, R9), /* R7 == 328605 */
1431 			BPF_JMP_IMM(BPF_JEQ, R7, 328605, 1),
1432 			BPF_EXIT_INSN(),
1433 			BPF_ALU32_REG(BPF_ADD, R8, R0),
1434 			BPF_ALU32_REG(BPF_ADD, R8, R1),
1435 			BPF_ALU32_REG(BPF_ADD, R8, R2),
1436 			BPF_ALU32_REG(BPF_ADD, R8, R3),
1437 			BPF_ALU32_REG(BPF_ADD, R8, R4),
1438 			BPF_ALU32_REG(BPF_ADD, R8, R5),
1439 			BPF_ALU32_REG(BPF_ADD, R8, R6),
1440 			BPF_ALU32_REG(BPF_ADD, R8, R7),
1441 			BPF_ALU32_REG(BPF_ADD, R8, R8),
1442 			BPF_ALU32_REG(BPF_ADD, R8, R9), /* R8 == 985799 */
1443 			BPF_JMP_IMM(BPF_JEQ, R8, 985799, 1),
1444 			BPF_EXIT_INSN(),
1445 			BPF_ALU32_REG(BPF_ADD, R9, R0),
1446 			BPF_ALU32_REG(BPF_ADD, R9, R1),
1447 			BPF_ALU32_REG(BPF_ADD, R9, R2),
1448 			BPF_ALU32_REG(BPF_ADD, R9, R3),
1449 			BPF_ALU32_REG(BPF_ADD, R9, R4),
1450 			BPF_ALU32_REG(BPF_ADD, R9, R5),
1451 			BPF_ALU32_REG(BPF_ADD, R9, R6),
1452 			BPF_ALU32_REG(BPF_ADD, R9, R7),
1453 			BPF_ALU32_REG(BPF_ADD, R9, R8),
1454 			BPF_ALU32_REG(BPF_ADD, R9, R9), /* R9 == 2957380 */
1455 			BPF_ALU32_REG(BPF_MOV, R0, R9),
1456 			BPF_EXIT_INSN(),
1457 		},
1458 		INTERNAL,
1459 		{ },
1460 		{ { 0, 2957380 } }
1461 	},
1462 	{	/* Mainly checking JIT here. */
1463 		"INT: SUB",
1464 		.u.insns_int = {
1465 			BPF_ALU64_IMM(BPF_MOV, R0, 0),
1466 			BPF_ALU64_IMM(BPF_MOV, R1, 1),
1467 			BPF_ALU64_IMM(BPF_MOV, R2, 2),
1468 			BPF_ALU64_IMM(BPF_MOV, R3, 3),
1469 			BPF_ALU64_IMM(BPF_MOV, R4, 4),
1470 			BPF_ALU64_IMM(BPF_MOV, R5, 5),
1471 			BPF_ALU64_IMM(BPF_MOV, R6, 6),
1472 			BPF_ALU64_IMM(BPF_MOV, R7, 7),
1473 			BPF_ALU64_IMM(BPF_MOV, R8, 8),
1474 			BPF_ALU64_IMM(BPF_MOV, R9, 9),
1475 			BPF_ALU64_REG(BPF_SUB, R0, R0),
1476 			BPF_ALU64_REG(BPF_SUB, R0, R1),
1477 			BPF_ALU64_REG(BPF_SUB, R0, R2),
1478 			BPF_ALU64_REG(BPF_SUB, R0, R3),
1479 			BPF_ALU64_REG(BPF_SUB, R0, R4),
1480 			BPF_ALU64_REG(BPF_SUB, R0, R5),
1481 			BPF_ALU64_REG(BPF_SUB, R0, R6),
1482 			BPF_ALU64_REG(BPF_SUB, R0, R7),
1483 			BPF_ALU64_REG(BPF_SUB, R0, R8),
1484 			BPF_ALU64_REG(BPF_SUB, R0, R9),
1485 			BPF_ALU64_IMM(BPF_SUB, R0, 10),
1486 			BPF_JMP_IMM(BPF_JEQ, R0, -55, 1),
1487 			BPF_EXIT_INSN(),
1488 			BPF_ALU64_REG(BPF_SUB, R1, R0),
1489 			BPF_ALU64_REG(BPF_SUB, R1, R2),
1490 			BPF_ALU64_REG(BPF_SUB, R1, R3),
1491 			BPF_ALU64_REG(BPF_SUB, R1, R4),
1492 			BPF_ALU64_REG(BPF_SUB, R1, R5),
1493 			BPF_ALU64_REG(BPF_SUB, R1, R6),
1494 			BPF_ALU64_REG(BPF_SUB, R1, R7),
1495 			BPF_ALU64_REG(BPF_SUB, R1, R8),
1496 			BPF_ALU64_REG(BPF_SUB, R1, R9),
1497 			BPF_ALU64_IMM(BPF_SUB, R1, 10),
1498 			BPF_ALU64_REG(BPF_SUB, R2, R0),
1499 			BPF_ALU64_REG(BPF_SUB, R2, R1),
1500 			BPF_ALU64_REG(BPF_SUB, R2, R3),
1501 			BPF_ALU64_REG(BPF_SUB, R2, R4),
1502 			BPF_ALU64_REG(BPF_SUB, R2, R5),
1503 			BPF_ALU64_REG(BPF_SUB, R2, R6),
1504 			BPF_ALU64_REG(BPF_SUB, R2, R7),
1505 			BPF_ALU64_REG(BPF_SUB, R2, R8),
1506 			BPF_ALU64_REG(BPF_SUB, R2, R9),
1507 			BPF_ALU64_IMM(BPF_SUB, R2, 10),
1508 			BPF_ALU64_REG(BPF_SUB, R3, R0),
1509 			BPF_ALU64_REG(BPF_SUB, R3, R1),
1510 			BPF_ALU64_REG(BPF_SUB, R3, R2),
1511 			BPF_ALU64_REG(BPF_SUB, R3, R4),
1512 			BPF_ALU64_REG(BPF_SUB, R3, R5),
1513 			BPF_ALU64_REG(BPF_SUB, R3, R6),
1514 			BPF_ALU64_REG(BPF_SUB, R3, R7),
1515 			BPF_ALU64_REG(BPF_SUB, R3, R8),
1516 			BPF_ALU64_REG(BPF_SUB, R3, R9),
1517 			BPF_ALU64_IMM(BPF_SUB, R3, 10),
1518 			BPF_ALU64_REG(BPF_SUB, R4, R0),
1519 			BPF_ALU64_REG(BPF_SUB, R4, R1),
1520 			BPF_ALU64_REG(BPF_SUB, R4, R2),
1521 			BPF_ALU64_REG(BPF_SUB, R4, R3),
1522 			BPF_ALU64_REG(BPF_SUB, R4, R5),
1523 			BPF_ALU64_REG(BPF_SUB, R4, R6),
1524 			BPF_ALU64_REG(BPF_SUB, R4, R7),
1525 			BPF_ALU64_REG(BPF_SUB, R4, R8),
1526 			BPF_ALU64_REG(BPF_SUB, R4, R9),
1527 			BPF_ALU64_IMM(BPF_SUB, R4, 10),
1528 			BPF_ALU64_REG(BPF_SUB, R5, R0),
1529 			BPF_ALU64_REG(BPF_SUB, R5, R1),
1530 			BPF_ALU64_REG(BPF_SUB, R5, R2),
1531 			BPF_ALU64_REG(BPF_SUB, R5, R3),
1532 			BPF_ALU64_REG(BPF_SUB, R5, R4),
1533 			BPF_ALU64_REG(BPF_SUB, R5, R6),
1534 			BPF_ALU64_REG(BPF_SUB, R5, R7),
1535 			BPF_ALU64_REG(BPF_SUB, R5, R8),
1536 			BPF_ALU64_REG(BPF_SUB, R5, R9),
1537 			BPF_ALU64_IMM(BPF_SUB, R5, 10),
1538 			BPF_ALU64_REG(BPF_SUB, R6, R0),
1539 			BPF_ALU64_REG(BPF_SUB, R6, R1),
1540 			BPF_ALU64_REG(BPF_SUB, R6, R2),
1541 			BPF_ALU64_REG(BPF_SUB, R6, R3),
1542 			BPF_ALU64_REG(BPF_SUB, R6, R4),
1543 			BPF_ALU64_REG(BPF_SUB, R6, R5),
1544 			BPF_ALU64_REG(BPF_SUB, R6, R7),
1545 			BPF_ALU64_REG(BPF_SUB, R6, R8),
1546 			BPF_ALU64_REG(BPF_SUB, R6, R9),
1547 			BPF_ALU64_IMM(BPF_SUB, R6, 10),
1548 			BPF_ALU64_REG(BPF_SUB, R7, R0),
1549 			BPF_ALU64_REG(BPF_SUB, R7, R1),
1550 			BPF_ALU64_REG(BPF_SUB, R7, R2),
1551 			BPF_ALU64_REG(BPF_SUB, R7, R3),
1552 			BPF_ALU64_REG(BPF_SUB, R7, R4),
1553 			BPF_ALU64_REG(BPF_SUB, R7, R5),
1554 			BPF_ALU64_REG(BPF_SUB, R7, R6),
1555 			BPF_ALU64_REG(BPF_SUB, R7, R8),
1556 			BPF_ALU64_REG(BPF_SUB, R7, R9),
1557 			BPF_ALU64_IMM(BPF_SUB, R7, 10),
1558 			BPF_ALU64_REG(BPF_SUB, R8, R0),
1559 			BPF_ALU64_REG(BPF_SUB, R8, R1),
1560 			BPF_ALU64_REG(BPF_SUB, R8, R2),
1561 			BPF_ALU64_REG(BPF_SUB, R8, R3),
1562 			BPF_ALU64_REG(BPF_SUB, R8, R4),
1563 			BPF_ALU64_REG(BPF_SUB, R8, R5),
1564 			BPF_ALU64_REG(BPF_SUB, R8, R6),
1565 			BPF_ALU64_REG(BPF_SUB, R8, R7),
1566 			BPF_ALU64_REG(BPF_SUB, R8, R9),
1567 			BPF_ALU64_IMM(BPF_SUB, R8, 10),
1568 			BPF_ALU64_REG(BPF_SUB, R9, R0),
1569 			BPF_ALU64_REG(BPF_SUB, R9, R1),
1570 			BPF_ALU64_REG(BPF_SUB, R9, R2),
1571 			BPF_ALU64_REG(BPF_SUB, R9, R3),
1572 			BPF_ALU64_REG(BPF_SUB, R9, R4),
1573 			BPF_ALU64_REG(BPF_SUB, R9, R5),
1574 			BPF_ALU64_REG(BPF_SUB, R9, R6),
1575 			BPF_ALU64_REG(BPF_SUB, R9, R7),
1576 			BPF_ALU64_REG(BPF_SUB, R9, R8),
1577 			BPF_ALU64_IMM(BPF_SUB, R9, 10),
1578 			BPF_ALU64_IMM(BPF_SUB, R0, 10),
1579 			BPF_ALU64_IMM(BPF_NEG, R0, 0),
1580 			BPF_ALU64_REG(BPF_SUB, R0, R1),
1581 			BPF_ALU64_REG(BPF_SUB, R0, R2),
1582 			BPF_ALU64_REG(BPF_SUB, R0, R3),
1583 			BPF_ALU64_REG(BPF_SUB, R0, R4),
1584 			BPF_ALU64_REG(BPF_SUB, R0, R5),
1585 			BPF_ALU64_REG(BPF_SUB, R0, R6),
1586 			BPF_ALU64_REG(BPF_SUB, R0, R7),
1587 			BPF_ALU64_REG(BPF_SUB, R0, R8),
1588 			BPF_ALU64_REG(BPF_SUB, R0, R9),
1589 			BPF_EXIT_INSN(),
1590 		},
1591 		INTERNAL,
1592 		{ },
1593 		{ { 0, 11 } }
1594 	},
1595 	{	/* Mainly checking JIT here. */
1596 		"INT: XOR",
1597 		.u.insns_int = {
1598 			BPF_ALU64_REG(BPF_SUB, R0, R0),
1599 			BPF_ALU64_REG(BPF_XOR, R1, R1),
1600 			BPF_JMP_REG(BPF_JEQ, R0, R1, 1),
1601 			BPF_EXIT_INSN(),
1602 			BPF_ALU64_IMM(BPF_MOV, R0, 10),
1603 			BPF_ALU64_IMM(BPF_MOV, R1, -1),
1604 			BPF_ALU64_REG(BPF_SUB, R1, R1),
1605 			BPF_ALU64_REG(BPF_XOR, R2, R2),
1606 			BPF_JMP_REG(BPF_JEQ, R1, R2, 1),
1607 			BPF_EXIT_INSN(),
1608 			BPF_ALU64_REG(BPF_SUB, R2, R2),
1609 			BPF_ALU64_REG(BPF_XOR, R3, R3),
1610 			BPF_ALU64_IMM(BPF_MOV, R0, 10),
1611 			BPF_ALU64_IMM(BPF_MOV, R1, -1),
1612 			BPF_JMP_REG(BPF_JEQ, R2, R3, 1),
1613 			BPF_EXIT_INSN(),
1614 			BPF_ALU64_REG(BPF_SUB, R3, R3),
1615 			BPF_ALU64_REG(BPF_XOR, R4, R4),
1616 			BPF_ALU64_IMM(BPF_MOV, R2, 1),
1617 			BPF_ALU64_IMM(BPF_MOV, R5, -1),
1618 			BPF_JMP_REG(BPF_JEQ, R3, R4, 1),
1619 			BPF_EXIT_INSN(),
1620 			BPF_ALU64_REG(BPF_SUB, R4, R4),
1621 			BPF_ALU64_REG(BPF_XOR, R5, R5),
1622 			BPF_ALU64_IMM(BPF_MOV, R3, 1),
1623 			BPF_ALU64_IMM(BPF_MOV, R7, -1),
1624 			BPF_JMP_REG(BPF_JEQ, R5, R4, 1),
1625 			BPF_EXIT_INSN(),
1626 			BPF_ALU64_IMM(BPF_MOV, R5, 1),
1627 			BPF_ALU64_REG(BPF_SUB, R5, R5),
1628 			BPF_ALU64_REG(BPF_XOR, R6, R6),
1629 			BPF_ALU64_IMM(BPF_MOV, R1, 1),
1630 			BPF_ALU64_IMM(BPF_MOV, R8, -1),
1631 			BPF_JMP_REG(BPF_JEQ, R5, R6, 1),
1632 			BPF_EXIT_INSN(),
1633 			BPF_ALU64_REG(BPF_SUB, R6, R6),
1634 			BPF_ALU64_REG(BPF_XOR, R7, R7),
1635 			BPF_JMP_REG(BPF_JEQ, R7, R6, 1),
1636 			BPF_EXIT_INSN(),
1637 			BPF_ALU64_REG(BPF_SUB, R7, R7),
1638 			BPF_ALU64_REG(BPF_XOR, R8, R8),
1639 			BPF_JMP_REG(BPF_JEQ, R7, R8, 1),
1640 			BPF_EXIT_INSN(),
1641 			BPF_ALU64_REG(BPF_SUB, R8, R8),
1642 			BPF_ALU64_REG(BPF_XOR, R9, R9),
1643 			BPF_JMP_REG(BPF_JEQ, R9, R8, 1),
1644 			BPF_EXIT_INSN(),
1645 			BPF_ALU64_REG(BPF_SUB, R9, R9),
1646 			BPF_ALU64_REG(BPF_XOR, R0, R0),
1647 			BPF_JMP_REG(BPF_JEQ, R9, R0, 1),
1648 			BPF_EXIT_INSN(),
1649 			BPF_ALU64_REG(BPF_SUB, R1, R1),
1650 			BPF_ALU64_REG(BPF_XOR, R0, R0),
1651 			BPF_JMP_REG(BPF_JEQ, R9, R0, 2),
1652 			BPF_ALU64_IMM(BPF_MOV, R0, 0),
1653 			BPF_EXIT_INSN(),
1654 			BPF_ALU64_IMM(BPF_MOV, R0, 1),
1655 			BPF_EXIT_INSN(),
1656 		},
1657 		INTERNAL,
1658 		{ },
1659 		{ { 0, 1 } }
1660 	},
1661 	{	/* Mainly checking JIT here. */
1662 		"INT: MUL",
1663 		.u.insns_int = {
1664 			BPF_ALU64_IMM(BPF_MOV, R0, 11),
1665 			BPF_ALU64_IMM(BPF_MOV, R1, 1),
1666 			BPF_ALU64_IMM(BPF_MOV, R2, 2),
1667 			BPF_ALU64_IMM(BPF_MOV, R3, 3),
1668 			BPF_ALU64_IMM(BPF_MOV, R4, 4),
1669 			BPF_ALU64_IMM(BPF_MOV, R5, 5),
1670 			BPF_ALU64_IMM(BPF_MOV, R6, 6),
1671 			BPF_ALU64_IMM(BPF_MOV, R7, 7),
1672 			BPF_ALU64_IMM(BPF_MOV, R8, 8),
1673 			BPF_ALU64_IMM(BPF_MOV, R9, 9),
1674 			BPF_ALU64_REG(BPF_MUL, R0, R0),
1675 			BPF_ALU64_REG(BPF_MUL, R0, R1),
1676 			BPF_ALU64_REG(BPF_MUL, R0, R2),
1677 			BPF_ALU64_REG(BPF_MUL, R0, R3),
1678 			BPF_ALU64_REG(BPF_MUL, R0, R4),
1679 			BPF_ALU64_REG(BPF_MUL, R0, R5),
1680 			BPF_ALU64_REG(BPF_MUL, R0, R6),
1681 			BPF_ALU64_REG(BPF_MUL, R0, R7),
1682 			BPF_ALU64_REG(BPF_MUL, R0, R8),
1683 			BPF_ALU64_REG(BPF_MUL, R0, R9),
1684 			BPF_ALU64_IMM(BPF_MUL, R0, 10),
1685 			BPF_JMP_IMM(BPF_JEQ, R0, 439084800, 1),
1686 			BPF_EXIT_INSN(),
1687 			BPF_ALU64_REG(BPF_MUL, R1, R0),
1688 			BPF_ALU64_REG(BPF_MUL, R1, R2),
1689 			BPF_ALU64_REG(BPF_MUL, R1, R3),
1690 			BPF_ALU64_REG(BPF_MUL, R1, R4),
1691 			BPF_ALU64_REG(BPF_MUL, R1, R5),
1692 			BPF_ALU64_REG(BPF_MUL, R1, R6),
1693 			BPF_ALU64_REG(BPF_MUL, R1, R7),
1694 			BPF_ALU64_REG(BPF_MUL, R1, R8),
1695 			BPF_ALU64_REG(BPF_MUL, R1, R9),
1696 			BPF_ALU64_IMM(BPF_MUL, R1, 10),
1697 			BPF_ALU64_REG(BPF_MOV, R2, R1),
1698 			BPF_ALU64_IMM(BPF_RSH, R2, 32),
1699 			BPF_JMP_IMM(BPF_JEQ, R2, 0x5a924, 1),
1700 			BPF_EXIT_INSN(),
1701 			BPF_ALU64_IMM(BPF_LSH, R1, 32),
1702 			BPF_ALU64_IMM(BPF_ARSH, R1, 32),
1703 			BPF_JMP_IMM(BPF_JEQ, R1, 0xebb90000, 1),
1704 			BPF_EXIT_INSN(),
1705 			BPF_ALU64_REG(BPF_MUL, R2, R0),
1706 			BPF_ALU64_REG(BPF_MUL, R2, R1),
1707 			BPF_ALU64_REG(BPF_MUL, R2, R3),
1708 			BPF_ALU64_REG(BPF_MUL, R2, R4),
1709 			BPF_ALU64_REG(BPF_MUL, R2, R5),
1710 			BPF_ALU64_REG(BPF_MUL, R2, R6),
1711 			BPF_ALU64_REG(BPF_MUL, R2, R7),
1712 			BPF_ALU64_REG(BPF_MUL, R2, R8),
1713 			BPF_ALU64_REG(BPF_MUL, R2, R9),
1714 			BPF_ALU64_IMM(BPF_MUL, R2, 10),
1715 			BPF_ALU64_IMM(BPF_RSH, R2, 32),
1716 			BPF_ALU64_REG(BPF_MOV, R0, R2),
1717 			BPF_EXIT_INSN(),
1718 		},
1719 		INTERNAL,
1720 		{ },
1721 		{ { 0, 0x35d97ef2 } }
1722 	},
1723 	{	/* Mainly checking JIT here. */
1724 		"MOV REG64",
1725 		.u.insns_int = {
1726 			BPF_LD_IMM64(R0, 0xffffffffffffffffLL),
1727 			BPF_MOV64_REG(R1, R0),
1728 			BPF_MOV64_REG(R2, R1),
1729 			BPF_MOV64_REG(R3, R2),
1730 			BPF_MOV64_REG(R4, R3),
1731 			BPF_MOV64_REG(R5, R4),
1732 			BPF_MOV64_REG(R6, R5),
1733 			BPF_MOV64_REG(R7, R6),
1734 			BPF_MOV64_REG(R8, R7),
1735 			BPF_MOV64_REG(R9, R8),
1736 			BPF_ALU64_IMM(BPF_MOV, R0, 0),
1737 			BPF_ALU64_IMM(BPF_MOV, R1, 0),
1738 			BPF_ALU64_IMM(BPF_MOV, R2, 0),
1739 			BPF_ALU64_IMM(BPF_MOV, R3, 0),
1740 			BPF_ALU64_IMM(BPF_MOV, R4, 0),
1741 			BPF_ALU64_IMM(BPF_MOV, R5, 0),
1742 			BPF_ALU64_IMM(BPF_MOV, R6, 0),
1743 			BPF_ALU64_IMM(BPF_MOV, R7, 0),
1744 			BPF_ALU64_IMM(BPF_MOV, R8, 0),
1745 			BPF_ALU64_IMM(BPF_MOV, R9, 0),
1746 			BPF_ALU64_REG(BPF_ADD, R0, R0),
1747 			BPF_ALU64_REG(BPF_ADD, R0, R1),
1748 			BPF_ALU64_REG(BPF_ADD, R0, R2),
1749 			BPF_ALU64_REG(BPF_ADD, R0, R3),
1750 			BPF_ALU64_REG(BPF_ADD, R0, R4),
1751 			BPF_ALU64_REG(BPF_ADD, R0, R5),
1752 			BPF_ALU64_REG(BPF_ADD, R0, R6),
1753 			BPF_ALU64_REG(BPF_ADD, R0, R7),
1754 			BPF_ALU64_REG(BPF_ADD, R0, R8),
1755 			BPF_ALU64_REG(BPF_ADD, R0, R9),
1756 			BPF_ALU64_IMM(BPF_ADD, R0, 0xfefe),
1757 			BPF_EXIT_INSN(),
1758 		},
1759 		INTERNAL,
1760 		{ },
1761 		{ { 0, 0xfefe } }
1762 	},
1763 	{	/* Mainly checking JIT here. */
1764 		"MOV REG32",
1765 		.u.insns_int = {
1766 			BPF_LD_IMM64(R0, 0xffffffffffffffffLL),
1767 			BPF_MOV64_REG(R1, R0),
1768 			BPF_MOV64_REG(R2, R1),
1769 			BPF_MOV64_REG(R3, R2),
1770 			BPF_MOV64_REG(R4, R3),
1771 			BPF_MOV64_REG(R5, R4),
1772 			BPF_MOV64_REG(R6, R5),
1773 			BPF_MOV64_REG(R7, R6),
1774 			BPF_MOV64_REG(R8, R7),
1775 			BPF_MOV64_REG(R9, R8),
1776 			BPF_ALU32_IMM(BPF_MOV, R0, 0),
1777 			BPF_ALU32_IMM(BPF_MOV, R1, 0),
1778 			BPF_ALU32_IMM(BPF_MOV, R2, 0),
1779 			BPF_ALU32_IMM(BPF_MOV, R3, 0),
1780 			BPF_ALU32_IMM(BPF_MOV, R4, 0),
1781 			BPF_ALU32_IMM(BPF_MOV, R5, 0),
1782 			BPF_ALU32_IMM(BPF_MOV, R6, 0),
1783 			BPF_ALU32_IMM(BPF_MOV, R7, 0),
1784 			BPF_ALU32_IMM(BPF_MOV, R8, 0),
1785 			BPF_ALU32_IMM(BPF_MOV, R9, 0),
1786 			BPF_ALU64_REG(BPF_ADD, R0, R0),
1787 			BPF_ALU64_REG(BPF_ADD, R0, R1),
1788 			BPF_ALU64_REG(BPF_ADD, R0, R2),
1789 			BPF_ALU64_REG(BPF_ADD, R0, R3),
1790 			BPF_ALU64_REG(BPF_ADD, R0, R4),
1791 			BPF_ALU64_REG(BPF_ADD, R0, R5),
1792 			BPF_ALU64_REG(BPF_ADD, R0, R6),
1793 			BPF_ALU64_REG(BPF_ADD, R0, R7),
1794 			BPF_ALU64_REG(BPF_ADD, R0, R8),
1795 			BPF_ALU64_REG(BPF_ADD, R0, R9),
1796 			BPF_ALU64_IMM(BPF_ADD, R0, 0xfefe),
1797 			BPF_EXIT_INSN(),
1798 		},
1799 		INTERNAL,
1800 		{ },
1801 		{ { 0, 0xfefe } }
1802 	},
1803 	{	/* Mainly checking JIT here. */
1804 		"LD IMM64",
1805 		.u.insns_int = {
1806 			BPF_LD_IMM64(R0, 0xffffffffffffffffLL),
1807 			BPF_MOV64_REG(R1, R0),
1808 			BPF_MOV64_REG(R2, R1),
1809 			BPF_MOV64_REG(R3, R2),
1810 			BPF_MOV64_REG(R4, R3),
1811 			BPF_MOV64_REG(R5, R4),
1812 			BPF_MOV64_REG(R6, R5),
1813 			BPF_MOV64_REG(R7, R6),
1814 			BPF_MOV64_REG(R8, R7),
1815 			BPF_MOV64_REG(R9, R8),
1816 			BPF_LD_IMM64(R0, 0x0LL),
1817 			BPF_LD_IMM64(R1, 0x0LL),
1818 			BPF_LD_IMM64(R2, 0x0LL),
1819 			BPF_LD_IMM64(R3, 0x0LL),
1820 			BPF_LD_IMM64(R4, 0x0LL),
1821 			BPF_LD_IMM64(R5, 0x0LL),
1822 			BPF_LD_IMM64(R6, 0x0LL),
1823 			BPF_LD_IMM64(R7, 0x0LL),
1824 			BPF_LD_IMM64(R8, 0x0LL),
1825 			BPF_LD_IMM64(R9, 0x0LL),
1826 			BPF_ALU64_REG(BPF_ADD, R0, R0),
1827 			BPF_ALU64_REG(BPF_ADD, R0, R1),
1828 			BPF_ALU64_REG(BPF_ADD, R0, R2),
1829 			BPF_ALU64_REG(BPF_ADD, R0, R3),
1830 			BPF_ALU64_REG(BPF_ADD, R0, R4),
1831 			BPF_ALU64_REG(BPF_ADD, R0, R5),
1832 			BPF_ALU64_REG(BPF_ADD, R0, R6),
1833 			BPF_ALU64_REG(BPF_ADD, R0, R7),
1834 			BPF_ALU64_REG(BPF_ADD, R0, R8),
1835 			BPF_ALU64_REG(BPF_ADD, R0, R9),
1836 			BPF_ALU64_IMM(BPF_ADD, R0, 0xfefe),
1837 			BPF_EXIT_INSN(),
1838 		},
1839 		INTERNAL,
1840 		{ },
1841 		{ { 0, 0xfefe } }
1842 	},
1843 	{
1844 		"INT: ALU MIX",
1845 		.u.insns_int = {
1846 			BPF_ALU64_IMM(BPF_MOV, R0, 11),
1847 			BPF_ALU64_IMM(BPF_ADD, R0, -1),
1848 			BPF_ALU64_IMM(BPF_MOV, R2, 2),
1849 			BPF_ALU64_IMM(BPF_XOR, R2, 3),
1850 			BPF_ALU64_REG(BPF_DIV, R0, R2),
1851 			BPF_JMP_IMM(BPF_JEQ, R0, 10, 1),
1852 			BPF_EXIT_INSN(),
1853 			BPF_ALU64_IMM(BPF_MOD, R0, 3),
1854 			BPF_JMP_IMM(BPF_JEQ, R0, 1, 1),
1855 			BPF_EXIT_INSN(),
1856 			BPF_ALU64_IMM(BPF_MOV, R0, -1),
1857 			BPF_EXIT_INSN(),
1858 		},
1859 		INTERNAL,
1860 		{ },
1861 		{ { 0, -1 } }
1862 	},
1863 	{
1864 		"INT: shifts by register",
1865 		.u.insns_int = {
1866 			BPF_MOV64_IMM(R0, -1234),
1867 			BPF_MOV64_IMM(R1, 1),
1868 			BPF_ALU32_REG(BPF_RSH, R0, R1),
1869 			BPF_JMP_IMM(BPF_JEQ, R0, 0x7ffffd97, 1),
1870 			BPF_EXIT_INSN(),
1871 			BPF_MOV64_IMM(R2, 1),
1872 			BPF_ALU64_REG(BPF_LSH, R0, R2),
1873 			BPF_MOV32_IMM(R4, -1234),
1874 			BPF_JMP_REG(BPF_JEQ, R0, R4, 1),
1875 			BPF_EXIT_INSN(),
1876 			BPF_ALU64_IMM(BPF_AND, R4, 63),
1877 			BPF_ALU64_REG(BPF_LSH, R0, R4), /* R0 <= 46 */
1878 			BPF_MOV64_IMM(R3, 47),
1879 			BPF_ALU64_REG(BPF_ARSH, R0, R3),
1880 			BPF_JMP_IMM(BPF_JEQ, R0, -617, 1),
1881 			BPF_EXIT_INSN(),
1882 			BPF_MOV64_IMM(R2, 1),
1883 			BPF_ALU64_REG(BPF_LSH, R4, R2), /* R4 = 46 << 1 */
1884 			BPF_JMP_IMM(BPF_JEQ, R4, 92, 1),
1885 			BPF_EXIT_INSN(),
1886 			BPF_MOV64_IMM(R4, 4),
1887 			BPF_ALU64_REG(BPF_LSH, R4, R4), /* R4 = 4 << 4 */
1888 			BPF_JMP_IMM(BPF_JEQ, R4, 64, 1),
1889 			BPF_EXIT_INSN(),
1890 			BPF_MOV64_IMM(R4, 5),
1891 			BPF_ALU32_REG(BPF_LSH, R4, R4), /* R4 = 5 << 5 */
1892 			BPF_JMP_IMM(BPF_JEQ, R4, 160, 1),
1893 			BPF_EXIT_INSN(),
1894 			BPF_MOV64_IMM(R0, -1),
1895 			BPF_EXIT_INSN(),
1896 		},
1897 		INTERNAL,
1898 		{ },
1899 		{ { 0, -1 } }
1900 	},
1901 	{
1902 		"INT: DIV + ABS",
1903 		.u.insns_int = {
1904 			BPF_ALU64_REG(BPF_MOV, R6, R1),
1905 			BPF_LD_ABS(BPF_B, 3),
1906 			BPF_ALU64_IMM(BPF_MOV, R2, 2),
1907 			BPF_ALU32_REG(BPF_DIV, R0, R2),
1908 			BPF_ALU64_REG(BPF_MOV, R8, R0),
1909 			BPF_LD_ABS(BPF_B, 4),
1910 			BPF_ALU64_REG(BPF_ADD, R8, R0),
1911 			BPF_LD_IND(BPF_B, R8, -70),
1912 			BPF_EXIT_INSN(),
1913 		},
1914 		INTERNAL,
1915 		{ 10, 20, 30, 40, 50 },
1916 		{ { 4, 0 }, { 5, 10 } }
1917 	},
1918 	{
1919 		"INT: DIV by zero",
1920 		.u.insns_int = {
1921 			BPF_ALU64_REG(BPF_MOV, R6, R1),
1922 			BPF_ALU64_IMM(BPF_MOV, R7, 0),
1923 			BPF_LD_ABS(BPF_B, 3),
1924 			BPF_ALU32_REG(BPF_DIV, R0, R7),
1925 			BPF_EXIT_INSN(),
1926 		},
1927 		INTERNAL,
1928 		{ 10, 20, 30, 40, 50 },
1929 		{ { 3, 0 }, { 4, 0 } }
1930 	},
1931 	{
1932 		"check: missing ret",
1933 		.u.insns = {
1934 			BPF_STMT(BPF_LD | BPF_IMM, 1),
1935 		},
1936 		CLASSIC | FLAG_NO_DATA | FLAG_EXPECTED_FAIL,
1937 		{ },
1938 		{ }
1939 	},
1940 	{
1941 		"check: div_k_0",
1942 		.u.insns = {
1943 			BPF_STMT(BPF_ALU | BPF_DIV | BPF_K, 0),
1944 			BPF_STMT(BPF_RET | BPF_K, 0)
1945 		},
1946 		CLASSIC | FLAG_NO_DATA | FLAG_EXPECTED_FAIL,
1947 		{ },
1948 		{ }
1949 	},
1950 	{
1951 		"check: unknown insn",
1952 		.u.insns = {
1953 			/* seccomp insn, rejected in socket filter */
1954 			BPF_STMT(BPF_LDX | BPF_W | BPF_ABS, 0),
1955 			BPF_STMT(BPF_RET | BPF_K, 0)
1956 		},
1957 		CLASSIC | FLAG_EXPECTED_FAIL,
1958 		{ },
1959 		{ }
1960 	},
1961 	{
1962 		"check: out of range spill/fill",
1963 		.u.insns = {
1964 			BPF_STMT(BPF_STX, 16),
1965 			BPF_STMT(BPF_RET | BPF_K, 0)
1966 		},
1967 		CLASSIC | FLAG_NO_DATA | FLAG_EXPECTED_FAIL,
1968 		{ },
1969 		{ }
1970 	},
1971 	{
1972 		"JUMPS + HOLES",
1973 		.u.insns = {
1974 			BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0),
1975 			BPF_JUMP(BPF_JMP | BPF_JGE, 0, 13, 15),
1976 			BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0),
1977 			BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0),
1978 			BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0),
1979 			BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0),
1980 			BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0),
1981 			BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0),
1982 			BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0),
1983 			BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0),
1984 			BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0),
1985 			BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0),
1986 			BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0),
1987 			BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0),
1988 			BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0),
1989 			BPF_JUMP(BPF_JMP | BPF_JEQ, 0x90c2894d, 3, 4),
1990 			BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0),
1991 			BPF_JUMP(BPF_JMP | BPF_JEQ, 0x90c2894d, 1, 2),
1992 			BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0),
1993 			BPF_JUMP(BPF_JMP | BPF_JGE, 0, 14, 15),
1994 			BPF_JUMP(BPF_JMP | BPF_JGE, 0, 13, 14),
1995 			BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0),
1996 			BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0),
1997 			BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0),
1998 			BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0),
1999 			BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0),
2000 			BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0),
2001 			BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0),
2002 			BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0),
2003 			BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0),
2004 			BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0),
2005 			BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0),
2006 			BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0),
2007 			BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0),
2008 			BPF_JUMP(BPF_JMP | BPF_JEQ, 0x2ac28349, 2, 3),
2009 			BPF_JUMP(BPF_JMP | BPF_JEQ, 0x2ac28349, 1, 2),
2010 			BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0),
2011 			BPF_JUMP(BPF_JMP | BPF_JGE, 0, 14, 15),
2012 			BPF_JUMP(BPF_JMP | BPF_JGE, 0, 13, 14),
2013 			BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0),
2014 			BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0),
2015 			BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0),
2016 			BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0),
2017 			BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0),
2018 			BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0),
2019 			BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0),
2020 			BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0),
2021 			BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0),
2022 			BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0),
2023 			BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0),
2024 			BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0),
2025 			BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0),
2026 			BPF_JUMP(BPF_JMP | BPF_JEQ, 0x90d2ff41, 2, 3),
2027 			BPF_JUMP(BPF_JMP | BPF_JEQ, 0x90d2ff41, 1, 2),
2028 			BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 0),
2029 			BPF_STMT(BPF_RET | BPF_A, 0),
2030 			BPF_STMT(BPF_RET | BPF_A, 0),
2031 		},
2032 		CLASSIC,
2033 		{ 0x00, 0x1b, 0x21, 0x3c, 0x9d, 0xf8,
2034 		  0x90, 0xe2, 0xba, 0x0a, 0x56, 0xb4,
2035 		  0x08, 0x00,
2036 		  0x45, 0x00, 0x00, 0x28, 0x00, 0x00,
2037 		  0x20, 0x00, 0x40, 0x11, 0x00, 0x00, /* IP header */
2038 		  0xc0, 0xa8, 0x33, 0x01,
2039 		  0xc0, 0xa8, 0x33, 0x02,
2040 		  0xbb, 0xb6,
2041 		  0xa9, 0xfa,
2042 		  0x00, 0x14, 0x00, 0x00,
2043 		  0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc,
2044 		  0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc,
2045 		  0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc,
2046 		  0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc,
2047 		  0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc,
2048 		  0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc,
2049 		  0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc,
2050 		  0xcc, 0xcc, 0xcc, 0xcc },
2051 		{ { 88, 0x001b } }
2052 	},
2053 	{
2054 		"check: RET X",
2055 		.u.insns = {
2056 			BPF_STMT(BPF_RET | BPF_X, 0),
2057 		},
2058 		CLASSIC | FLAG_NO_DATA | FLAG_EXPECTED_FAIL,
2059 		{ },
2060 		{ },
2061 	},
2062 	{
2063 		"check: LDX + RET X",
2064 		.u.insns = {
2065 			BPF_STMT(BPF_LDX | BPF_IMM, 42),
2066 			BPF_STMT(BPF_RET | BPF_X, 0),
2067 		},
2068 		CLASSIC | FLAG_NO_DATA | FLAG_EXPECTED_FAIL,
2069 		{ },
2070 		{ },
2071 	},
2072 	{	/* Mainly checking JIT here. */
2073 		"M[]: alt STX + LDX",
2074 		.u.insns = {
2075 			BPF_STMT(BPF_LDX | BPF_IMM, 100),
2076 			BPF_STMT(BPF_STX, 0),
2077 			BPF_STMT(BPF_LDX | BPF_MEM, 0),
2078 			BPF_STMT(BPF_MISC | BPF_TXA, 0),
2079 			BPF_STMT(BPF_ALU | BPF_ADD | BPF_K, 1),
2080 			BPF_STMT(BPF_MISC | BPF_TAX, 0),
2081 			BPF_STMT(BPF_STX, 1),
2082 			BPF_STMT(BPF_LDX | BPF_MEM, 1),
2083 			BPF_STMT(BPF_MISC | BPF_TXA, 0),
2084 			BPF_STMT(BPF_ALU | BPF_ADD | BPF_K, 1),
2085 			BPF_STMT(BPF_MISC | BPF_TAX, 0),
2086 			BPF_STMT(BPF_STX, 2),
2087 			BPF_STMT(BPF_LDX | BPF_MEM, 2),
2088 			BPF_STMT(BPF_MISC | BPF_TXA, 0),
2089 			BPF_STMT(BPF_ALU | BPF_ADD | BPF_K, 1),
2090 			BPF_STMT(BPF_MISC | BPF_TAX, 0),
2091 			BPF_STMT(BPF_STX, 3),
2092 			BPF_STMT(BPF_LDX | BPF_MEM, 3),
2093 			BPF_STMT(BPF_MISC | BPF_TXA, 0),
2094 			BPF_STMT(BPF_ALU | BPF_ADD | BPF_K, 1),
2095 			BPF_STMT(BPF_MISC | BPF_TAX, 0),
2096 			BPF_STMT(BPF_STX, 4),
2097 			BPF_STMT(BPF_LDX | BPF_MEM, 4),
2098 			BPF_STMT(BPF_MISC | BPF_TXA, 0),
2099 			BPF_STMT(BPF_ALU | BPF_ADD | BPF_K, 1),
2100 			BPF_STMT(BPF_MISC | BPF_TAX, 0),
2101 			BPF_STMT(BPF_STX, 5),
2102 			BPF_STMT(BPF_LDX | BPF_MEM, 5),
2103 			BPF_STMT(BPF_MISC | BPF_TXA, 0),
2104 			BPF_STMT(BPF_ALU | BPF_ADD | BPF_K, 1),
2105 			BPF_STMT(BPF_MISC | BPF_TAX, 0),
2106 			BPF_STMT(BPF_STX, 6),
2107 			BPF_STMT(BPF_LDX | BPF_MEM, 6),
2108 			BPF_STMT(BPF_MISC | BPF_TXA, 0),
2109 			BPF_STMT(BPF_ALU | BPF_ADD | BPF_K, 1),
2110 			BPF_STMT(BPF_MISC | BPF_TAX, 0),
2111 			BPF_STMT(BPF_STX, 7),
2112 			BPF_STMT(BPF_LDX | BPF_MEM, 7),
2113 			BPF_STMT(BPF_MISC | BPF_TXA, 0),
2114 			BPF_STMT(BPF_ALU | BPF_ADD | BPF_K, 1),
2115 			BPF_STMT(BPF_MISC | BPF_TAX, 0),
2116 			BPF_STMT(BPF_STX, 8),
2117 			BPF_STMT(BPF_LDX | BPF_MEM, 8),
2118 			BPF_STMT(BPF_MISC | BPF_TXA, 0),
2119 			BPF_STMT(BPF_ALU | BPF_ADD | BPF_K, 1),
2120 			BPF_STMT(BPF_MISC | BPF_TAX, 0),
2121 			BPF_STMT(BPF_STX, 9),
2122 			BPF_STMT(BPF_LDX | BPF_MEM, 9),
2123 			BPF_STMT(BPF_MISC | BPF_TXA, 0),
2124 			BPF_STMT(BPF_ALU | BPF_ADD | BPF_K, 1),
2125 			BPF_STMT(BPF_MISC | BPF_TAX, 0),
2126 			BPF_STMT(BPF_STX, 10),
2127 			BPF_STMT(BPF_LDX | BPF_MEM, 10),
2128 			BPF_STMT(BPF_MISC | BPF_TXA, 0),
2129 			BPF_STMT(BPF_ALU | BPF_ADD | BPF_K, 1),
2130 			BPF_STMT(BPF_MISC | BPF_TAX, 0),
2131 			BPF_STMT(BPF_STX, 11),
2132 			BPF_STMT(BPF_LDX | BPF_MEM, 11),
2133 			BPF_STMT(BPF_MISC | BPF_TXA, 0),
2134 			BPF_STMT(BPF_ALU | BPF_ADD | BPF_K, 1),
2135 			BPF_STMT(BPF_MISC | BPF_TAX, 0),
2136 			BPF_STMT(BPF_STX, 12),
2137 			BPF_STMT(BPF_LDX | BPF_MEM, 12),
2138 			BPF_STMT(BPF_MISC | BPF_TXA, 0),
2139 			BPF_STMT(BPF_ALU | BPF_ADD | BPF_K, 1),
2140 			BPF_STMT(BPF_MISC | BPF_TAX, 0),
2141 			BPF_STMT(BPF_STX, 13),
2142 			BPF_STMT(BPF_LDX | BPF_MEM, 13),
2143 			BPF_STMT(BPF_MISC | BPF_TXA, 0),
2144 			BPF_STMT(BPF_ALU | BPF_ADD | BPF_K, 1),
2145 			BPF_STMT(BPF_MISC | BPF_TAX, 0),
2146 			BPF_STMT(BPF_STX, 14),
2147 			BPF_STMT(BPF_LDX | BPF_MEM, 14),
2148 			BPF_STMT(BPF_MISC | BPF_TXA, 0),
2149 			BPF_STMT(BPF_ALU | BPF_ADD | BPF_K, 1),
2150 			BPF_STMT(BPF_MISC | BPF_TAX, 0),
2151 			BPF_STMT(BPF_STX, 15),
2152 			BPF_STMT(BPF_LDX | BPF_MEM, 15),
2153 			BPF_STMT(BPF_MISC | BPF_TXA, 0),
2154 			BPF_STMT(BPF_ALU | BPF_ADD | BPF_K, 1),
2155 			BPF_STMT(BPF_MISC | BPF_TAX, 0),
2156 			BPF_STMT(BPF_RET | BPF_A, 0),
2157 		},
2158 		CLASSIC | FLAG_NO_DATA,
2159 		{ },
2160 		{ { 0, 116 } },
2161 	},
2162 	{	/* Mainly checking JIT here. */
2163 		"M[]: full STX + full LDX",
2164 		.u.insns = {
2165 			BPF_STMT(BPF_LDX | BPF_IMM, 0xbadfeedb),
2166 			BPF_STMT(BPF_STX, 0),
2167 			BPF_STMT(BPF_LDX | BPF_IMM, 0xecabedae),
2168 			BPF_STMT(BPF_STX, 1),
2169 			BPF_STMT(BPF_LDX | BPF_IMM, 0xafccfeaf),
2170 			BPF_STMT(BPF_STX, 2),
2171 			BPF_STMT(BPF_LDX | BPF_IMM, 0xbffdcedc),
2172 			BPF_STMT(BPF_STX, 3),
2173 			BPF_STMT(BPF_LDX | BPF_IMM, 0xfbbbdccb),
2174 			BPF_STMT(BPF_STX, 4),
2175 			BPF_STMT(BPF_LDX | BPF_IMM, 0xfbabcbda),
2176 			BPF_STMT(BPF_STX, 5),
2177 			BPF_STMT(BPF_LDX | BPF_IMM, 0xaedecbdb),
2178 			BPF_STMT(BPF_STX, 6),
2179 			BPF_STMT(BPF_LDX | BPF_IMM, 0xadebbade),
2180 			BPF_STMT(BPF_STX, 7),
2181 			BPF_STMT(BPF_LDX | BPF_IMM, 0xfcfcfaec),
2182 			BPF_STMT(BPF_STX, 8),
2183 			BPF_STMT(BPF_LDX | BPF_IMM, 0xbcdddbdc),
2184 			BPF_STMT(BPF_STX, 9),
2185 			BPF_STMT(BPF_LDX | BPF_IMM, 0xfeefdfac),
2186 			BPF_STMT(BPF_STX, 10),
2187 			BPF_STMT(BPF_LDX | BPF_IMM, 0xcddcdeea),
2188 			BPF_STMT(BPF_STX, 11),
2189 			BPF_STMT(BPF_LDX | BPF_IMM, 0xaccfaebb),
2190 			BPF_STMT(BPF_STX, 12),
2191 			BPF_STMT(BPF_LDX | BPF_IMM, 0xbdcccdcf),
2192 			BPF_STMT(BPF_STX, 13),
2193 			BPF_STMT(BPF_LDX | BPF_IMM, 0xaaedecde),
2194 			BPF_STMT(BPF_STX, 14),
2195 			BPF_STMT(BPF_LDX | BPF_IMM, 0xfaeacdad),
2196 			BPF_STMT(BPF_STX, 15),
2197 			BPF_STMT(BPF_LDX | BPF_MEM, 0),
2198 			BPF_STMT(BPF_MISC | BPF_TXA, 0),
2199 			BPF_STMT(BPF_LDX | BPF_MEM, 1),
2200 			BPF_STMT(BPF_ALU | BPF_ADD | BPF_X, 0),
2201 			BPF_STMT(BPF_LDX | BPF_MEM, 2),
2202 			BPF_STMT(BPF_ALU | BPF_ADD | BPF_X, 0),
2203 			BPF_STMT(BPF_LDX | BPF_MEM, 3),
2204 			BPF_STMT(BPF_ALU | BPF_ADD | BPF_X, 0),
2205 			BPF_STMT(BPF_LDX | BPF_MEM, 4),
2206 			BPF_STMT(BPF_ALU | BPF_ADD | BPF_X, 0),
2207 			BPF_STMT(BPF_LDX | BPF_MEM, 5),
2208 			BPF_STMT(BPF_ALU | BPF_ADD | BPF_X, 0),
2209 			BPF_STMT(BPF_LDX | BPF_MEM, 6),
2210 			BPF_STMT(BPF_ALU | BPF_ADD | BPF_X, 0),
2211 			BPF_STMT(BPF_LDX | BPF_MEM, 7),
2212 			BPF_STMT(BPF_ALU | BPF_ADD | BPF_X, 0),
2213 			BPF_STMT(BPF_LDX | BPF_MEM, 8),
2214 			BPF_STMT(BPF_ALU | BPF_ADD | BPF_X, 0),
2215 			BPF_STMT(BPF_LDX | BPF_MEM, 9),
2216 			BPF_STMT(BPF_ALU | BPF_ADD | BPF_X, 0),
2217 			BPF_STMT(BPF_LDX | BPF_MEM, 10),
2218 			BPF_STMT(BPF_ALU | BPF_ADD | BPF_X, 0),
2219 			BPF_STMT(BPF_LDX | BPF_MEM, 11),
2220 			BPF_STMT(BPF_ALU | BPF_ADD | BPF_X, 0),
2221 			BPF_STMT(BPF_LDX | BPF_MEM, 12),
2222 			BPF_STMT(BPF_ALU | BPF_ADD | BPF_X, 0),
2223 			BPF_STMT(BPF_LDX | BPF_MEM, 13),
2224 			BPF_STMT(BPF_ALU | BPF_ADD | BPF_X, 0),
2225 			BPF_STMT(BPF_LDX | BPF_MEM, 14),
2226 			BPF_STMT(BPF_ALU | BPF_ADD | BPF_X, 0),
2227 			BPF_STMT(BPF_LDX | BPF_MEM, 15),
2228 			BPF_STMT(BPF_ALU | BPF_ADD | BPF_X, 0),
2229 			BPF_STMT(BPF_RET | BPF_A, 0),
2230 		},
2231 		CLASSIC | FLAG_NO_DATA,
2232 		{ },
2233 		{ { 0, 0x2a5a5e5 } },
2234 	},
2235 	{
2236 		"check: SKF_AD_MAX",
2237 		.u.insns = {
2238 			BPF_STMT(BPF_LD | BPF_W | BPF_ABS,
2239 				 SKF_AD_OFF + SKF_AD_MAX),
2240 			BPF_STMT(BPF_RET | BPF_A, 0),
2241 		},
2242 		CLASSIC | FLAG_NO_DATA | FLAG_EXPECTED_FAIL,
2243 		{ },
2244 		{ },
2245 	},
2246 	{	/* Passes checker but fails during runtime. */
2247 		"LD [SKF_AD_OFF-1]",
2248 		.u.insns = {
2249 			BPF_STMT(BPF_LD | BPF_W | BPF_ABS,
2250 				 SKF_AD_OFF - 1),
2251 			BPF_STMT(BPF_RET | BPF_K, 1),
2252 		},
2253 		CLASSIC,
2254 		{ },
2255 		{ { 1, 0 } },
2256 	},
2257 	{
2258 		"load 64-bit immediate",
2259 		.u.insns_int = {
2260 			BPF_LD_IMM64(R1, 0x567800001234LL),
2261 			BPF_MOV64_REG(R2, R1),
2262 			BPF_MOV64_REG(R3, R2),
2263 			BPF_ALU64_IMM(BPF_RSH, R2, 32),
2264 			BPF_ALU64_IMM(BPF_LSH, R3, 32),
2265 			BPF_ALU64_IMM(BPF_RSH, R3, 32),
2266 			BPF_ALU64_IMM(BPF_MOV, R0, 0),
2267 			BPF_JMP_IMM(BPF_JEQ, R2, 0x5678, 1),
2268 			BPF_EXIT_INSN(),
2269 			BPF_JMP_IMM(BPF_JEQ, R3, 0x1234, 1),
2270 			BPF_EXIT_INSN(),
2271 			BPF_LD_IMM64(R0, 0x1ffffffffLL),
2272 			BPF_ALU64_IMM(BPF_RSH, R0, 32), /* R0 = 1 */
2273 			BPF_EXIT_INSN(),
2274 		},
2275 		INTERNAL,
2276 		{ },
2277 		{ { 0, 1 } }
2278 	},
2279 	{
2280 		"nmap reduced",
2281 		.u.insns_int = {
2282 			BPF_MOV64_REG(R6, R1),
2283 			BPF_LD_ABS(BPF_H, 12),
2284 			BPF_JMP_IMM(BPF_JNE, R0, 0x806, 28),
2285 			BPF_LD_ABS(BPF_H, 12),
2286 			BPF_JMP_IMM(BPF_JNE, R0, 0x806, 26),
2287 			BPF_MOV32_IMM(R0, 18),
2288 			BPF_STX_MEM(BPF_W, R10, R0, -64),
2289 			BPF_LDX_MEM(BPF_W, R7, R10, -64),
2290 			BPF_LD_IND(BPF_W, R7, 14),
2291 			BPF_STX_MEM(BPF_W, R10, R0, -60),
2292 			BPF_MOV32_IMM(R0, 280971478),
2293 			BPF_STX_MEM(BPF_W, R10, R0, -56),
2294 			BPF_LDX_MEM(BPF_W, R7, R10, -56),
2295 			BPF_LDX_MEM(BPF_W, R0, R10, -60),
2296 			BPF_ALU32_REG(BPF_SUB, R0, R7),
2297 			BPF_JMP_IMM(BPF_JNE, R0, 0, 15),
2298 			BPF_LD_ABS(BPF_H, 12),
2299 			BPF_JMP_IMM(BPF_JNE, R0, 0x806, 13),
2300 			BPF_MOV32_IMM(R0, 22),
2301 			BPF_STX_MEM(BPF_W, R10, R0, -56),
2302 			BPF_LDX_MEM(BPF_W, R7, R10, -56),
2303 			BPF_LD_IND(BPF_H, R7, 14),
2304 			BPF_STX_MEM(BPF_W, R10, R0, -52),
2305 			BPF_MOV32_IMM(R0, 17366),
2306 			BPF_STX_MEM(BPF_W, R10, R0, -48),
2307 			BPF_LDX_MEM(BPF_W, R7, R10, -48),
2308 			BPF_LDX_MEM(BPF_W, R0, R10, -52),
2309 			BPF_ALU32_REG(BPF_SUB, R0, R7),
2310 			BPF_JMP_IMM(BPF_JNE, R0, 0, 2),
2311 			BPF_MOV32_IMM(R0, 256),
2312 			BPF_EXIT_INSN(),
2313 			BPF_MOV32_IMM(R0, 0),
2314 			BPF_EXIT_INSN(),
2315 		},
2316 		INTERNAL,
2317 		{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x08, 0x06, 0, 0,
2318 		  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2319 		  0x10, 0xbf, 0x48, 0xd6, 0x43, 0xd6},
2320 		{ { 38, 256 } }
2321 	},
2322 	/* BPF_ALU | BPF_MOV | BPF_X */
2323 	{
2324 		"ALU_MOV_X: dst = 2",
2325 		.u.insns_int = {
2326 			BPF_ALU32_IMM(BPF_MOV, R1, 2),
2327 			BPF_ALU32_REG(BPF_MOV, R0, R1),
2328 			BPF_EXIT_INSN(),
2329 		},
2330 		INTERNAL,
2331 		{ },
2332 		{ { 0, 2 } },
2333 	},
2334 	{
2335 		"ALU_MOV_X: dst = 4294967295",
2336 		.u.insns_int = {
2337 			BPF_ALU32_IMM(BPF_MOV, R1, 4294967295U),
2338 			BPF_ALU32_REG(BPF_MOV, R0, R1),
2339 			BPF_EXIT_INSN(),
2340 		},
2341 		INTERNAL,
2342 		{ },
2343 		{ { 0, 4294967295U } },
2344 	},
2345 	{
2346 		"ALU64_MOV_X: dst = 2",
2347 		.u.insns_int = {
2348 			BPF_ALU32_IMM(BPF_MOV, R1, 2),
2349 			BPF_ALU64_REG(BPF_MOV, R0, R1),
2350 			BPF_EXIT_INSN(),
2351 		},
2352 		INTERNAL,
2353 		{ },
2354 		{ { 0, 2 } },
2355 	},
2356 	{
2357 		"ALU64_MOV_X: dst = 4294967295",
2358 		.u.insns_int = {
2359 			BPF_ALU32_IMM(BPF_MOV, R1, 4294967295U),
2360 			BPF_ALU64_REG(BPF_MOV, R0, R1),
2361 			BPF_EXIT_INSN(),
2362 		},
2363 		INTERNAL,
2364 		{ },
2365 		{ { 0, 4294967295U } },
2366 	},
2367 	/* BPF_ALU | BPF_MOV | BPF_K */
2368 	{
2369 		"ALU_MOV_K: dst = 2",
2370 		.u.insns_int = {
2371 			BPF_ALU32_IMM(BPF_MOV, R0, 2),
2372 			BPF_EXIT_INSN(),
2373 		},
2374 		INTERNAL,
2375 		{ },
2376 		{ { 0, 2 } },
2377 	},
2378 	{
2379 		"ALU_MOV_K: dst = 4294967295",
2380 		.u.insns_int = {
2381 			BPF_ALU32_IMM(BPF_MOV, R0, 4294967295U),
2382 			BPF_EXIT_INSN(),
2383 		},
2384 		INTERNAL,
2385 		{ },
2386 		{ { 0, 4294967295U } },
2387 	},
2388 	{
2389 		"ALU_MOV_K: 0x0000ffffffff0000 = 0x00000000ffffffff",
2390 		.u.insns_int = {
2391 			BPF_LD_IMM64(R2, 0x0000ffffffff0000LL),
2392 			BPF_LD_IMM64(R3, 0x00000000ffffffffLL),
2393 			BPF_ALU32_IMM(BPF_MOV, R2, 0xffffffff),
2394 			BPF_JMP_REG(BPF_JEQ, R2, R3, 2),
2395 			BPF_MOV32_IMM(R0, 2),
2396 			BPF_EXIT_INSN(),
2397 			BPF_MOV32_IMM(R0, 1),
2398 			BPF_EXIT_INSN(),
2399 		},
2400 		INTERNAL,
2401 		{ },
2402 		{ { 0, 0x1 } },
2403 	},
2404 	{
2405 		"ALU64_MOV_K: dst = 2",
2406 		.u.insns_int = {
2407 			BPF_ALU64_IMM(BPF_MOV, R0, 2),
2408 			BPF_EXIT_INSN(),
2409 		},
2410 		INTERNAL,
2411 		{ },
2412 		{ { 0, 2 } },
2413 	},
2414 	{
2415 		"ALU64_MOV_K: dst = 2147483647",
2416 		.u.insns_int = {
2417 			BPF_ALU64_IMM(BPF_MOV, R0, 2147483647),
2418 			BPF_EXIT_INSN(),
2419 		},
2420 		INTERNAL,
2421 		{ },
2422 		{ { 0, 2147483647 } },
2423 	},
2424 	{
2425 		"ALU64_OR_K: dst = 0x0",
2426 		.u.insns_int = {
2427 			BPF_LD_IMM64(R2, 0x0000ffffffff0000LL),
2428 			BPF_LD_IMM64(R3, 0x0),
2429 			BPF_ALU64_IMM(BPF_MOV, R2, 0x0),
2430 			BPF_JMP_REG(BPF_JEQ, R2, R3, 2),
2431 			BPF_MOV32_IMM(R0, 2),
2432 			BPF_EXIT_INSN(),
2433 			BPF_MOV32_IMM(R0, 1),
2434 			BPF_EXIT_INSN(),
2435 		},
2436 		INTERNAL,
2437 		{ },
2438 		{ { 0, 0x1 } },
2439 	},
2440 	{
2441 		"ALU64_MOV_K: dst = -1",
2442 		.u.insns_int = {
2443 			BPF_LD_IMM64(R2, 0x0000ffffffff0000LL),
2444 			BPF_LD_IMM64(R3, 0xffffffffffffffffLL),
2445 			BPF_ALU64_IMM(BPF_MOV, R2, 0xffffffff),
2446 			BPF_JMP_REG(BPF_JEQ, R2, R3, 2),
2447 			BPF_MOV32_IMM(R0, 2),
2448 			BPF_EXIT_INSN(),
2449 			BPF_MOV32_IMM(R0, 1),
2450 			BPF_EXIT_INSN(),
2451 		},
2452 		INTERNAL,
2453 		{ },
2454 		{ { 0, 0x1 } },
2455 	},
2456 	/* BPF_ALU | BPF_ADD | BPF_X */
2457 	{
2458 		"ALU_ADD_X: 1 + 2 = 3",
2459 		.u.insns_int = {
2460 			BPF_LD_IMM64(R0, 1),
2461 			BPF_ALU32_IMM(BPF_MOV, R1, 2),
2462 			BPF_ALU32_REG(BPF_ADD, R0, R1),
2463 			BPF_EXIT_INSN(),
2464 		},
2465 		INTERNAL,
2466 		{ },
2467 		{ { 0, 3 } },
2468 	},
2469 	{
2470 		"ALU_ADD_X: 1 + 4294967294 = 4294967295",
2471 		.u.insns_int = {
2472 			BPF_LD_IMM64(R0, 1),
2473 			BPF_ALU32_IMM(BPF_MOV, R1, 4294967294U),
2474 			BPF_ALU32_REG(BPF_ADD, R0, R1),
2475 			BPF_EXIT_INSN(),
2476 		},
2477 		INTERNAL,
2478 		{ },
2479 		{ { 0, 4294967295U } },
2480 	},
2481 	{
2482 		"ALU_ADD_X: 2 + 4294967294 = 0",
2483 		.u.insns_int = {
2484 			BPF_LD_IMM64(R0, 2),
2485 			BPF_LD_IMM64(R1, 4294967294U),
2486 			BPF_ALU32_REG(BPF_ADD, R0, R1),
2487 			BPF_JMP_IMM(BPF_JEQ, R0, 0, 2),
2488 			BPF_ALU32_IMM(BPF_MOV, R0, 0),
2489 			BPF_EXIT_INSN(),
2490 			BPF_ALU32_IMM(BPF_MOV, R0, 1),
2491 			BPF_EXIT_INSN(),
2492 		},
2493 		INTERNAL,
2494 		{ },
2495 		{ { 0, 1 } },
2496 	},
2497 	{
2498 		"ALU64_ADD_X: 1 + 2 = 3",
2499 		.u.insns_int = {
2500 			BPF_LD_IMM64(R0, 1),
2501 			BPF_ALU32_IMM(BPF_MOV, R1, 2),
2502 			BPF_ALU64_REG(BPF_ADD, R0, R1),
2503 			BPF_EXIT_INSN(),
2504 		},
2505 		INTERNAL,
2506 		{ },
2507 		{ { 0, 3 } },
2508 	},
2509 	{
2510 		"ALU64_ADD_X: 1 + 4294967294 = 4294967295",
2511 		.u.insns_int = {
2512 			BPF_LD_IMM64(R0, 1),
2513 			BPF_ALU32_IMM(BPF_MOV, R1, 4294967294U),
2514 			BPF_ALU64_REG(BPF_ADD, R0, R1),
2515 			BPF_EXIT_INSN(),
2516 		},
2517 		INTERNAL,
2518 		{ },
2519 		{ { 0, 4294967295U } },
2520 	},
2521 	{
2522 		"ALU64_ADD_X: 2 + 4294967294 = 4294967296",
2523 		.u.insns_int = {
2524 			BPF_LD_IMM64(R0, 2),
2525 			BPF_LD_IMM64(R1, 4294967294U),
2526 			BPF_LD_IMM64(R2, 4294967296ULL),
2527 			BPF_ALU64_REG(BPF_ADD, R0, R1),
2528 			BPF_JMP_REG(BPF_JEQ, R0, R2, 2),
2529 			BPF_MOV32_IMM(R0, 0),
2530 			BPF_EXIT_INSN(),
2531 			BPF_MOV32_IMM(R0, 1),
2532 			BPF_EXIT_INSN(),
2533 		},
2534 		INTERNAL,
2535 		{ },
2536 		{ { 0, 1 } },
2537 	},
2538 	/* BPF_ALU | BPF_ADD | BPF_K */
2539 	{
2540 		"ALU_ADD_K: 1 + 2 = 3",
2541 		.u.insns_int = {
2542 			BPF_LD_IMM64(R0, 1),
2543 			BPF_ALU32_IMM(BPF_ADD, R0, 2),
2544 			BPF_EXIT_INSN(),
2545 		},
2546 		INTERNAL,
2547 		{ },
2548 		{ { 0, 3 } },
2549 	},
2550 	{
2551 		"ALU_ADD_K: 3 + 0 = 3",
2552 		.u.insns_int = {
2553 			BPF_LD_IMM64(R0, 3),
2554 			BPF_ALU32_IMM(BPF_ADD, R0, 0),
2555 			BPF_EXIT_INSN(),
2556 		},
2557 		INTERNAL,
2558 		{ },
2559 		{ { 0, 3 } },
2560 	},
2561 	{
2562 		"ALU_ADD_K: 1 + 4294967294 = 4294967295",
2563 		.u.insns_int = {
2564 			BPF_LD_IMM64(R0, 1),
2565 			BPF_ALU32_IMM(BPF_ADD, R0, 4294967294U),
2566 			BPF_EXIT_INSN(),
2567 		},
2568 		INTERNAL,
2569 		{ },
2570 		{ { 0, 4294967295U } },
2571 	},
2572 	{
2573 		"ALU_ADD_K: 4294967294 + 2 = 0",
2574 		.u.insns_int = {
2575 			BPF_LD_IMM64(R0, 4294967294U),
2576 			BPF_ALU32_IMM(BPF_ADD, R0, 2),
2577 			BPF_JMP_IMM(BPF_JEQ, R0, 0, 2),
2578 			BPF_ALU32_IMM(BPF_MOV, R0, 0),
2579 			BPF_EXIT_INSN(),
2580 			BPF_ALU32_IMM(BPF_MOV, R0, 1),
2581 			BPF_EXIT_INSN(),
2582 		},
2583 		INTERNAL,
2584 		{ },
2585 		{ { 0, 1 } },
2586 	},
2587 	{
2588 		"ALU_ADD_K: 0 + (-1) = 0x00000000ffffffff",
2589 		.u.insns_int = {
2590 			BPF_LD_IMM64(R2, 0x0),
2591 			BPF_LD_IMM64(R3, 0x00000000ffffffff),
2592 			BPF_ALU32_IMM(BPF_ADD, R2, 0xffffffff),
2593 			BPF_JMP_REG(BPF_JEQ, R2, R3, 2),
2594 			BPF_MOV32_IMM(R0, 2),
2595 			BPF_EXIT_INSN(),
2596 			BPF_MOV32_IMM(R0, 1),
2597 			BPF_EXIT_INSN(),
2598 		},
2599 		INTERNAL,
2600 		{ },
2601 		{ { 0, 0x1 } },
2602 	},
2603 	{
2604 		"ALU_ADD_K: 0 + 0xffff = 0xffff",
2605 		.u.insns_int = {
2606 			BPF_LD_IMM64(R2, 0x0),
2607 			BPF_LD_IMM64(R3, 0xffff),
2608 			BPF_ALU32_IMM(BPF_ADD, R2, 0xffff),
2609 			BPF_JMP_REG(BPF_JEQ, R2, R3, 2),
2610 			BPF_MOV32_IMM(R0, 2),
2611 			BPF_EXIT_INSN(),
2612 			BPF_MOV32_IMM(R0, 1),
2613 			BPF_EXIT_INSN(),
2614 		},
2615 		INTERNAL,
2616 		{ },
2617 		{ { 0, 0x1 } },
2618 	},
2619 	{
2620 		"ALU_ADD_K: 0 + 0x7fffffff = 0x7fffffff",
2621 		.u.insns_int = {
2622 			BPF_LD_IMM64(R2, 0x0),
2623 			BPF_LD_IMM64(R3, 0x7fffffff),
2624 			BPF_ALU32_IMM(BPF_ADD, R2, 0x7fffffff),
2625 			BPF_JMP_REG(BPF_JEQ, R2, R3, 2),
2626 			BPF_MOV32_IMM(R0, 2),
2627 			BPF_EXIT_INSN(),
2628 			BPF_MOV32_IMM(R0, 1),
2629 			BPF_EXIT_INSN(),
2630 		},
2631 		INTERNAL,
2632 		{ },
2633 		{ { 0, 0x1 } },
2634 	},
2635 	{
2636 		"ALU_ADD_K: 0 + 0x80000000 = 0x80000000",
2637 		.u.insns_int = {
2638 			BPF_LD_IMM64(R2, 0x0),
2639 			BPF_LD_IMM64(R3, 0x80000000),
2640 			BPF_ALU32_IMM(BPF_ADD, R2, 0x80000000),
2641 			BPF_JMP_REG(BPF_JEQ, R2, R3, 2),
2642 			BPF_MOV32_IMM(R0, 2),
2643 			BPF_EXIT_INSN(),
2644 			BPF_MOV32_IMM(R0, 1),
2645 			BPF_EXIT_INSN(),
2646 		},
2647 		INTERNAL,
2648 		{ },
2649 		{ { 0, 0x1 } },
2650 	},
2651 	{
2652 		"ALU_ADD_K: 0 + 0x80008000 = 0x80008000",
2653 		.u.insns_int = {
2654 			BPF_LD_IMM64(R2, 0x0),
2655 			BPF_LD_IMM64(R3, 0x80008000),
2656 			BPF_ALU32_IMM(BPF_ADD, R2, 0x80008000),
2657 			BPF_JMP_REG(BPF_JEQ, R2, R3, 2),
2658 			BPF_MOV32_IMM(R0, 2),
2659 			BPF_EXIT_INSN(),
2660 			BPF_MOV32_IMM(R0, 1),
2661 			BPF_EXIT_INSN(),
2662 		},
2663 		INTERNAL,
2664 		{ },
2665 		{ { 0, 0x1 } },
2666 	},
2667 	{
2668 		"ALU64_ADD_K: 1 + 2 = 3",
2669 		.u.insns_int = {
2670 			BPF_LD_IMM64(R0, 1),
2671 			BPF_ALU64_IMM(BPF_ADD, R0, 2),
2672 			BPF_EXIT_INSN(),
2673 		},
2674 		INTERNAL,
2675 		{ },
2676 		{ { 0, 3 } },
2677 	},
2678 	{
2679 		"ALU64_ADD_K: 3 + 0 = 3",
2680 		.u.insns_int = {
2681 			BPF_LD_IMM64(R0, 3),
2682 			BPF_ALU64_IMM(BPF_ADD, R0, 0),
2683 			BPF_EXIT_INSN(),
2684 		},
2685 		INTERNAL,
2686 		{ },
2687 		{ { 0, 3 } },
2688 	},
2689 	{
2690 		"ALU64_ADD_K: 1 + 2147483646 = 2147483647",
2691 		.u.insns_int = {
2692 			BPF_LD_IMM64(R0, 1),
2693 			BPF_ALU64_IMM(BPF_ADD, R0, 2147483646),
2694 			BPF_EXIT_INSN(),
2695 		},
2696 		INTERNAL,
2697 		{ },
2698 		{ { 0, 2147483647 } },
2699 	},
2700 	{
2701 		"ALU64_ADD_K: 4294967294 + 2 = 4294967296",
2702 		.u.insns_int = {
2703 			BPF_LD_IMM64(R0, 4294967294U),
2704 			BPF_LD_IMM64(R1, 4294967296ULL),
2705 			BPF_ALU64_IMM(BPF_ADD, R0, 2),
2706 			BPF_JMP_REG(BPF_JEQ, R0, R1, 2),
2707 			BPF_ALU32_IMM(BPF_MOV, R0, 0),
2708 			BPF_EXIT_INSN(),
2709 			BPF_ALU32_IMM(BPF_MOV, R0, 1),
2710 			BPF_EXIT_INSN(),
2711 		},
2712 		INTERNAL,
2713 		{ },
2714 		{ { 0, 1 } },
2715 	},
2716 	{
2717 		"ALU64_ADD_K: 2147483646 + -2147483647 = -1",
2718 		.u.insns_int = {
2719 			BPF_LD_IMM64(R0, 2147483646),
2720 			BPF_ALU64_IMM(BPF_ADD, R0, -2147483647),
2721 			BPF_EXIT_INSN(),
2722 		},
2723 		INTERNAL,
2724 		{ },
2725 		{ { 0, -1 } },
2726 	},
2727 	{
2728 		"ALU64_ADD_K: 1 + 0 = 1",
2729 		.u.insns_int = {
2730 			BPF_LD_IMM64(R2, 0x1),
2731 			BPF_LD_IMM64(R3, 0x1),
2732 			BPF_ALU64_IMM(BPF_ADD, R2, 0x0),
2733 			BPF_JMP_REG(BPF_JEQ, R2, R3, 2),
2734 			BPF_MOV32_IMM(R0, 2),
2735 			BPF_EXIT_INSN(),
2736 			BPF_MOV32_IMM(R0, 1),
2737 			BPF_EXIT_INSN(),
2738 		},
2739 		INTERNAL,
2740 		{ },
2741 		{ { 0, 0x1 } },
2742 	},
2743 	{
2744 		"ALU64_ADD_K: 0 + (-1) = 0xffffffffffffffff",
2745 		.u.insns_int = {
2746 			BPF_LD_IMM64(R2, 0x0),
2747 			BPF_LD_IMM64(R3, 0xffffffffffffffffLL),
2748 			BPF_ALU64_IMM(BPF_ADD, R2, 0xffffffff),
2749 			BPF_JMP_REG(BPF_JEQ, R2, R3, 2),
2750 			BPF_MOV32_IMM(R0, 2),
2751 			BPF_EXIT_INSN(),
2752 			BPF_MOV32_IMM(R0, 1),
2753 			BPF_EXIT_INSN(),
2754 		},
2755 		INTERNAL,
2756 		{ },
2757 		{ { 0, 0x1 } },
2758 	},
2759 	{
2760 		"ALU64_ADD_K: 0 + 0xffff = 0xffff",
2761 		.u.insns_int = {
2762 			BPF_LD_IMM64(R2, 0x0),
2763 			BPF_LD_IMM64(R3, 0xffff),
2764 			BPF_ALU64_IMM(BPF_ADD, R2, 0xffff),
2765 			BPF_JMP_REG(BPF_JEQ, R2, R3, 2),
2766 			BPF_MOV32_IMM(R0, 2),
2767 			BPF_EXIT_INSN(),
2768 			BPF_MOV32_IMM(R0, 1),
2769 			BPF_EXIT_INSN(),
2770 		},
2771 		INTERNAL,
2772 		{ },
2773 		{ { 0, 0x1 } },
2774 	},
2775 	{
2776 		"ALU64_ADD_K: 0 + 0x7fffffff = 0x7fffffff",
2777 		.u.insns_int = {
2778 			BPF_LD_IMM64(R2, 0x0),
2779 			BPF_LD_IMM64(R3, 0x7fffffff),
2780 			BPF_ALU64_IMM(BPF_ADD, R2, 0x7fffffff),
2781 			BPF_JMP_REG(BPF_JEQ, R2, R3, 2),
2782 			BPF_MOV32_IMM(R0, 2),
2783 			BPF_EXIT_INSN(),
2784 			BPF_MOV32_IMM(R0, 1),
2785 			BPF_EXIT_INSN(),
2786 		},
2787 		INTERNAL,
2788 		{ },
2789 		{ { 0, 0x1 } },
2790 	},
2791 	{
2792 		"ALU64_ADD_K: 0 + 0x80000000 = 0xffffffff80000000",
2793 		.u.insns_int = {
2794 			BPF_LD_IMM64(R2, 0x0),
2795 			BPF_LD_IMM64(R3, 0xffffffff80000000LL),
2796 			BPF_ALU64_IMM(BPF_ADD, R2, 0x80000000),
2797 			BPF_JMP_REG(BPF_JEQ, R2, R3, 2),
2798 			BPF_MOV32_IMM(R0, 2),
2799 			BPF_EXIT_INSN(),
2800 			BPF_MOV32_IMM(R0, 1),
2801 			BPF_EXIT_INSN(),
2802 		},
2803 		INTERNAL,
2804 		{ },
2805 		{ { 0, 0x1 } },
2806 	},
2807 	{
2808 		"ALU_ADD_K: 0 + 0x80008000 = 0xffffffff80008000",
2809 		.u.insns_int = {
2810 			BPF_LD_IMM64(R2, 0x0),
2811 			BPF_LD_IMM64(R3, 0xffffffff80008000LL),
2812 			BPF_ALU64_IMM(BPF_ADD, R2, 0x80008000),
2813 			BPF_JMP_REG(BPF_JEQ, R2, R3, 2),
2814 			BPF_MOV32_IMM(R0, 2),
2815 			BPF_EXIT_INSN(),
2816 			BPF_MOV32_IMM(R0, 1),
2817 			BPF_EXIT_INSN(),
2818 		},
2819 		INTERNAL,
2820 		{ },
2821 		{ { 0, 0x1 } },
2822 	},
2823 	/* BPF_ALU | BPF_SUB | BPF_X */
2824 	{
2825 		"ALU_SUB_X: 3 - 1 = 2",
2826 		.u.insns_int = {
2827 			BPF_LD_IMM64(R0, 3),
2828 			BPF_ALU32_IMM(BPF_MOV, R1, 1),
2829 			BPF_ALU32_REG(BPF_SUB, R0, R1),
2830 			BPF_EXIT_INSN(),
2831 		},
2832 		INTERNAL,
2833 		{ },
2834 		{ { 0, 2 } },
2835 	},
2836 	{
2837 		"ALU_SUB_X: 4294967295 - 4294967294 = 1",
2838 		.u.insns_int = {
2839 			BPF_LD_IMM64(R0, 4294967295U),
2840 			BPF_ALU32_IMM(BPF_MOV, R1, 4294967294U),
2841 			BPF_ALU32_REG(BPF_SUB, R0, R1),
2842 			BPF_EXIT_INSN(),
2843 		},
2844 		INTERNAL,
2845 		{ },
2846 		{ { 0, 1 } },
2847 	},
2848 	{
2849 		"ALU64_SUB_X: 3 - 1 = 2",
2850 		.u.insns_int = {
2851 			BPF_LD_IMM64(R0, 3),
2852 			BPF_ALU32_IMM(BPF_MOV, R1, 1),
2853 			BPF_ALU64_REG(BPF_SUB, R0, R1),
2854 			BPF_EXIT_INSN(),
2855 		},
2856 		INTERNAL,
2857 		{ },
2858 		{ { 0, 2 } },
2859 	},
2860 	{
2861 		"ALU64_SUB_X: 4294967295 - 4294967294 = 1",
2862 		.u.insns_int = {
2863 			BPF_LD_IMM64(R0, 4294967295U),
2864 			BPF_ALU32_IMM(BPF_MOV, R1, 4294967294U),
2865 			BPF_ALU64_REG(BPF_SUB, R0, R1),
2866 			BPF_EXIT_INSN(),
2867 		},
2868 		INTERNAL,
2869 		{ },
2870 		{ { 0, 1 } },
2871 	},
2872 	/* BPF_ALU | BPF_SUB | BPF_K */
2873 	{
2874 		"ALU_SUB_K: 3 - 1 = 2",
2875 		.u.insns_int = {
2876 			BPF_LD_IMM64(R0, 3),
2877 			BPF_ALU32_IMM(BPF_SUB, R0, 1),
2878 			BPF_EXIT_INSN(),
2879 		},
2880 		INTERNAL,
2881 		{ },
2882 		{ { 0, 2 } },
2883 	},
2884 	{
2885 		"ALU_SUB_K: 3 - 0 = 3",
2886 		.u.insns_int = {
2887 			BPF_LD_IMM64(R0, 3),
2888 			BPF_ALU32_IMM(BPF_SUB, R0, 0),
2889 			BPF_EXIT_INSN(),
2890 		},
2891 		INTERNAL,
2892 		{ },
2893 		{ { 0, 3 } },
2894 	},
2895 	{
2896 		"ALU_SUB_K: 4294967295 - 4294967294 = 1",
2897 		.u.insns_int = {
2898 			BPF_LD_IMM64(R0, 4294967295U),
2899 			BPF_ALU32_IMM(BPF_SUB, R0, 4294967294U),
2900 			BPF_EXIT_INSN(),
2901 		},
2902 		INTERNAL,
2903 		{ },
2904 		{ { 0, 1 } },
2905 	},
2906 	{
2907 		"ALU64_SUB_K: 3 - 1 = 2",
2908 		.u.insns_int = {
2909 			BPF_LD_IMM64(R0, 3),
2910 			BPF_ALU64_IMM(BPF_SUB, R0, 1),
2911 			BPF_EXIT_INSN(),
2912 		},
2913 		INTERNAL,
2914 		{ },
2915 		{ { 0, 2 } },
2916 	},
2917 	{
2918 		"ALU64_SUB_K: 3 - 0 = 3",
2919 		.u.insns_int = {
2920 			BPF_LD_IMM64(R0, 3),
2921 			BPF_ALU64_IMM(BPF_SUB, R0, 0),
2922 			BPF_EXIT_INSN(),
2923 		},
2924 		INTERNAL,
2925 		{ },
2926 		{ { 0, 3 } },
2927 	},
2928 	{
2929 		"ALU64_SUB_K: 4294967294 - 4294967295 = -1",
2930 		.u.insns_int = {
2931 			BPF_LD_IMM64(R0, 4294967294U),
2932 			BPF_ALU64_IMM(BPF_SUB, R0, 4294967295U),
2933 			BPF_EXIT_INSN(),
2934 		},
2935 		INTERNAL,
2936 		{ },
2937 		{ { 0, -1 } },
2938 	},
2939 	{
2940 		"ALU64_ADD_K: 2147483646 - 2147483647 = -1",
2941 		.u.insns_int = {
2942 			BPF_LD_IMM64(R0, 2147483646),
2943 			BPF_ALU64_IMM(BPF_SUB, R0, 2147483647),
2944 			BPF_EXIT_INSN(),
2945 		},
2946 		INTERNAL,
2947 		{ },
2948 		{ { 0, -1 } },
2949 	},
2950 	/* BPF_ALU | BPF_MUL | BPF_X */
2951 	{
2952 		"ALU_MUL_X: 2 * 3 = 6",
2953 		.u.insns_int = {
2954 			BPF_LD_IMM64(R0, 2),
2955 			BPF_ALU32_IMM(BPF_MOV, R1, 3),
2956 			BPF_ALU32_REG(BPF_MUL, R0, R1),
2957 			BPF_EXIT_INSN(),
2958 		},
2959 		INTERNAL,
2960 		{ },
2961 		{ { 0, 6 } },
2962 	},
2963 	{
2964 		"ALU_MUL_X: 2 * 0x7FFFFFF8 = 0xFFFFFFF0",
2965 		.u.insns_int = {
2966 			BPF_LD_IMM64(R0, 2),
2967 			BPF_ALU32_IMM(BPF_MOV, R1, 0x7FFFFFF8),
2968 			BPF_ALU32_REG(BPF_MUL, R0, R1),
2969 			BPF_EXIT_INSN(),
2970 		},
2971 		INTERNAL,
2972 		{ },
2973 		{ { 0, 0xFFFFFFF0 } },
2974 	},
2975 	{
2976 		"ALU_MUL_X: -1 * -1 = 1",
2977 		.u.insns_int = {
2978 			BPF_LD_IMM64(R0, -1),
2979 			BPF_ALU32_IMM(BPF_MOV, R1, -1),
2980 			BPF_ALU32_REG(BPF_MUL, R0, R1),
2981 			BPF_EXIT_INSN(),
2982 		},
2983 		INTERNAL,
2984 		{ },
2985 		{ { 0, 1 } },
2986 	},
2987 	{
2988 		"ALU64_MUL_X: 2 * 3 = 6",
2989 		.u.insns_int = {
2990 			BPF_LD_IMM64(R0, 2),
2991 			BPF_ALU32_IMM(BPF_MOV, R1, 3),
2992 			BPF_ALU64_REG(BPF_MUL, R0, R1),
2993 			BPF_EXIT_INSN(),
2994 		},
2995 		INTERNAL,
2996 		{ },
2997 		{ { 0, 6 } },
2998 	},
2999 	{
3000 		"ALU64_MUL_X: 1 * 2147483647 = 2147483647",
3001 		.u.insns_int = {
3002 			BPF_LD_IMM64(R0, 1),
3003 			BPF_ALU32_IMM(BPF_MOV, R1, 2147483647),
3004 			BPF_ALU64_REG(BPF_MUL, R0, R1),
3005 			BPF_EXIT_INSN(),
3006 		},
3007 		INTERNAL,
3008 		{ },
3009 		{ { 0, 2147483647 } },
3010 	},
3011 	/* BPF_ALU | BPF_MUL | BPF_K */
3012 	{
3013 		"ALU_MUL_K: 2 * 3 = 6",
3014 		.u.insns_int = {
3015 			BPF_LD_IMM64(R0, 2),
3016 			BPF_ALU32_IMM(BPF_MUL, R0, 3),
3017 			BPF_EXIT_INSN(),
3018 		},
3019 		INTERNAL,
3020 		{ },
3021 		{ { 0, 6 } },
3022 	},
3023 	{
3024 		"ALU_MUL_K: 3 * 1 = 3",
3025 		.u.insns_int = {
3026 			BPF_LD_IMM64(R0, 3),
3027 			BPF_ALU32_IMM(BPF_MUL, R0, 1),
3028 			BPF_EXIT_INSN(),
3029 		},
3030 		INTERNAL,
3031 		{ },
3032 		{ { 0, 3 } },
3033 	},
3034 	{
3035 		"ALU_MUL_K: 2 * 0x7FFFFFF8 = 0xFFFFFFF0",
3036 		.u.insns_int = {
3037 			BPF_LD_IMM64(R0, 2),
3038 			BPF_ALU32_IMM(BPF_MUL, R0, 0x7FFFFFF8),
3039 			BPF_EXIT_INSN(),
3040 		},
3041 		INTERNAL,
3042 		{ },
3043 		{ { 0, 0xFFFFFFF0 } },
3044 	},
3045 	{
3046 		"ALU_MUL_K: 1 * (-1) = 0x00000000ffffffff",
3047 		.u.insns_int = {
3048 			BPF_LD_IMM64(R2, 0x1),
3049 			BPF_LD_IMM64(R3, 0x00000000ffffffff),
3050 			BPF_ALU32_IMM(BPF_MUL, R2, 0xffffffff),
3051 			BPF_JMP_REG(BPF_JEQ, R2, R3, 2),
3052 			BPF_MOV32_IMM(R0, 2),
3053 			BPF_EXIT_INSN(),
3054 			BPF_MOV32_IMM(R0, 1),
3055 			BPF_EXIT_INSN(),
3056 		},
3057 		INTERNAL,
3058 		{ },
3059 		{ { 0, 0x1 } },
3060 	},
3061 	{
3062 		"ALU64_MUL_K: 2 * 3 = 6",
3063 		.u.insns_int = {
3064 			BPF_LD_IMM64(R0, 2),
3065 			BPF_ALU64_IMM(BPF_MUL, R0, 3),
3066 			BPF_EXIT_INSN(),
3067 		},
3068 		INTERNAL,
3069 		{ },
3070 		{ { 0, 6 } },
3071 	},
3072 	{
3073 		"ALU64_MUL_K: 3 * 1 = 3",
3074 		.u.insns_int = {
3075 			BPF_LD_IMM64(R0, 3),
3076 			BPF_ALU64_IMM(BPF_MUL, R0, 1),
3077 			BPF_EXIT_INSN(),
3078 		},
3079 		INTERNAL,
3080 		{ },
3081 		{ { 0, 3 } },
3082 	},
3083 	{
3084 		"ALU64_MUL_K: 1 * 2147483647 = 2147483647",
3085 		.u.insns_int = {
3086 			BPF_LD_IMM64(R0, 1),
3087 			BPF_ALU64_IMM(BPF_MUL, R0, 2147483647),
3088 			BPF_EXIT_INSN(),
3089 		},
3090 		INTERNAL,
3091 		{ },
3092 		{ { 0, 2147483647 } },
3093 	},
3094 	{
3095 		"ALU64_MUL_K: 1 * -2147483647 = -2147483647",
3096 		.u.insns_int = {
3097 			BPF_LD_IMM64(R0, 1),
3098 			BPF_ALU64_IMM(BPF_MUL, R0, -2147483647),
3099 			BPF_EXIT_INSN(),
3100 		},
3101 		INTERNAL,
3102 		{ },
3103 		{ { 0, -2147483647 } },
3104 	},
3105 	{
3106 		"ALU64_MUL_K: 1 * (-1) = 0xffffffffffffffff",
3107 		.u.insns_int = {
3108 			BPF_LD_IMM64(R2, 0x1),
3109 			BPF_LD_IMM64(R3, 0xffffffffffffffffLL),
3110 			BPF_ALU64_IMM(BPF_MUL, R2, 0xffffffff),
3111 			BPF_JMP_REG(BPF_JEQ, R2, R3, 2),
3112 			BPF_MOV32_IMM(R0, 2),
3113 			BPF_EXIT_INSN(),
3114 			BPF_MOV32_IMM(R0, 1),
3115 			BPF_EXIT_INSN(),
3116 		},
3117 		INTERNAL,
3118 		{ },
3119 		{ { 0, 0x1 } },
3120 	},
3121 	/* BPF_ALU | BPF_DIV | BPF_X */
3122 	{
3123 		"ALU_DIV_X: 6 / 2 = 3",
3124 		.u.insns_int = {
3125 			BPF_LD_IMM64(R0, 6),
3126 			BPF_ALU32_IMM(BPF_MOV, R1, 2),
3127 			BPF_ALU32_REG(BPF_DIV, R0, R1),
3128 			BPF_EXIT_INSN(),
3129 		},
3130 		INTERNAL,
3131 		{ },
3132 		{ { 0, 3 } },
3133 	},
3134 	{
3135 		"ALU_DIV_X: 4294967295 / 4294967295 = 1",
3136 		.u.insns_int = {
3137 			BPF_LD_IMM64(R0, 4294967295U),
3138 			BPF_ALU32_IMM(BPF_MOV, R1, 4294967295U),
3139 			BPF_ALU32_REG(BPF_DIV, R0, R1),
3140 			BPF_EXIT_INSN(),
3141 		},
3142 		INTERNAL,
3143 		{ },
3144 		{ { 0, 1 } },
3145 	},
3146 	{
3147 		"ALU64_DIV_X: 6 / 2 = 3",
3148 		.u.insns_int = {
3149 			BPF_LD_IMM64(R0, 6),
3150 			BPF_ALU32_IMM(BPF_MOV, R1, 2),
3151 			BPF_ALU64_REG(BPF_DIV, R0, R1),
3152 			BPF_EXIT_INSN(),
3153 		},
3154 		INTERNAL,
3155 		{ },
3156 		{ { 0, 3 } },
3157 	},
3158 	{
3159 		"ALU64_DIV_X: 2147483647 / 2147483647 = 1",
3160 		.u.insns_int = {
3161 			BPF_LD_IMM64(R0, 2147483647),
3162 			BPF_ALU32_IMM(BPF_MOV, R1, 2147483647),
3163 			BPF_ALU64_REG(BPF_DIV, R0, R1),
3164 			BPF_EXIT_INSN(),
3165 		},
3166 		INTERNAL,
3167 		{ },
3168 		{ { 0, 1 } },
3169 	},
3170 	{
3171 		"ALU64_DIV_X: 0xffffffffffffffff / (-1) = 0x0000000000000001",
3172 		.u.insns_int = {
3173 			BPF_LD_IMM64(R2, 0xffffffffffffffffLL),
3174 			BPF_LD_IMM64(R4, 0xffffffffffffffffLL),
3175 			BPF_LD_IMM64(R3, 0x0000000000000001LL),
3176 			BPF_ALU64_REG(BPF_DIV, R2, R4),
3177 			BPF_JMP_REG(BPF_JEQ, R2, R3, 2),
3178 			BPF_MOV32_IMM(R0, 2),
3179 			BPF_EXIT_INSN(),
3180 			BPF_MOV32_IMM(R0, 1),
3181 			BPF_EXIT_INSN(),
3182 		},
3183 		INTERNAL,
3184 		{ },
3185 		{ { 0, 0x1 } },
3186 	},
3187 	/* BPF_ALU | BPF_DIV | BPF_K */
3188 	{
3189 		"ALU_DIV_K: 6 / 2 = 3",
3190 		.u.insns_int = {
3191 			BPF_LD_IMM64(R0, 6),
3192 			BPF_ALU32_IMM(BPF_DIV, R0, 2),
3193 			BPF_EXIT_INSN(),
3194 		},
3195 		INTERNAL,
3196 		{ },
3197 		{ { 0, 3 } },
3198 	},
3199 	{
3200 		"ALU_DIV_K: 3 / 1 = 3",
3201 		.u.insns_int = {
3202 			BPF_LD_IMM64(R0, 3),
3203 			BPF_ALU32_IMM(BPF_DIV, R0, 1),
3204 			BPF_EXIT_INSN(),
3205 		},
3206 		INTERNAL,
3207 		{ },
3208 		{ { 0, 3 } },
3209 	},
3210 	{
3211 		"ALU_DIV_K: 4294967295 / 4294967295 = 1",
3212 		.u.insns_int = {
3213 			BPF_LD_IMM64(R0, 4294967295U),
3214 			BPF_ALU32_IMM(BPF_DIV, R0, 4294967295U),
3215 			BPF_EXIT_INSN(),
3216 		},
3217 		INTERNAL,
3218 		{ },
3219 		{ { 0, 1 } },
3220 	},
3221 	{
3222 		"ALU_DIV_K: 0xffffffffffffffff / (-1) = 0x1",
3223 		.u.insns_int = {
3224 			BPF_LD_IMM64(R2, 0xffffffffffffffffLL),
3225 			BPF_LD_IMM64(R3, 0x1UL),
3226 			BPF_ALU32_IMM(BPF_DIV, R2, 0xffffffff),
3227 			BPF_JMP_REG(BPF_JEQ, R2, R3, 2),
3228 			BPF_MOV32_IMM(R0, 2),
3229 			BPF_EXIT_INSN(),
3230 			BPF_MOV32_IMM(R0, 1),
3231 			BPF_EXIT_INSN(),
3232 		},
3233 		INTERNAL,
3234 		{ },
3235 		{ { 0, 0x1 } },
3236 	},
3237 	{
3238 		"ALU64_DIV_K: 6 / 2 = 3",
3239 		.u.insns_int = {
3240 			BPF_LD_IMM64(R0, 6),
3241 			BPF_ALU64_IMM(BPF_DIV, R0, 2),
3242 			BPF_EXIT_INSN(),
3243 		},
3244 		INTERNAL,
3245 		{ },
3246 		{ { 0, 3 } },
3247 	},
3248 	{
3249 		"ALU64_DIV_K: 3 / 1 = 3",
3250 		.u.insns_int = {
3251 			BPF_LD_IMM64(R0, 3),
3252 			BPF_ALU64_IMM(BPF_DIV, R0, 1),
3253 			BPF_EXIT_INSN(),
3254 		},
3255 		INTERNAL,
3256 		{ },
3257 		{ { 0, 3 } },
3258 	},
3259 	{
3260 		"ALU64_DIV_K: 2147483647 / 2147483647 = 1",
3261 		.u.insns_int = {
3262 			BPF_LD_IMM64(R0, 2147483647),
3263 			BPF_ALU64_IMM(BPF_DIV, R0, 2147483647),
3264 			BPF_EXIT_INSN(),
3265 		},
3266 		INTERNAL,
3267 		{ },
3268 		{ { 0, 1 } },
3269 	},
3270 	{
3271 		"ALU64_DIV_K: 0xffffffffffffffff / (-1) = 0x0000000000000001",
3272 		.u.insns_int = {
3273 			BPF_LD_IMM64(R2, 0xffffffffffffffffLL),
3274 			BPF_LD_IMM64(R3, 0x0000000000000001LL),
3275 			BPF_ALU64_IMM(BPF_DIV, R2, 0xffffffff),
3276 			BPF_JMP_REG(BPF_JEQ, R2, R3, 2),
3277 			BPF_MOV32_IMM(R0, 2),
3278 			BPF_EXIT_INSN(),
3279 			BPF_MOV32_IMM(R0, 1),
3280 			BPF_EXIT_INSN(),
3281 		},
3282 		INTERNAL,
3283 		{ },
3284 		{ { 0, 0x1 } },
3285 	},
3286 	/* BPF_ALU | BPF_MOD | BPF_X */
3287 	{
3288 		"ALU_MOD_X: 3 % 2 = 1",
3289 		.u.insns_int = {
3290 			BPF_LD_IMM64(R0, 3),
3291 			BPF_ALU32_IMM(BPF_MOV, R1, 2),
3292 			BPF_ALU32_REG(BPF_MOD, R0, R1),
3293 			BPF_EXIT_INSN(),
3294 		},
3295 		INTERNAL,
3296 		{ },
3297 		{ { 0, 1 } },
3298 	},
3299 	{
3300 		"ALU_MOD_X: 4294967295 % 4294967293 = 2",
3301 		.u.insns_int = {
3302 			BPF_LD_IMM64(R0, 4294967295U),
3303 			BPF_ALU32_IMM(BPF_MOV, R1, 4294967293U),
3304 			BPF_ALU32_REG(BPF_MOD, R0, R1),
3305 			BPF_EXIT_INSN(),
3306 		},
3307 		INTERNAL,
3308 		{ },
3309 		{ { 0, 2 } },
3310 	},
3311 	{
3312 		"ALU64_MOD_X: 3 % 2 = 1",
3313 		.u.insns_int = {
3314 			BPF_LD_IMM64(R0, 3),
3315 			BPF_ALU32_IMM(BPF_MOV, R1, 2),
3316 			BPF_ALU64_REG(BPF_MOD, R0, R1),
3317 			BPF_EXIT_INSN(),
3318 		},
3319 		INTERNAL,
3320 		{ },
3321 		{ { 0, 1 } },
3322 	},
3323 	{
3324 		"ALU64_MOD_X: 2147483647 % 2147483645 = 2",
3325 		.u.insns_int = {
3326 			BPF_LD_IMM64(R0, 2147483647),
3327 			BPF_ALU32_IMM(BPF_MOV, R1, 2147483645),
3328 			BPF_ALU64_REG(BPF_MOD, R0, R1),
3329 			BPF_EXIT_INSN(),
3330 		},
3331 		INTERNAL,
3332 		{ },
3333 		{ { 0, 2 } },
3334 	},
3335 	/* BPF_ALU | BPF_MOD | BPF_K */
3336 	{
3337 		"ALU_MOD_K: 3 % 2 = 1",
3338 		.u.insns_int = {
3339 			BPF_LD_IMM64(R0, 3),
3340 			BPF_ALU32_IMM(BPF_MOD, R0, 2),
3341 			BPF_EXIT_INSN(),
3342 		},
3343 		INTERNAL,
3344 		{ },
3345 		{ { 0, 1 } },
3346 	},
3347 	{
3348 		"ALU_MOD_K: 3 % 1 = 0",
3349 		.u.insns_int = {
3350 			BPF_LD_IMM64(R0, 3),
3351 			BPF_ALU32_IMM(BPF_MOD, R0, 1),
3352 			BPF_EXIT_INSN(),
3353 		},
3354 		INTERNAL,
3355 		{ },
3356 		{ { 0, 0 } },
3357 	},
3358 	{
3359 		"ALU_MOD_K: 4294967295 % 4294967293 = 2",
3360 		.u.insns_int = {
3361 			BPF_LD_IMM64(R0, 4294967295U),
3362 			BPF_ALU32_IMM(BPF_MOD, R0, 4294967293U),
3363 			BPF_EXIT_INSN(),
3364 		},
3365 		INTERNAL,
3366 		{ },
3367 		{ { 0, 2 } },
3368 	},
3369 	{
3370 		"ALU64_MOD_K: 3 % 2 = 1",
3371 		.u.insns_int = {
3372 			BPF_LD_IMM64(R0, 3),
3373 			BPF_ALU64_IMM(BPF_MOD, R0, 2),
3374 			BPF_EXIT_INSN(),
3375 		},
3376 		INTERNAL,
3377 		{ },
3378 		{ { 0, 1 } },
3379 	},
3380 	{
3381 		"ALU64_MOD_K: 3 % 1 = 0",
3382 		.u.insns_int = {
3383 			BPF_LD_IMM64(R0, 3),
3384 			BPF_ALU64_IMM(BPF_MOD, R0, 1),
3385 			BPF_EXIT_INSN(),
3386 		},
3387 		INTERNAL,
3388 		{ },
3389 		{ { 0, 0 } },
3390 	},
3391 	{
3392 		"ALU64_MOD_K: 2147483647 % 2147483645 = 2",
3393 		.u.insns_int = {
3394 			BPF_LD_IMM64(R0, 2147483647),
3395 			BPF_ALU64_IMM(BPF_MOD, R0, 2147483645),
3396 			BPF_EXIT_INSN(),
3397 		},
3398 		INTERNAL,
3399 		{ },
3400 		{ { 0, 2 } },
3401 	},
3402 	/* BPF_ALU | BPF_AND | BPF_X */
3403 	{
3404 		"ALU_AND_X: 3 & 2 = 2",
3405 		.u.insns_int = {
3406 			BPF_LD_IMM64(R0, 3),
3407 			BPF_ALU32_IMM(BPF_MOV, R1, 2),
3408 			BPF_ALU32_REG(BPF_AND, R0, R1),
3409 			BPF_EXIT_INSN(),
3410 		},
3411 		INTERNAL,
3412 		{ },
3413 		{ { 0, 2 } },
3414 	},
3415 	{
3416 		"ALU_AND_X: 0xffffffff & 0xffffffff = 0xffffffff",
3417 		.u.insns_int = {
3418 			BPF_LD_IMM64(R0, 0xffffffff),
3419 			BPF_ALU32_IMM(BPF_MOV, R1, 0xffffffff),
3420 			BPF_ALU32_REG(BPF_AND, R0, R1),
3421 			BPF_EXIT_INSN(),
3422 		},
3423 		INTERNAL,
3424 		{ },
3425 		{ { 0, 0xffffffff } },
3426 	},
3427 	{
3428 		"ALU64_AND_X: 3 & 2 = 2",
3429 		.u.insns_int = {
3430 			BPF_LD_IMM64(R0, 3),
3431 			BPF_ALU32_IMM(BPF_MOV, R1, 2),
3432 			BPF_ALU64_REG(BPF_AND, R0, R1),
3433 			BPF_EXIT_INSN(),
3434 		},
3435 		INTERNAL,
3436 		{ },
3437 		{ { 0, 2 } },
3438 	},
3439 	{
3440 		"ALU64_AND_X: 0xffffffff & 0xffffffff = 0xffffffff",
3441 		.u.insns_int = {
3442 			BPF_LD_IMM64(R0, 0xffffffff),
3443 			BPF_ALU32_IMM(BPF_MOV, R1, 0xffffffff),
3444 			BPF_ALU64_REG(BPF_AND, R0, R1),
3445 			BPF_EXIT_INSN(),
3446 		},
3447 		INTERNAL,
3448 		{ },
3449 		{ { 0, 0xffffffff } },
3450 	},
3451 	/* BPF_ALU | BPF_AND | BPF_K */
3452 	{
3453 		"ALU_AND_K: 3 & 2 = 2",
3454 		.u.insns_int = {
3455 			BPF_LD_IMM64(R0, 3),
3456 			BPF_ALU32_IMM(BPF_AND, R0, 2),
3457 			BPF_EXIT_INSN(),
3458 		},
3459 		INTERNAL,
3460 		{ },
3461 		{ { 0, 2 } },
3462 	},
3463 	{
3464 		"ALU_AND_K: 0xffffffff & 0xffffffff = 0xffffffff",
3465 		.u.insns_int = {
3466 			BPF_LD_IMM64(R0, 0xffffffff),
3467 			BPF_ALU32_IMM(BPF_AND, R0, 0xffffffff),
3468 			BPF_EXIT_INSN(),
3469 		},
3470 		INTERNAL,
3471 		{ },
3472 		{ { 0, 0xffffffff } },
3473 	},
3474 	{
3475 		"ALU64_AND_K: 3 & 2 = 2",
3476 		.u.insns_int = {
3477 			BPF_LD_IMM64(R0, 3),
3478 			BPF_ALU64_IMM(BPF_AND, R0, 2),
3479 			BPF_EXIT_INSN(),
3480 		},
3481 		INTERNAL,
3482 		{ },
3483 		{ { 0, 2 } },
3484 	},
3485 	{
3486 		"ALU64_AND_K: 0xffffffff & 0xffffffff = 0xffffffff",
3487 		.u.insns_int = {
3488 			BPF_LD_IMM64(R0, 0xffffffff),
3489 			BPF_ALU64_IMM(BPF_AND, R0, 0xffffffff),
3490 			BPF_EXIT_INSN(),
3491 		},
3492 		INTERNAL,
3493 		{ },
3494 		{ { 0, 0xffffffff } },
3495 	},
3496 	{
3497 		"ALU64_AND_K: 0x0000ffffffff0000 & 0x0 = 0x0000ffff00000000",
3498 		.u.insns_int = {
3499 			BPF_LD_IMM64(R2, 0x0000ffffffff0000LL),
3500 			BPF_LD_IMM64(R3, 0x0000000000000000LL),
3501 			BPF_ALU64_IMM(BPF_AND, R2, 0x0),
3502 			BPF_JMP_REG(BPF_JEQ, R2, R3, 2),
3503 			BPF_MOV32_IMM(R0, 2),
3504 			BPF_EXIT_INSN(),
3505 			BPF_MOV32_IMM(R0, 1),
3506 			BPF_EXIT_INSN(),
3507 		},
3508 		INTERNAL,
3509 		{ },
3510 		{ { 0, 0x1 } },
3511 	},
3512 	{
3513 		"ALU64_AND_K: 0x0000ffffffff0000 & -1 = 0x0000ffffffffffff",
3514 		.u.insns_int = {
3515 			BPF_LD_IMM64(R2, 0x0000ffffffff0000LL),
3516 			BPF_LD_IMM64(R3, 0x0000ffffffff0000LL),
3517 			BPF_ALU64_IMM(BPF_AND, R2, 0xffffffff),
3518 			BPF_JMP_REG(BPF_JEQ, R2, R3, 2),
3519 			BPF_MOV32_IMM(R0, 2),
3520 			BPF_EXIT_INSN(),
3521 			BPF_MOV32_IMM(R0, 1),
3522 			BPF_EXIT_INSN(),
3523 		},
3524 		INTERNAL,
3525 		{ },
3526 		{ { 0, 0x1 } },
3527 	},
3528 	{
3529 		"ALU64_AND_K: 0xffffffffffffffff & -1 = 0xffffffffffffffff",
3530 		.u.insns_int = {
3531 			BPF_LD_IMM64(R2, 0xffffffffffffffffLL),
3532 			BPF_LD_IMM64(R3, 0xffffffffffffffffLL),
3533 			BPF_ALU64_IMM(BPF_AND, R2, 0xffffffff),
3534 			BPF_JMP_REG(BPF_JEQ, R2, R3, 2),
3535 			BPF_MOV32_IMM(R0, 2),
3536 			BPF_EXIT_INSN(),
3537 			BPF_MOV32_IMM(R0, 1),
3538 			BPF_EXIT_INSN(),
3539 		},
3540 		INTERNAL,
3541 		{ },
3542 		{ { 0, 0x1 } },
3543 	},
3544 	/* BPF_ALU | BPF_OR | BPF_X */
3545 	{
3546 		"ALU_OR_X: 1 | 2 = 3",
3547 		.u.insns_int = {
3548 			BPF_LD_IMM64(R0, 1),
3549 			BPF_ALU32_IMM(BPF_MOV, R1, 2),
3550 			BPF_ALU32_REG(BPF_OR, R0, R1),
3551 			BPF_EXIT_INSN(),
3552 		},
3553 		INTERNAL,
3554 		{ },
3555 		{ { 0, 3 } },
3556 	},
3557 	{
3558 		"ALU_OR_X: 0x0 | 0xffffffff = 0xffffffff",
3559 		.u.insns_int = {
3560 			BPF_LD_IMM64(R0, 0),
3561 			BPF_ALU32_IMM(BPF_MOV, R1, 0xffffffff),
3562 			BPF_ALU32_REG(BPF_OR, R0, R1),
3563 			BPF_EXIT_INSN(),
3564 		},
3565 		INTERNAL,
3566 		{ },
3567 		{ { 0, 0xffffffff } },
3568 	},
3569 	{
3570 		"ALU64_OR_X: 1 | 2 = 3",
3571 		.u.insns_int = {
3572 			BPF_LD_IMM64(R0, 1),
3573 			BPF_ALU32_IMM(BPF_MOV, R1, 2),
3574 			BPF_ALU64_REG(BPF_OR, R0, R1),
3575 			BPF_EXIT_INSN(),
3576 		},
3577 		INTERNAL,
3578 		{ },
3579 		{ { 0, 3 } },
3580 	},
3581 	{
3582 		"ALU64_OR_X: 0 | 0xffffffff = 0xffffffff",
3583 		.u.insns_int = {
3584 			BPF_LD_IMM64(R0, 0),
3585 			BPF_ALU32_IMM(BPF_MOV, R1, 0xffffffff),
3586 			BPF_ALU64_REG(BPF_OR, R0, R1),
3587 			BPF_EXIT_INSN(),
3588 		},
3589 		INTERNAL,
3590 		{ },
3591 		{ { 0, 0xffffffff } },
3592 	},
3593 	/* BPF_ALU | BPF_OR | BPF_K */
3594 	{
3595 		"ALU_OR_K: 1 | 2 = 3",
3596 		.u.insns_int = {
3597 			BPF_LD_IMM64(R0, 1),
3598 			BPF_ALU32_IMM(BPF_OR, R0, 2),
3599 			BPF_EXIT_INSN(),
3600 		},
3601 		INTERNAL,
3602 		{ },
3603 		{ { 0, 3 } },
3604 	},
3605 	{
3606 		"ALU_OR_K: 0 & 0xffffffff = 0xffffffff",
3607 		.u.insns_int = {
3608 			BPF_LD_IMM64(R0, 0),
3609 			BPF_ALU32_IMM(BPF_OR, R0, 0xffffffff),
3610 			BPF_EXIT_INSN(),
3611 		},
3612 		INTERNAL,
3613 		{ },
3614 		{ { 0, 0xffffffff } },
3615 	},
3616 	{
3617 		"ALU64_OR_K: 1 | 2 = 3",
3618 		.u.insns_int = {
3619 			BPF_LD_IMM64(R0, 1),
3620 			BPF_ALU64_IMM(BPF_OR, R0, 2),
3621 			BPF_EXIT_INSN(),
3622 		},
3623 		INTERNAL,
3624 		{ },
3625 		{ { 0, 3 } },
3626 	},
3627 	{
3628 		"ALU64_OR_K: 0 & 0xffffffff = 0xffffffff",
3629 		.u.insns_int = {
3630 			BPF_LD_IMM64(R0, 0),
3631 			BPF_ALU64_IMM(BPF_OR, R0, 0xffffffff),
3632 			BPF_EXIT_INSN(),
3633 		},
3634 		INTERNAL,
3635 		{ },
3636 		{ { 0, 0xffffffff } },
3637 	},
3638 	{
3639 		"ALU64_OR_K: 0x0000ffffffff0000 | 0x0 = 0x0000ffff00000000",
3640 		.u.insns_int = {
3641 			BPF_LD_IMM64(R2, 0x0000ffffffff0000LL),
3642 			BPF_LD_IMM64(R3, 0x0000ffffffff0000LL),
3643 			BPF_ALU64_IMM(BPF_OR, R2, 0x0),
3644 			BPF_JMP_REG(BPF_JEQ, R2, R3, 2),
3645 			BPF_MOV32_IMM(R0, 2),
3646 			BPF_EXIT_INSN(),
3647 			BPF_MOV32_IMM(R0, 1),
3648 			BPF_EXIT_INSN(),
3649 		},
3650 		INTERNAL,
3651 		{ },
3652 		{ { 0, 0x1 } },
3653 	},
3654 	{
3655 		"ALU64_OR_K: 0x0000ffffffff0000 | -1 = 0xffffffffffffffff",
3656 		.u.insns_int = {
3657 			BPF_LD_IMM64(R2, 0x0000ffffffff0000LL),
3658 			BPF_LD_IMM64(R3, 0xffffffffffffffffLL),
3659 			BPF_ALU64_IMM(BPF_OR, R2, 0xffffffff),
3660 			BPF_JMP_REG(BPF_JEQ, R2, R3, 2),
3661 			BPF_MOV32_IMM(R0, 2),
3662 			BPF_EXIT_INSN(),
3663 			BPF_MOV32_IMM(R0, 1),
3664 			BPF_EXIT_INSN(),
3665 		},
3666 		INTERNAL,
3667 		{ },
3668 		{ { 0, 0x1 } },
3669 	},
3670 	{
3671 		"ALU64_OR_K: 0x000000000000000 | -1 = 0xffffffffffffffff",
3672 		.u.insns_int = {
3673 			BPF_LD_IMM64(R2, 0x0000000000000000LL),
3674 			BPF_LD_IMM64(R3, 0xffffffffffffffffLL),
3675 			BPF_ALU64_IMM(BPF_OR, R2, 0xffffffff),
3676 			BPF_JMP_REG(BPF_JEQ, R2, R3, 2),
3677 			BPF_MOV32_IMM(R0, 2),
3678 			BPF_EXIT_INSN(),
3679 			BPF_MOV32_IMM(R0, 1),
3680 			BPF_EXIT_INSN(),
3681 		},
3682 		INTERNAL,
3683 		{ },
3684 		{ { 0, 0x1 } },
3685 	},
3686 	/* BPF_ALU | BPF_XOR | BPF_X */
3687 	{
3688 		"ALU_XOR_X: 5 ^ 6 = 3",
3689 		.u.insns_int = {
3690 			BPF_LD_IMM64(R0, 5),
3691 			BPF_ALU32_IMM(BPF_MOV, R1, 6),
3692 			BPF_ALU32_REG(BPF_XOR, R0, R1),
3693 			BPF_EXIT_INSN(),
3694 		},
3695 		INTERNAL,
3696 		{ },
3697 		{ { 0, 3 } },
3698 	},
3699 	{
3700 		"ALU_XOR_X: 0x1 ^ 0xffffffff = 0xfffffffe",
3701 		.u.insns_int = {
3702 			BPF_LD_IMM64(R0, 1),
3703 			BPF_ALU32_IMM(BPF_MOV, R1, 0xffffffff),
3704 			BPF_ALU32_REG(BPF_XOR, R0, R1),
3705 			BPF_EXIT_INSN(),
3706 		},
3707 		INTERNAL,
3708 		{ },
3709 		{ { 0, 0xfffffffe } },
3710 	},
3711 	{
3712 		"ALU64_XOR_X: 5 ^ 6 = 3",
3713 		.u.insns_int = {
3714 			BPF_LD_IMM64(R0, 5),
3715 			BPF_ALU32_IMM(BPF_MOV, R1, 6),
3716 			BPF_ALU64_REG(BPF_XOR, R0, R1),
3717 			BPF_EXIT_INSN(),
3718 		},
3719 		INTERNAL,
3720 		{ },
3721 		{ { 0, 3 } },
3722 	},
3723 	{
3724 		"ALU64_XOR_X: 1 ^ 0xffffffff = 0xfffffffe",
3725 		.u.insns_int = {
3726 			BPF_LD_IMM64(R0, 1),
3727 			BPF_ALU32_IMM(BPF_MOV, R1, 0xffffffff),
3728 			BPF_ALU64_REG(BPF_XOR, R0, R1),
3729 			BPF_EXIT_INSN(),
3730 		},
3731 		INTERNAL,
3732 		{ },
3733 		{ { 0, 0xfffffffe } },
3734 	},
3735 	/* BPF_ALU | BPF_XOR | BPF_K */
3736 	{
3737 		"ALU_XOR_K: 5 ^ 6 = 3",
3738 		.u.insns_int = {
3739 			BPF_LD_IMM64(R0, 5),
3740 			BPF_ALU32_IMM(BPF_XOR, R0, 6),
3741 			BPF_EXIT_INSN(),
3742 		},
3743 		INTERNAL,
3744 		{ },
3745 		{ { 0, 3 } },
3746 	},
3747 	{
3748 		"ALU_XOR_K: 1 ^ 0xffffffff = 0xfffffffe",
3749 		.u.insns_int = {
3750 			BPF_LD_IMM64(R0, 1),
3751 			BPF_ALU32_IMM(BPF_XOR, R0, 0xffffffff),
3752 			BPF_EXIT_INSN(),
3753 		},
3754 		INTERNAL,
3755 		{ },
3756 		{ { 0, 0xfffffffe } },
3757 	},
3758 	{
3759 		"ALU64_XOR_K: 5 ^ 6 = 3",
3760 		.u.insns_int = {
3761 			BPF_LD_IMM64(R0, 5),
3762 			BPF_ALU64_IMM(BPF_XOR, R0, 6),
3763 			BPF_EXIT_INSN(),
3764 		},
3765 		INTERNAL,
3766 		{ },
3767 		{ { 0, 3 } },
3768 	},
3769 	{
3770 		"ALU64_XOR_K: 1 & 0xffffffff = 0xfffffffe",
3771 		.u.insns_int = {
3772 			BPF_LD_IMM64(R0, 1),
3773 			BPF_ALU64_IMM(BPF_XOR, R0, 0xffffffff),
3774 			BPF_EXIT_INSN(),
3775 		},
3776 		INTERNAL,
3777 		{ },
3778 		{ { 0, 0xfffffffe } },
3779 	},
3780 	{
3781 		"ALU64_XOR_K: 0x0000ffffffff0000 ^ 0x0 = 0x0000ffffffff0000",
3782 		.u.insns_int = {
3783 			BPF_LD_IMM64(R2, 0x0000ffffffff0000LL),
3784 			BPF_LD_IMM64(R3, 0x0000ffffffff0000LL),
3785 			BPF_ALU64_IMM(BPF_XOR, R2, 0x0),
3786 			BPF_JMP_REG(BPF_JEQ, R2, R3, 2),
3787 			BPF_MOV32_IMM(R0, 2),
3788 			BPF_EXIT_INSN(),
3789 			BPF_MOV32_IMM(R0, 1),
3790 			BPF_EXIT_INSN(),
3791 		},
3792 		INTERNAL,
3793 		{ },
3794 		{ { 0, 0x1 } },
3795 	},
3796 	{
3797 		"ALU64_XOR_K: 0x0000ffffffff0000 ^ -1 = 0xffff00000000ffff",
3798 		.u.insns_int = {
3799 			BPF_LD_IMM64(R2, 0x0000ffffffff0000LL),
3800 			BPF_LD_IMM64(R3, 0xffff00000000ffffLL),
3801 			BPF_ALU64_IMM(BPF_XOR, R2, 0xffffffff),
3802 			BPF_JMP_REG(BPF_JEQ, R2, R3, 2),
3803 			BPF_MOV32_IMM(R0, 2),
3804 			BPF_EXIT_INSN(),
3805 			BPF_MOV32_IMM(R0, 1),
3806 			BPF_EXIT_INSN(),
3807 		},
3808 		INTERNAL,
3809 		{ },
3810 		{ { 0, 0x1 } },
3811 	},
3812 	{
3813 		"ALU64_XOR_K: 0x000000000000000 ^ -1 = 0xffffffffffffffff",
3814 		.u.insns_int = {
3815 			BPF_LD_IMM64(R2, 0x0000000000000000LL),
3816 			BPF_LD_IMM64(R3, 0xffffffffffffffffLL),
3817 			BPF_ALU64_IMM(BPF_XOR, R2, 0xffffffff),
3818 			BPF_JMP_REG(BPF_JEQ, R2, R3, 2),
3819 			BPF_MOV32_IMM(R0, 2),
3820 			BPF_EXIT_INSN(),
3821 			BPF_MOV32_IMM(R0, 1),
3822 			BPF_EXIT_INSN(),
3823 		},
3824 		INTERNAL,
3825 		{ },
3826 		{ { 0, 0x1 } },
3827 	},
3828 	/* BPF_ALU | BPF_LSH | BPF_X */
3829 	{
3830 		"ALU_LSH_X: 1 << 1 = 2",
3831 		.u.insns_int = {
3832 			BPF_LD_IMM64(R0, 1),
3833 			BPF_ALU32_IMM(BPF_MOV, R1, 1),
3834 			BPF_ALU32_REG(BPF_LSH, R0, R1),
3835 			BPF_EXIT_INSN(),
3836 		},
3837 		INTERNAL,
3838 		{ },
3839 		{ { 0, 2 } },
3840 	},
3841 	{
3842 		"ALU_LSH_X: 1 << 31 = 0x80000000",
3843 		.u.insns_int = {
3844 			BPF_LD_IMM64(R0, 1),
3845 			BPF_ALU32_IMM(BPF_MOV, R1, 31),
3846 			BPF_ALU32_REG(BPF_LSH, R0, R1),
3847 			BPF_EXIT_INSN(),
3848 		},
3849 		INTERNAL,
3850 		{ },
3851 		{ { 0, 0x80000000 } },
3852 	},
3853 	{
3854 		"ALU64_LSH_X: 1 << 1 = 2",
3855 		.u.insns_int = {
3856 			BPF_LD_IMM64(R0, 1),
3857 			BPF_ALU32_IMM(BPF_MOV, R1, 1),
3858 			BPF_ALU64_REG(BPF_LSH, R0, R1),
3859 			BPF_EXIT_INSN(),
3860 		},
3861 		INTERNAL,
3862 		{ },
3863 		{ { 0, 2 } },
3864 	},
3865 	{
3866 		"ALU64_LSH_X: 1 << 31 = 0x80000000",
3867 		.u.insns_int = {
3868 			BPF_LD_IMM64(R0, 1),
3869 			BPF_ALU32_IMM(BPF_MOV, R1, 31),
3870 			BPF_ALU64_REG(BPF_LSH, R0, R1),
3871 			BPF_EXIT_INSN(),
3872 		},
3873 		INTERNAL,
3874 		{ },
3875 		{ { 0, 0x80000000 } },
3876 	},
3877 	/* BPF_ALU | BPF_LSH | BPF_K */
3878 	{
3879 		"ALU_LSH_K: 1 << 1 = 2",
3880 		.u.insns_int = {
3881 			BPF_LD_IMM64(R0, 1),
3882 			BPF_ALU32_IMM(BPF_LSH, R0, 1),
3883 			BPF_EXIT_INSN(),
3884 		},
3885 		INTERNAL,
3886 		{ },
3887 		{ { 0, 2 } },
3888 	},
3889 	{
3890 		"ALU_LSH_K: 1 << 31 = 0x80000000",
3891 		.u.insns_int = {
3892 			BPF_LD_IMM64(R0, 1),
3893 			BPF_ALU32_IMM(BPF_LSH, R0, 31),
3894 			BPF_EXIT_INSN(),
3895 		},
3896 		INTERNAL,
3897 		{ },
3898 		{ { 0, 0x80000000 } },
3899 	},
3900 	{
3901 		"ALU64_LSH_K: 1 << 1 = 2",
3902 		.u.insns_int = {
3903 			BPF_LD_IMM64(R0, 1),
3904 			BPF_ALU64_IMM(BPF_LSH, R0, 1),
3905 			BPF_EXIT_INSN(),
3906 		},
3907 		INTERNAL,
3908 		{ },
3909 		{ { 0, 2 } },
3910 	},
3911 	{
3912 		"ALU64_LSH_K: 1 << 31 = 0x80000000",
3913 		.u.insns_int = {
3914 			BPF_LD_IMM64(R0, 1),
3915 			BPF_ALU64_IMM(BPF_LSH, R0, 31),
3916 			BPF_EXIT_INSN(),
3917 		},
3918 		INTERNAL,
3919 		{ },
3920 		{ { 0, 0x80000000 } },
3921 	},
3922 	/* BPF_ALU | BPF_RSH | BPF_X */
3923 	{
3924 		"ALU_RSH_X: 2 >> 1 = 1",
3925 		.u.insns_int = {
3926 			BPF_LD_IMM64(R0, 2),
3927 			BPF_ALU32_IMM(BPF_MOV, R1, 1),
3928 			BPF_ALU32_REG(BPF_RSH, R0, R1),
3929 			BPF_EXIT_INSN(),
3930 		},
3931 		INTERNAL,
3932 		{ },
3933 		{ { 0, 1 } },
3934 	},
3935 	{
3936 		"ALU_RSH_X: 0x80000000 >> 31 = 1",
3937 		.u.insns_int = {
3938 			BPF_LD_IMM64(R0, 0x80000000),
3939 			BPF_ALU32_IMM(BPF_MOV, R1, 31),
3940 			BPF_ALU32_REG(BPF_RSH, R0, R1),
3941 			BPF_EXIT_INSN(),
3942 		},
3943 		INTERNAL,
3944 		{ },
3945 		{ { 0, 1 } },
3946 	},
3947 	{
3948 		"ALU64_RSH_X: 2 >> 1 = 1",
3949 		.u.insns_int = {
3950 			BPF_LD_IMM64(R0, 2),
3951 			BPF_ALU32_IMM(BPF_MOV, R1, 1),
3952 			BPF_ALU64_REG(BPF_RSH, R0, R1),
3953 			BPF_EXIT_INSN(),
3954 		},
3955 		INTERNAL,
3956 		{ },
3957 		{ { 0, 1 } },
3958 	},
3959 	{
3960 		"ALU64_RSH_X: 0x80000000 >> 31 = 1",
3961 		.u.insns_int = {
3962 			BPF_LD_IMM64(R0, 0x80000000),
3963 			BPF_ALU32_IMM(BPF_MOV, R1, 31),
3964 			BPF_ALU64_REG(BPF_RSH, R0, R1),
3965 			BPF_EXIT_INSN(),
3966 		},
3967 		INTERNAL,
3968 		{ },
3969 		{ { 0, 1 } },
3970 	},
3971 	/* BPF_ALU | BPF_RSH | BPF_K */
3972 	{
3973 		"ALU_RSH_K: 2 >> 1 = 1",
3974 		.u.insns_int = {
3975 			BPF_LD_IMM64(R0, 2),
3976 			BPF_ALU32_IMM(BPF_RSH, R0, 1),
3977 			BPF_EXIT_INSN(),
3978 		},
3979 		INTERNAL,
3980 		{ },
3981 		{ { 0, 1 } },
3982 	},
3983 	{
3984 		"ALU_RSH_K: 0x80000000 >> 31 = 1",
3985 		.u.insns_int = {
3986 			BPF_LD_IMM64(R0, 0x80000000),
3987 			BPF_ALU32_IMM(BPF_RSH, R0, 31),
3988 			BPF_EXIT_INSN(),
3989 		},
3990 		INTERNAL,
3991 		{ },
3992 		{ { 0, 1 } },
3993 	},
3994 	{
3995 		"ALU64_RSH_K: 2 >> 1 = 1",
3996 		.u.insns_int = {
3997 			BPF_LD_IMM64(R0, 2),
3998 			BPF_ALU64_IMM(BPF_RSH, R0, 1),
3999 			BPF_EXIT_INSN(),
4000 		},
4001 		INTERNAL,
4002 		{ },
4003 		{ { 0, 1 } },
4004 	},
4005 	{
4006 		"ALU64_RSH_K: 0x80000000 >> 31 = 1",
4007 		.u.insns_int = {
4008 			BPF_LD_IMM64(R0, 0x80000000),
4009 			BPF_ALU64_IMM(BPF_RSH, R0, 31),
4010 			BPF_EXIT_INSN(),
4011 		},
4012 		INTERNAL,
4013 		{ },
4014 		{ { 0, 1 } },
4015 	},
4016 	/* BPF_ALU | BPF_ARSH | BPF_X */
4017 	{
4018 		"ALU_ARSH_X: 0xff00ff0000000000 >> 40 = 0xffffffffffff00ff",
4019 		.u.insns_int = {
4020 			BPF_LD_IMM64(R0, 0xff00ff0000000000LL),
4021 			BPF_ALU32_IMM(BPF_MOV, R1, 40),
4022 			BPF_ALU64_REG(BPF_ARSH, R0, R1),
4023 			BPF_EXIT_INSN(),
4024 		},
4025 		INTERNAL,
4026 		{ },
4027 		{ { 0, 0xffff00ff } },
4028 	},
4029 	/* BPF_ALU | BPF_ARSH | BPF_K */
4030 	{
4031 		"ALU_ARSH_K: 0xff00ff0000000000 >> 40 = 0xffffffffffff00ff",
4032 		.u.insns_int = {
4033 			BPF_LD_IMM64(R0, 0xff00ff0000000000LL),
4034 			BPF_ALU64_IMM(BPF_ARSH, R0, 40),
4035 			BPF_EXIT_INSN(),
4036 		},
4037 		INTERNAL,
4038 		{ },
4039 		{ { 0, 0xffff00ff } },
4040 	},
4041 	/* BPF_ALU | BPF_NEG */
4042 	{
4043 		"ALU_NEG: -(3) = -3",
4044 		.u.insns_int = {
4045 			BPF_ALU32_IMM(BPF_MOV, R0, 3),
4046 			BPF_ALU32_IMM(BPF_NEG, R0, 0),
4047 			BPF_EXIT_INSN(),
4048 		},
4049 		INTERNAL,
4050 		{ },
4051 		{ { 0, -3 } },
4052 	},
4053 	{
4054 		"ALU_NEG: -(-3) = 3",
4055 		.u.insns_int = {
4056 			BPF_ALU32_IMM(BPF_MOV, R0, -3),
4057 			BPF_ALU32_IMM(BPF_NEG, R0, 0),
4058 			BPF_EXIT_INSN(),
4059 		},
4060 		INTERNAL,
4061 		{ },
4062 		{ { 0, 3 } },
4063 	},
4064 	{
4065 		"ALU64_NEG: -(3) = -3",
4066 		.u.insns_int = {
4067 			BPF_LD_IMM64(R0, 3),
4068 			BPF_ALU64_IMM(BPF_NEG, R0, 0),
4069 			BPF_EXIT_INSN(),
4070 		},
4071 		INTERNAL,
4072 		{ },
4073 		{ { 0, -3 } },
4074 	},
4075 	{
4076 		"ALU64_NEG: -(-3) = 3",
4077 		.u.insns_int = {
4078 			BPF_LD_IMM64(R0, -3),
4079 			BPF_ALU64_IMM(BPF_NEG, R0, 0),
4080 			BPF_EXIT_INSN(),
4081 		},
4082 		INTERNAL,
4083 		{ },
4084 		{ { 0, 3 } },
4085 	},
4086 	/* BPF_ALU | BPF_END | BPF_FROM_BE */
4087 	{
4088 		"ALU_END_FROM_BE 16: 0x0123456789abcdef -> 0xcdef",
4089 		.u.insns_int = {
4090 			BPF_LD_IMM64(R0, 0x0123456789abcdefLL),
4091 			BPF_ENDIAN(BPF_FROM_BE, R0, 16),
4092 			BPF_EXIT_INSN(),
4093 		},
4094 		INTERNAL,
4095 		{ },
4096 		{ { 0,  cpu_to_be16(0xcdef) } },
4097 	},
4098 	{
4099 		"ALU_END_FROM_BE 32: 0x0123456789abcdef -> 0x89abcdef",
4100 		.u.insns_int = {
4101 			BPF_LD_IMM64(R0, 0x0123456789abcdefLL),
4102 			BPF_ENDIAN(BPF_FROM_BE, R0, 32),
4103 			BPF_ALU64_REG(BPF_MOV, R1, R0),
4104 			BPF_ALU64_IMM(BPF_RSH, R1, 32),
4105 			BPF_ALU32_REG(BPF_ADD, R0, R1), /* R1 = 0 */
4106 			BPF_EXIT_INSN(),
4107 		},
4108 		INTERNAL,
4109 		{ },
4110 		{ { 0, cpu_to_be32(0x89abcdef) } },
4111 	},
4112 	{
4113 		"ALU_END_FROM_BE 64: 0x0123456789abcdef -> 0x89abcdef",
4114 		.u.insns_int = {
4115 			BPF_LD_IMM64(R0, 0x0123456789abcdefLL),
4116 			BPF_ENDIAN(BPF_FROM_BE, R0, 64),
4117 			BPF_EXIT_INSN(),
4118 		},
4119 		INTERNAL,
4120 		{ },
4121 		{ { 0, (u32) cpu_to_be64(0x0123456789abcdefLL) } },
4122 	},
4123 	/* BPF_ALU | BPF_END | BPF_FROM_LE */
4124 	{
4125 		"ALU_END_FROM_LE 16: 0x0123456789abcdef -> 0xefcd",
4126 		.u.insns_int = {
4127 			BPF_LD_IMM64(R0, 0x0123456789abcdefLL),
4128 			BPF_ENDIAN(BPF_FROM_LE, R0, 16),
4129 			BPF_EXIT_INSN(),
4130 		},
4131 		INTERNAL,
4132 		{ },
4133 		{ { 0, cpu_to_le16(0xcdef) } },
4134 	},
4135 	{
4136 		"ALU_END_FROM_LE 32: 0x0123456789abcdef -> 0xefcdab89",
4137 		.u.insns_int = {
4138 			BPF_LD_IMM64(R0, 0x0123456789abcdefLL),
4139 			BPF_ENDIAN(BPF_FROM_LE, R0, 32),
4140 			BPF_ALU64_REG(BPF_MOV, R1, R0),
4141 			BPF_ALU64_IMM(BPF_RSH, R1, 32),
4142 			BPF_ALU32_REG(BPF_ADD, R0, R1), /* R1 = 0 */
4143 			BPF_EXIT_INSN(),
4144 		},
4145 		INTERNAL,
4146 		{ },
4147 		{ { 0, cpu_to_le32(0x89abcdef) } },
4148 	},
4149 	{
4150 		"ALU_END_FROM_LE 64: 0x0123456789abcdef -> 0x67452301",
4151 		.u.insns_int = {
4152 			BPF_LD_IMM64(R0, 0x0123456789abcdefLL),
4153 			BPF_ENDIAN(BPF_FROM_LE, R0, 64),
4154 			BPF_EXIT_INSN(),
4155 		},
4156 		INTERNAL,
4157 		{ },
4158 		{ { 0, (u32) cpu_to_le64(0x0123456789abcdefLL) } },
4159 	},
4160 	/* BPF_ST(X) | BPF_MEM | BPF_B/H/W/DW */
4161 	{
4162 		"ST_MEM_B: Store/Load byte: max negative",
4163 		.u.insns_int = {
4164 			BPF_ALU32_IMM(BPF_MOV, R0, 1),
4165 			BPF_ST_MEM(BPF_B, R10, -40, 0xff),
4166 			BPF_LDX_MEM(BPF_B, R0, R10, -40),
4167 			BPF_EXIT_INSN(),
4168 		},
4169 		INTERNAL,
4170 		{ },
4171 		{ { 0, 0xff } },
4172 	},
4173 	{
4174 		"ST_MEM_B: Store/Load byte: max positive",
4175 		.u.insns_int = {
4176 			BPF_ALU32_IMM(BPF_MOV, R0, 1),
4177 			BPF_ST_MEM(BPF_H, R10, -40, 0x7f),
4178 			BPF_LDX_MEM(BPF_H, R0, R10, -40),
4179 			BPF_EXIT_INSN(),
4180 		},
4181 		INTERNAL,
4182 		{ },
4183 		{ { 0, 0x7f } },
4184 	},
4185 	{
4186 		"STX_MEM_B: Store/Load byte: max negative",
4187 		.u.insns_int = {
4188 			BPF_LD_IMM64(R0, 0),
4189 			BPF_LD_IMM64(R1, 0xffLL),
4190 			BPF_STX_MEM(BPF_B, R10, R1, -40),
4191 			BPF_LDX_MEM(BPF_B, R0, R10, -40),
4192 			BPF_EXIT_INSN(),
4193 		},
4194 		INTERNAL,
4195 		{ },
4196 		{ { 0, 0xff } },
4197 	},
4198 	{
4199 		"ST_MEM_H: Store/Load half word: max negative",
4200 		.u.insns_int = {
4201 			BPF_ALU32_IMM(BPF_MOV, R0, 1),
4202 			BPF_ST_MEM(BPF_H, R10, -40, 0xffff),
4203 			BPF_LDX_MEM(BPF_H, R0, R10, -40),
4204 			BPF_EXIT_INSN(),
4205 		},
4206 		INTERNAL,
4207 		{ },
4208 		{ { 0, 0xffff } },
4209 	},
4210 	{
4211 		"ST_MEM_H: Store/Load half word: max positive",
4212 		.u.insns_int = {
4213 			BPF_ALU32_IMM(BPF_MOV, R0, 1),
4214 			BPF_ST_MEM(BPF_H, R10, -40, 0x7fff),
4215 			BPF_LDX_MEM(BPF_H, R0, R10, -40),
4216 			BPF_EXIT_INSN(),
4217 		},
4218 		INTERNAL,
4219 		{ },
4220 		{ { 0, 0x7fff } },
4221 	},
4222 	{
4223 		"STX_MEM_H: Store/Load half word: max negative",
4224 		.u.insns_int = {
4225 			BPF_LD_IMM64(R0, 0),
4226 			BPF_LD_IMM64(R1, 0xffffLL),
4227 			BPF_STX_MEM(BPF_H, R10, R1, -40),
4228 			BPF_LDX_MEM(BPF_H, R0, R10, -40),
4229 			BPF_EXIT_INSN(),
4230 		},
4231 		INTERNAL,
4232 		{ },
4233 		{ { 0, 0xffff } },
4234 	},
4235 	{
4236 		"ST_MEM_W: Store/Load word: max negative",
4237 		.u.insns_int = {
4238 			BPF_ALU32_IMM(BPF_MOV, R0, 1),
4239 			BPF_ST_MEM(BPF_W, R10, -40, 0xffffffff),
4240 			BPF_LDX_MEM(BPF_W, R0, R10, -40),
4241 			BPF_EXIT_INSN(),
4242 		},
4243 		INTERNAL,
4244 		{ },
4245 		{ { 0, 0xffffffff } },
4246 	},
4247 	{
4248 		"ST_MEM_W: Store/Load word: max positive",
4249 		.u.insns_int = {
4250 			BPF_ALU32_IMM(BPF_MOV, R0, 1),
4251 			BPF_ST_MEM(BPF_W, R10, -40, 0x7fffffff),
4252 			BPF_LDX_MEM(BPF_W, R0, R10, -40),
4253 			BPF_EXIT_INSN(),
4254 		},
4255 		INTERNAL,
4256 		{ },
4257 		{ { 0, 0x7fffffff } },
4258 	},
4259 	{
4260 		"STX_MEM_W: Store/Load word: max negative",
4261 		.u.insns_int = {
4262 			BPF_LD_IMM64(R0, 0),
4263 			BPF_LD_IMM64(R1, 0xffffffffLL),
4264 			BPF_STX_MEM(BPF_W, R10, R1, -40),
4265 			BPF_LDX_MEM(BPF_W, R0, R10, -40),
4266 			BPF_EXIT_INSN(),
4267 		},
4268 		INTERNAL,
4269 		{ },
4270 		{ { 0, 0xffffffff } },
4271 	},
4272 	{
4273 		"ST_MEM_DW: Store/Load double word: max negative",
4274 		.u.insns_int = {
4275 			BPF_ALU32_IMM(BPF_MOV, R0, 1),
4276 			BPF_ST_MEM(BPF_DW, R10, -40, 0xffffffff),
4277 			BPF_LDX_MEM(BPF_DW, R0, R10, -40),
4278 			BPF_EXIT_INSN(),
4279 		},
4280 		INTERNAL,
4281 		{ },
4282 		{ { 0, 0xffffffff } },
4283 	},
4284 	{
4285 		"ST_MEM_DW: Store/Load double word: max negative 2",
4286 		.u.insns_int = {
4287 			BPF_LD_IMM64(R2, 0xffff00000000ffffLL),
4288 			BPF_LD_IMM64(R3, 0xffffffffffffffffLL),
4289 			BPF_ST_MEM(BPF_DW, R10, -40, 0xffffffff),
4290 			BPF_LDX_MEM(BPF_DW, R2, R10, -40),
4291 			BPF_JMP_REG(BPF_JEQ, R2, R3, 2),
4292 			BPF_MOV32_IMM(R0, 2),
4293 			BPF_EXIT_INSN(),
4294 			BPF_MOV32_IMM(R0, 1),
4295 			BPF_EXIT_INSN(),
4296 		},
4297 		INTERNAL,
4298 		{ },
4299 		{ { 0, 0x1 } },
4300 	},
4301 	{
4302 		"ST_MEM_DW: Store/Load double word: max positive",
4303 		.u.insns_int = {
4304 			BPF_ALU32_IMM(BPF_MOV, R0, 1),
4305 			BPF_ST_MEM(BPF_DW, R10, -40, 0x7fffffff),
4306 			BPF_LDX_MEM(BPF_DW, R0, R10, -40),
4307 			BPF_EXIT_INSN(),
4308 		},
4309 		INTERNAL,
4310 		{ },
4311 		{ { 0, 0x7fffffff } },
4312 	},
4313 	{
4314 		"STX_MEM_DW: Store/Load double word: max negative",
4315 		.u.insns_int = {
4316 			BPF_LD_IMM64(R0, 0),
4317 			BPF_LD_IMM64(R1, 0xffffffffffffffffLL),
4318 			BPF_STX_MEM(BPF_W, R10, R1, -40),
4319 			BPF_LDX_MEM(BPF_W, R0, R10, -40),
4320 			BPF_EXIT_INSN(),
4321 		},
4322 		INTERNAL,
4323 		{ },
4324 		{ { 0, 0xffffffff } },
4325 	},
4326 	/* BPF_STX | BPF_XADD | BPF_W/DW */
4327 	{
4328 		"STX_XADD_W: Test: 0x12 + 0x10 = 0x22",
4329 		.u.insns_int = {
4330 			BPF_ALU32_IMM(BPF_MOV, R0, 0x12),
4331 			BPF_ST_MEM(BPF_W, R10, -40, 0x10),
4332 			BPF_STX_XADD(BPF_W, R10, R0, -40),
4333 			BPF_LDX_MEM(BPF_W, R0, R10, -40),
4334 			BPF_EXIT_INSN(),
4335 		},
4336 		INTERNAL,
4337 		{ },
4338 		{ { 0, 0x22 } },
4339 	},
4340 	{
4341 		"STX_XADD_W: Test side-effects, r10: 0x12 + 0x10 = 0x22",
4342 		.u.insns_int = {
4343 			BPF_ALU64_REG(BPF_MOV, R1, R10),
4344 			BPF_ALU32_IMM(BPF_MOV, R0, 0x12),
4345 			BPF_ST_MEM(BPF_W, R10, -40, 0x10),
4346 			BPF_STX_XADD(BPF_W, R10, R0, -40),
4347 			BPF_ALU64_REG(BPF_MOV, R0, R10),
4348 			BPF_ALU64_REG(BPF_SUB, R0, R1),
4349 			BPF_EXIT_INSN(),
4350 		},
4351 		INTERNAL,
4352 		{ },
4353 		{ { 0, 0 } },
4354 	},
4355 	{
4356 		"STX_XADD_W: Test side-effects, r0: 0x12 + 0x10 = 0x22",
4357 		.u.insns_int = {
4358 			BPF_ALU32_IMM(BPF_MOV, R0, 0x12),
4359 			BPF_ST_MEM(BPF_W, R10, -40, 0x10),
4360 			BPF_STX_XADD(BPF_W, R10, R0, -40),
4361 			BPF_EXIT_INSN(),
4362 		},
4363 		INTERNAL,
4364 		{ },
4365 		{ { 0, 0x12 } },
4366 	},
4367 	{
4368 		"STX_XADD_W: X + 1 + 1 + 1 + ...",
4369 		{ },
4370 		INTERNAL,
4371 		{ },
4372 		{ { 0, 4134 } },
4373 		.fill_helper = bpf_fill_stxw,
4374 	},
4375 	{
4376 		"STX_XADD_DW: Test: 0x12 + 0x10 = 0x22",
4377 		.u.insns_int = {
4378 			BPF_ALU32_IMM(BPF_MOV, R0, 0x12),
4379 			BPF_ST_MEM(BPF_DW, R10, -40, 0x10),
4380 			BPF_STX_XADD(BPF_DW, R10, R0, -40),
4381 			BPF_LDX_MEM(BPF_DW, R0, R10, -40),
4382 			BPF_EXIT_INSN(),
4383 		},
4384 		INTERNAL,
4385 		{ },
4386 		{ { 0, 0x22 } },
4387 	},
4388 	{
4389 		"STX_XADD_DW: Test side-effects, r10: 0x12 + 0x10 = 0x22",
4390 		.u.insns_int = {
4391 			BPF_ALU64_REG(BPF_MOV, R1, R10),
4392 			BPF_ALU32_IMM(BPF_MOV, R0, 0x12),
4393 			BPF_ST_MEM(BPF_DW, R10, -40, 0x10),
4394 			BPF_STX_XADD(BPF_DW, R10, R0, -40),
4395 			BPF_ALU64_REG(BPF_MOV, R0, R10),
4396 			BPF_ALU64_REG(BPF_SUB, R0, R1),
4397 			BPF_EXIT_INSN(),
4398 		},
4399 		INTERNAL,
4400 		{ },
4401 		{ { 0, 0 } },
4402 	},
4403 	{
4404 		"STX_XADD_DW: Test side-effects, r0: 0x12 + 0x10 = 0x22",
4405 		.u.insns_int = {
4406 			BPF_ALU32_IMM(BPF_MOV, R0, 0x12),
4407 			BPF_ST_MEM(BPF_DW, R10, -40, 0x10),
4408 			BPF_STX_XADD(BPF_DW, R10, R0, -40),
4409 			BPF_EXIT_INSN(),
4410 		},
4411 		INTERNAL,
4412 		{ },
4413 		{ { 0, 0x12 } },
4414 	},
4415 	{
4416 		"STX_XADD_DW: X + 1 + 1 + 1 + ...",
4417 		{ },
4418 		INTERNAL,
4419 		{ },
4420 		{ { 0, 4134 } },
4421 		.fill_helper = bpf_fill_stxdw,
4422 	},
4423 	/* BPF_JMP | BPF_EXIT */
4424 	{
4425 		"JMP_EXIT",
4426 		.u.insns_int = {
4427 			BPF_ALU32_IMM(BPF_MOV, R0, 0x4711),
4428 			BPF_EXIT_INSN(),
4429 			BPF_ALU32_IMM(BPF_MOV, R0, 0x4712),
4430 		},
4431 		INTERNAL,
4432 		{ },
4433 		{ { 0, 0x4711 } },
4434 	},
4435 	/* BPF_JMP | BPF_JA */
4436 	{
4437 		"JMP_JA: Unconditional jump: if (true) return 1",
4438 		.u.insns_int = {
4439 			BPF_ALU32_IMM(BPF_MOV, R0, 0),
4440 			BPF_JMP_IMM(BPF_JA, 0, 0, 1),
4441 			BPF_EXIT_INSN(),
4442 			BPF_ALU32_IMM(BPF_MOV, R0, 1),
4443 			BPF_EXIT_INSN(),
4444 		},
4445 		INTERNAL,
4446 		{ },
4447 		{ { 0, 1 } },
4448 	},
4449 	/* BPF_JMP | BPF_JSGT | BPF_K */
4450 	{
4451 		"JMP_JSGT_K: Signed jump: if (-1 > -2) return 1",
4452 		.u.insns_int = {
4453 			BPF_ALU32_IMM(BPF_MOV, R0, 0),
4454 			BPF_LD_IMM64(R1, 0xffffffffffffffffLL),
4455 			BPF_JMP_IMM(BPF_JSGT, R1, -2, 1),
4456 			BPF_EXIT_INSN(),
4457 			BPF_ALU32_IMM(BPF_MOV, R0, 1),
4458 			BPF_EXIT_INSN(),
4459 		},
4460 		INTERNAL,
4461 		{ },
4462 		{ { 0, 1 } },
4463 	},
4464 	{
4465 		"JMP_JSGT_K: Signed jump: if (-1 > -1) return 0",
4466 		.u.insns_int = {
4467 			BPF_ALU32_IMM(BPF_MOV, R0, 1),
4468 			BPF_LD_IMM64(R1, 0xffffffffffffffffLL),
4469 			BPF_JMP_IMM(BPF_JSGT, R1, -1, 1),
4470 			BPF_EXIT_INSN(),
4471 			BPF_ALU32_IMM(BPF_MOV, R0, 0),
4472 			BPF_EXIT_INSN(),
4473 		},
4474 		INTERNAL,
4475 		{ },
4476 		{ { 0, 1 } },
4477 	},
4478 	/* BPF_JMP | BPF_JSGE | BPF_K */
4479 	{
4480 		"JMP_JSGE_K: Signed jump: if (-1 >= -2) return 1",
4481 		.u.insns_int = {
4482 			BPF_ALU32_IMM(BPF_MOV, R0, 0),
4483 			BPF_LD_IMM64(R1, 0xffffffffffffffffLL),
4484 			BPF_JMP_IMM(BPF_JSGE, R1, -2, 1),
4485 			BPF_EXIT_INSN(),
4486 			BPF_ALU32_IMM(BPF_MOV, R0, 1),
4487 			BPF_EXIT_INSN(),
4488 		},
4489 		INTERNAL,
4490 		{ },
4491 		{ { 0, 1 } },
4492 	},
4493 	{
4494 		"JMP_JSGE_K: Signed jump: if (-1 >= -1) return 1",
4495 		.u.insns_int = {
4496 			BPF_ALU32_IMM(BPF_MOV, R0, 0),
4497 			BPF_LD_IMM64(R1, 0xffffffffffffffffLL),
4498 			BPF_JMP_IMM(BPF_JSGE, R1, -1, 1),
4499 			BPF_EXIT_INSN(),
4500 			BPF_ALU32_IMM(BPF_MOV, R0, 1),
4501 			BPF_EXIT_INSN(),
4502 		},
4503 		INTERNAL,
4504 		{ },
4505 		{ { 0, 1 } },
4506 	},
4507 	{
4508 		"JMP_JSGE_K: Signed jump: value walk 1",
4509 		.u.insns_int = {
4510 			BPF_ALU32_IMM(BPF_MOV, R0, 0),
4511 			BPF_LD_IMM64(R1, -3),
4512 			BPF_JMP_IMM(BPF_JSGE, R1, 0, 6),
4513 			BPF_ALU64_IMM(BPF_ADD, R1, 1),
4514 			BPF_JMP_IMM(BPF_JSGE, R1, 0, 4),
4515 			BPF_ALU64_IMM(BPF_ADD, R1, 1),
4516 			BPF_JMP_IMM(BPF_JSGE, R1, 0, 2),
4517 			BPF_ALU64_IMM(BPF_ADD, R1, 1),
4518 			BPF_JMP_IMM(BPF_JSGE, R1, 0, 1),
4519 			BPF_EXIT_INSN(),		/* bad exit */
4520 			BPF_ALU32_IMM(BPF_MOV, R0, 1),	/* good exit */
4521 			BPF_EXIT_INSN(),
4522 		},
4523 		INTERNAL,
4524 		{ },
4525 		{ { 0, 1 } },
4526 	},
4527 	{
4528 		"JMP_JSGE_K: Signed jump: value walk 2",
4529 		.u.insns_int = {
4530 			BPF_ALU32_IMM(BPF_MOV, R0, 0),
4531 			BPF_LD_IMM64(R1, -3),
4532 			BPF_JMP_IMM(BPF_JSGE, R1, 0, 4),
4533 			BPF_ALU64_IMM(BPF_ADD, R1, 2),
4534 			BPF_JMP_IMM(BPF_JSGE, R1, 0, 2),
4535 			BPF_ALU64_IMM(BPF_ADD, R1, 2),
4536 			BPF_JMP_IMM(BPF_JSGE, R1, 0, 1),
4537 			BPF_EXIT_INSN(),		/* bad exit */
4538 			BPF_ALU32_IMM(BPF_MOV, R0, 1),	/* good exit */
4539 			BPF_EXIT_INSN(),
4540 		},
4541 		INTERNAL,
4542 		{ },
4543 		{ { 0, 1 } },
4544 	},
4545 	/* BPF_JMP | BPF_JGT | BPF_K */
4546 	{
4547 		"JMP_JGT_K: if (3 > 2) return 1",
4548 		.u.insns_int = {
4549 			BPF_ALU32_IMM(BPF_MOV, R0, 0),
4550 			BPF_LD_IMM64(R1, 3),
4551 			BPF_JMP_IMM(BPF_JGT, R1, 2, 1),
4552 			BPF_EXIT_INSN(),
4553 			BPF_ALU32_IMM(BPF_MOV, R0, 1),
4554 			BPF_EXIT_INSN(),
4555 		},
4556 		INTERNAL,
4557 		{ },
4558 		{ { 0, 1 } },
4559 	},
4560 	{
4561 		"JMP_JGT_K: Unsigned jump: if (-1 > 1) return 1",
4562 		.u.insns_int = {
4563 			BPF_ALU32_IMM(BPF_MOV, R0, 0),
4564 			BPF_LD_IMM64(R1, -1),
4565 			BPF_JMP_IMM(BPF_JGT, R1, 1, 1),
4566 			BPF_EXIT_INSN(),
4567 			BPF_ALU32_IMM(BPF_MOV, R0, 1),
4568 			BPF_EXIT_INSN(),
4569 		},
4570 		INTERNAL,
4571 		{ },
4572 		{ { 0, 1 } },
4573 	},
4574 	/* BPF_JMP | BPF_JGE | BPF_K */
4575 	{
4576 		"JMP_JGE_K: if (3 >= 2) return 1",
4577 		.u.insns_int = {
4578 			BPF_ALU32_IMM(BPF_MOV, R0, 0),
4579 			BPF_LD_IMM64(R1, 3),
4580 			BPF_JMP_IMM(BPF_JGE, R1, 2, 1),
4581 			BPF_EXIT_INSN(),
4582 			BPF_ALU32_IMM(BPF_MOV, R0, 1),
4583 			BPF_EXIT_INSN(),
4584 		},
4585 		INTERNAL,
4586 		{ },
4587 		{ { 0, 1 } },
4588 	},
4589 	/* BPF_JMP | BPF_JGT | BPF_K jump backwards */
4590 	{
4591 		"JMP_JGT_K: if (3 > 2) return 1 (jump backwards)",
4592 		.u.insns_int = {
4593 			BPF_JMP_IMM(BPF_JA, 0, 0, 2), /* goto start */
4594 			BPF_ALU32_IMM(BPF_MOV, R0, 1), /* out: */
4595 			BPF_EXIT_INSN(),
4596 			BPF_ALU32_IMM(BPF_MOV, R0, 0), /* start: */
4597 			BPF_LD_IMM64(R1, 3), /* note: this takes 2 insns */
4598 			BPF_JMP_IMM(BPF_JGT, R1, 2, -6), /* goto out */
4599 			BPF_EXIT_INSN(),
4600 		},
4601 		INTERNAL,
4602 		{ },
4603 		{ { 0, 1 } },
4604 	},
4605 	{
4606 		"JMP_JGE_K: if (3 >= 3) return 1",
4607 		.u.insns_int = {
4608 			BPF_ALU32_IMM(BPF_MOV, R0, 0),
4609 			BPF_LD_IMM64(R1, 3),
4610 			BPF_JMP_IMM(BPF_JGE, R1, 3, 1),
4611 			BPF_EXIT_INSN(),
4612 			BPF_ALU32_IMM(BPF_MOV, R0, 1),
4613 			BPF_EXIT_INSN(),
4614 		},
4615 		INTERNAL,
4616 		{ },
4617 		{ { 0, 1 } },
4618 	},
4619 	/* BPF_JMP | BPF_JNE | BPF_K */
4620 	{
4621 		"JMP_JNE_K: if (3 != 2) return 1",
4622 		.u.insns_int = {
4623 			BPF_ALU32_IMM(BPF_MOV, R0, 0),
4624 			BPF_LD_IMM64(R1, 3),
4625 			BPF_JMP_IMM(BPF_JNE, R1, 2, 1),
4626 			BPF_EXIT_INSN(),
4627 			BPF_ALU32_IMM(BPF_MOV, R0, 1),
4628 			BPF_EXIT_INSN(),
4629 		},
4630 		INTERNAL,
4631 		{ },
4632 		{ { 0, 1 } },
4633 	},
4634 	/* BPF_JMP | BPF_JEQ | BPF_K */
4635 	{
4636 		"JMP_JEQ_K: if (3 == 3) return 1",
4637 		.u.insns_int = {
4638 			BPF_ALU32_IMM(BPF_MOV, R0, 0),
4639 			BPF_LD_IMM64(R1, 3),
4640 			BPF_JMP_IMM(BPF_JEQ, R1, 3, 1),
4641 			BPF_EXIT_INSN(),
4642 			BPF_ALU32_IMM(BPF_MOV, R0, 1),
4643 			BPF_EXIT_INSN(),
4644 		},
4645 		INTERNAL,
4646 		{ },
4647 		{ { 0, 1 } },
4648 	},
4649 	/* BPF_JMP | BPF_JSET | BPF_K */
4650 	{
4651 		"JMP_JSET_K: if (0x3 & 0x2) return 1",
4652 		.u.insns_int = {
4653 			BPF_ALU32_IMM(BPF_MOV, R0, 0),
4654 			BPF_LD_IMM64(R1, 3),
4655 			BPF_JMP_IMM(BPF_JSET, R1, 2, 1),
4656 			BPF_EXIT_INSN(),
4657 			BPF_ALU32_IMM(BPF_MOV, R0, 1),
4658 			BPF_EXIT_INSN(),
4659 		},
4660 		INTERNAL,
4661 		{ },
4662 		{ { 0, 1 } },
4663 	},
4664 	{
4665 		"JMP_JSET_K: if (0x3 & 0xffffffff) return 1",
4666 		.u.insns_int = {
4667 			BPF_ALU32_IMM(BPF_MOV, R0, 0),
4668 			BPF_LD_IMM64(R1, 3),
4669 			BPF_JMP_IMM(BPF_JSET, R1, 0xffffffff, 1),
4670 			BPF_EXIT_INSN(),
4671 			BPF_ALU32_IMM(BPF_MOV, R0, 1),
4672 			BPF_EXIT_INSN(),
4673 		},
4674 		INTERNAL,
4675 		{ },
4676 		{ { 0, 1 } },
4677 	},
4678 	/* BPF_JMP | BPF_JSGT | BPF_X */
4679 	{
4680 		"JMP_JSGT_X: Signed jump: if (-1 > -2) return 1",
4681 		.u.insns_int = {
4682 			BPF_ALU32_IMM(BPF_MOV, R0, 0),
4683 			BPF_LD_IMM64(R1, -1),
4684 			BPF_LD_IMM64(R2, -2),
4685 			BPF_JMP_REG(BPF_JSGT, R1, R2, 1),
4686 			BPF_EXIT_INSN(),
4687 			BPF_ALU32_IMM(BPF_MOV, R0, 1),
4688 			BPF_EXIT_INSN(),
4689 		},
4690 		INTERNAL,
4691 		{ },
4692 		{ { 0, 1 } },
4693 	},
4694 	{
4695 		"JMP_JSGT_X: Signed jump: if (-1 > -1) return 0",
4696 		.u.insns_int = {
4697 			BPF_ALU32_IMM(BPF_MOV, R0, 1),
4698 			BPF_LD_IMM64(R1, -1),
4699 			BPF_LD_IMM64(R2, -1),
4700 			BPF_JMP_REG(BPF_JSGT, R1, R2, 1),
4701 			BPF_EXIT_INSN(),
4702 			BPF_ALU32_IMM(BPF_MOV, R0, 0),
4703 			BPF_EXIT_INSN(),
4704 		},
4705 		INTERNAL,
4706 		{ },
4707 		{ { 0, 1 } },
4708 	},
4709 	/* BPF_JMP | BPF_JSGE | BPF_X */
4710 	{
4711 		"JMP_JSGE_X: Signed jump: if (-1 >= -2) return 1",
4712 		.u.insns_int = {
4713 			BPF_ALU32_IMM(BPF_MOV, R0, 0),
4714 			BPF_LD_IMM64(R1, -1),
4715 			BPF_LD_IMM64(R2, -2),
4716 			BPF_JMP_REG(BPF_JSGE, R1, R2, 1),
4717 			BPF_EXIT_INSN(),
4718 			BPF_ALU32_IMM(BPF_MOV, R0, 1),
4719 			BPF_EXIT_INSN(),
4720 		},
4721 		INTERNAL,
4722 		{ },
4723 		{ { 0, 1 } },
4724 	},
4725 	{
4726 		"JMP_JSGE_X: Signed jump: if (-1 >= -1) return 1",
4727 		.u.insns_int = {
4728 			BPF_ALU32_IMM(BPF_MOV, R0, 0),
4729 			BPF_LD_IMM64(R1, -1),
4730 			BPF_LD_IMM64(R2, -1),
4731 			BPF_JMP_REG(BPF_JSGE, R1, R2, 1),
4732 			BPF_EXIT_INSN(),
4733 			BPF_ALU32_IMM(BPF_MOV, R0, 1),
4734 			BPF_EXIT_INSN(),
4735 		},
4736 		INTERNAL,
4737 		{ },
4738 		{ { 0, 1 } },
4739 	},
4740 	/* BPF_JMP | BPF_JGT | BPF_X */
4741 	{
4742 		"JMP_JGT_X: if (3 > 2) return 1",
4743 		.u.insns_int = {
4744 			BPF_ALU32_IMM(BPF_MOV, R0, 0),
4745 			BPF_LD_IMM64(R1, 3),
4746 			BPF_LD_IMM64(R2, 2),
4747 			BPF_JMP_REG(BPF_JGT, R1, R2, 1),
4748 			BPF_EXIT_INSN(),
4749 			BPF_ALU32_IMM(BPF_MOV, R0, 1),
4750 			BPF_EXIT_INSN(),
4751 		},
4752 		INTERNAL,
4753 		{ },
4754 		{ { 0, 1 } },
4755 	},
4756 	{
4757 		"JMP_JGT_X: Unsigned jump: if (-1 > 1) return 1",
4758 		.u.insns_int = {
4759 			BPF_ALU32_IMM(BPF_MOV, R0, 0),
4760 			BPF_LD_IMM64(R1, -1),
4761 			BPF_LD_IMM64(R2, 1),
4762 			BPF_JMP_REG(BPF_JGT, R1, R2, 1),
4763 			BPF_EXIT_INSN(),
4764 			BPF_ALU32_IMM(BPF_MOV, R0, 1),
4765 			BPF_EXIT_INSN(),
4766 		},
4767 		INTERNAL,
4768 		{ },
4769 		{ { 0, 1 } },
4770 	},
4771 	/* BPF_JMP | BPF_JGE | BPF_X */
4772 	{
4773 		"JMP_JGE_X: if (3 >= 2) return 1",
4774 		.u.insns_int = {
4775 			BPF_ALU32_IMM(BPF_MOV, R0, 0),
4776 			BPF_LD_IMM64(R1, 3),
4777 			BPF_LD_IMM64(R2, 2),
4778 			BPF_JMP_REG(BPF_JGE, R1, R2, 1),
4779 			BPF_EXIT_INSN(),
4780 			BPF_ALU32_IMM(BPF_MOV, R0, 1),
4781 			BPF_EXIT_INSN(),
4782 		},
4783 		INTERNAL,
4784 		{ },
4785 		{ { 0, 1 } },
4786 	},
4787 	{
4788 		"JMP_JGE_X: if (3 >= 3) return 1",
4789 		.u.insns_int = {
4790 			BPF_ALU32_IMM(BPF_MOV, R0, 0),
4791 			BPF_LD_IMM64(R1, 3),
4792 			BPF_LD_IMM64(R2, 3),
4793 			BPF_JMP_REG(BPF_JGE, R1, R2, 1),
4794 			BPF_EXIT_INSN(),
4795 			BPF_ALU32_IMM(BPF_MOV, R0, 1),
4796 			BPF_EXIT_INSN(),
4797 		},
4798 		INTERNAL,
4799 		{ },
4800 		{ { 0, 1 } },
4801 	},
4802 	{
4803 		/* Mainly testing JIT + imm64 here. */
4804 		"JMP_JGE_X: ldimm64 test 1",
4805 		.u.insns_int = {
4806 			BPF_ALU32_IMM(BPF_MOV, R0, 0),
4807 			BPF_LD_IMM64(R1, 3),
4808 			BPF_LD_IMM64(R2, 2),
4809 			BPF_JMP_REG(BPF_JGE, R1, R2, 2),
4810 			BPF_LD_IMM64(R0, 0xffffffffffffffffULL),
4811 			BPF_LD_IMM64(R0, 0xeeeeeeeeeeeeeeeeULL),
4812 			BPF_EXIT_INSN(),
4813 		},
4814 		INTERNAL,
4815 		{ },
4816 		{ { 0, 0xeeeeeeeeU } },
4817 	},
4818 	{
4819 		"JMP_JGE_X: ldimm64 test 2",
4820 		.u.insns_int = {
4821 			BPF_ALU32_IMM(BPF_MOV, R0, 0),
4822 			BPF_LD_IMM64(R1, 3),
4823 			BPF_LD_IMM64(R2, 2),
4824 			BPF_JMP_REG(BPF_JGE, R1, R2, 0),
4825 			BPF_LD_IMM64(R0, 0xffffffffffffffffULL),
4826 			BPF_EXIT_INSN(),
4827 		},
4828 		INTERNAL,
4829 		{ },
4830 		{ { 0, 0xffffffffU } },
4831 	},
4832 	{
4833 		"JMP_JGE_X: ldimm64 test 3",
4834 		.u.insns_int = {
4835 			BPF_ALU32_IMM(BPF_MOV, R0, 1),
4836 			BPF_LD_IMM64(R1, 3),
4837 			BPF_LD_IMM64(R2, 2),
4838 			BPF_JMP_REG(BPF_JGE, R1, R2, 4),
4839 			BPF_LD_IMM64(R0, 0xffffffffffffffffULL),
4840 			BPF_LD_IMM64(R0, 0xeeeeeeeeeeeeeeeeULL),
4841 			BPF_EXIT_INSN(),
4842 		},
4843 		INTERNAL,
4844 		{ },
4845 		{ { 0, 1 } },
4846 	},
4847 	/* BPF_JMP | BPF_JNE | BPF_X */
4848 	{
4849 		"JMP_JNE_X: if (3 != 2) return 1",
4850 		.u.insns_int = {
4851 			BPF_ALU32_IMM(BPF_MOV, R0, 0),
4852 			BPF_LD_IMM64(R1, 3),
4853 			BPF_LD_IMM64(R2, 2),
4854 			BPF_JMP_REG(BPF_JNE, R1, R2, 1),
4855 			BPF_EXIT_INSN(),
4856 			BPF_ALU32_IMM(BPF_MOV, R0, 1),
4857 			BPF_EXIT_INSN(),
4858 		},
4859 		INTERNAL,
4860 		{ },
4861 		{ { 0, 1 } },
4862 	},
4863 	/* BPF_JMP | BPF_JEQ | BPF_X */
4864 	{
4865 		"JMP_JEQ_X: if (3 == 3) return 1",
4866 		.u.insns_int = {
4867 			BPF_ALU32_IMM(BPF_MOV, R0, 0),
4868 			BPF_LD_IMM64(R1, 3),
4869 			BPF_LD_IMM64(R2, 3),
4870 			BPF_JMP_REG(BPF_JEQ, R1, R2, 1),
4871 			BPF_EXIT_INSN(),
4872 			BPF_ALU32_IMM(BPF_MOV, R0, 1),
4873 			BPF_EXIT_INSN(),
4874 		},
4875 		INTERNAL,
4876 		{ },
4877 		{ { 0, 1 } },
4878 	},
4879 	/* BPF_JMP | BPF_JSET | BPF_X */
4880 	{
4881 		"JMP_JSET_X: if (0x3 & 0x2) return 1",
4882 		.u.insns_int = {
4883 			BPF_ALU32_IMM(BPF_MOV, R0, 0),
4884 			BPF_LD_IMM64(R1, 3),
4885 			BPF_LD_IMM64(R2, 2),
4886 			BPF_JMP_REG(BPF_JSET, R1, R2, 1),
4887 			BPF_EXIT_INSN(),
4888 			BPF_ALU32_IMM(BPF_MOV, R0, 1),
4889 			BPF_EXIT_INSN(),
4890 		},
4891 		INTERNAL,
4892 		{ },
4893 		{ { 0, 1 } },
4894 	},
4895 	{
4896 		"JMP_JSET_X: if (0x3 & 0xffffffff) return 1",
4897 		.u.insns_int = {
4898 			BPF_ALU32_IMM(BPF_MOV, R0, 0),
4899 			BPF_LD_IMM64(R1, 3),
4900 			BPF_LD_IMM64(R2, 0xffffffff),
4901 			BPF_JMP_REG(BPF_JSET, R1, R2, 1),
4902 			BPF_EXIT_INSN(),
4903 			BPF_ALU32_IMM(BPF_MOV, R0, 1),
4904 			BPF_EXIT_INSN(),
4905 		},
4906 		INTERNAL,
4907 		{ },
4908 		{ { 0, 1 } },
4909 	},
4910 	{
4911 		"JMP_JA: Jump, gap, jump, ...",
4912 		{ },
4913 		CLASSIC | FLAG_NO_DATA,
4914 		{ },
4915 		{ { 0, 0xababcbac } },
4916 		.fill_helper = bpf_fill_ja,
4917 	},
4918 	{	/* Mainly checking JIT here. */
4919 		"BPF_MAXINSNS: Maximum possible literals",
4920 		{ },
4921 		CLASSIC | FLAG_NO_DATA,
4922 		{ },
4923 		{ { 0, 0xffffffff } },
4924 		.fill_helper = bpf_fill_maxinsns1,
4925 	},
4926 	{	/* Mainly checking JIT here. */
4927 		"BPF_MAXINSNS: Single literal",
4928 		{ },
4929 		CLASSIC | FLAG_NO_DATA,
4930 		{ },
4931 		{ { 0, 0xfefefefe } },
4932 		.fill_helper = bpf_fill_maxinsns2,
4933 	},
4934 	{	/* Mainly checking JIT here. */
4935 		"BPF_MAXINSNS: Run/add until end",
4936 		{ },
4937 		CLASSIC | FLAG_NO_DATA,
4938 		{ },
4939 		{ { 0, 0x947bf368 } },
4940 		.fill_helper = bpf_fill_maxinsns3,
4941 	},
4942 	{
4943 		"BPF_MAXINSNS: Too many instructions",
4944 		{ },
4945 		CLASSIC | FLAG_NO_DATA | FLAG_EXPECTED_FAIL,
4946 		{ },
4947 		{ },
4948 		.fill_helper = bpf_fill_maxinsns4,
4949 	},
4950 	{	/* Mainly checking JIT here. */
4951 		"BPF_MAXINSNS: Very long jump",
4952 		{ },
4953 		CLASSIC | FLAG_NO_DATA,
4954 		{ },
4955 		{ { 0, 0xabababab } },
4956 		.fill_helper = bpf_fill_maxinsns5,
4957 	},
4958 	{	/* Mainly checking JIT here. */
4959 		"BPF_MAXINSNS: Ctx heavy transformations",
4960 		{ },
4961 		CLASSIC,
4962 		{ },
4963 		{
4964 			{  1, !!(SKB_VLAN_TCI & VLAN_TAG_PRESENT) },
4965 			{ 10, !!(SKB_VLAN_TCI & VLAN_TAG_PRESENT) }
4966 		},
4967 		.fill_helper = bpf_fill_maxinsns6,
4968 	},
4969 	{	/* Mainly checking JIT here. */
4970 		"BPF_MAXINSNS: Call heavy transformations",
4971 		{ },
4972 		CLASSIC | FLAG_NO_DATA,
4973 		{ },
4974 		{ { 1, 0 }, { 10, 0 } },
4975 		.fill_helper = bpf_fill_maxinsns7,
4976 	},
4977 	{	/* Mainly checking JIT here. */
4978 		"BPF_MAXINSNS: Jump heavy test",
4979 		{ },
4980 		CLASSIC | FLAG_NO_DATA,
4981 		{ },
4982 		{ { 0, 0xffffffff } },
4983 		.fill_helper = bpf_fill_maxinsns8,
4984 	},
4985 	{	/* Mainly checking JIT here. */
4986 		"BPF_MAXINSNS: Very long jump backwards",
4987 		{ },
4988 		INTERNAL | FLAG_NO_DATA,
4989 		{ },
4990 		{ { 0, 0xcbababab } },
4991 		.fill_helper = bpf_fill_maxinsns9,
4992 	},
4993 	{	/* Mainly checking JIT here. */
4994 		"BPF_MAXINSNS: Edge hopping nuthouse",
4995 		{ },
4996 		INTERNAL | FLAG_NO_DATA,
4997 		{ },
4998 		{ { 0, 0xabababac } },
4999 		.fill_helper = bpf_fill_maxinsns10,
5000 	},
5001 	{
5002 		"BPF_MAXINSNS: Jump, gap, jump, ...",
5003 		{ },
5004 		CLASSIC | FLAG_NO_DATA,
5005 		{ },
5006 		{ { 0, 0xababcbac } },
5007 		.fill_helper = bpf_fill_maxinsns11,
5008 	},
5009 	{
5010 		"BPF_MAXINSNS: ld_abs+get_processor_id",
5011 		{ },
5012 		CLASSIC,
5013 		{ },
5014 		{ { 1, 0xbee } },
5015 		.fill_helper = bpf_fill_ld_abs_get_processor_id,
5016 	},
5017 	{
5018 		"BPF_MAXINSNS: ld_abs+vlan_push/pop",
5019 		{ },
5020 		INTERNAL,
5021 		{ 0x34 },
5022 		{ { ETH_HLEN, 0xbef } },
5023 		.fill_helper = bpf_fill_ld_abs_vlan_push_pop,
5024 	},
5025 	/*
5026 	 * LD_IND / LD_ABS on fragmented SKBs
5027 	 */
5028 	{
5029 		"LD_IND byte frag",
5030 		.u.insns = {
5031 			BPF_STMT(BPF_LDX | BPF_IMM, 0x40),
5032 			BPF_STMT(BPF_LD | BPF_IND | BPF_B, 0x0),
5033 			BPF_STMT(BPF_RET | BPF_A, 0x0),
5034 		},
5035 		CLASSIC | FLAG_SKB_FRAG,
5036 		{ },
5037 		{ {0x40, 0x42} },
5038 		.frag_data = {
5039 			0x42, 0x00, 0x00, 0x00,
5040 			0x43, 0x44, 0x00, 0x00,
5041 			0x21, 0x07, 0x19, 0x83,
5042 		},
5043 	},
5044 	{
5045 		"LD_IND halfword frag",
5046 		.u.insns = {
5047 			BPF_STMT(BPF_LDX | BPF_IMM, 0x40),
5048 			BPF_STMT(BPF_LD | BPF_IND | BPF_H, 0x4),
5049 			BPF_STMT(BPF_RET | BPF_A, 0x0),
5050 		},
5051 		CLASSIC | FLAG_SKB_FRAG,
5052 		{ },
5053 		{ {0x40, 0x4344} },
5054 		.frag_data = {
5055 			0x42, 0x00, 0x00, 0x00,
5056 			0x43, 0x44, 0x00, 0x00,
5057 			0x21, 0x07, 0x19, 0x83,
5058 		},
5059 	},
5060 	{
5061 		"LD_IND word frag",
5062 		.u.insns = {
5063 			BPF_STMT(BPF_LDX | BPF_IMM, 0x40),
5064 			BPF_STMT(BPF_LD | BPF_IND | BPF_W, 0x8),
5065 			BPF_STMT(BPF_RET | BPF_A, 0x0),
5066 		},
5067 		CLASSIC | FLAG_SKB_FRAG,
5068 		{ },
5069 		{ {0x40, 0x21071983} },
5070 		.frag_data = {
5071 			0x42, 0x00, 0x00, 0x00,
5072 			0x43, 0x44, 0x00, 0x00,
5073 			0x21, 0x07, 0x19, 0x83,
5074 		},
5075 	},
5076 	{
5077 		"LD_IND halfword mixed head/frag",
5078 		.u.insns = {
5079 			BPF_STMT(BPF_LDX | BPF_IMM, 0x40),
5080 			BPF_STMT(BPF_LD | BPF_IND | BPF_H, -0x1),
5081 			BPF_STMT(BPF_RET | BPF_A, 0x0),
5082 		},
5083 		CLASSIC | FLAG_SKB_FRAG,
5084 		{ [0x3e] = 0x25, [0x3f] = 0x05, },
5085 		{ {0x40, 0x0519} },
5086 		.frag_data = { 0x19, 0x82 },
5087 	},
5088 	{
5089 		"LD_IND word mixed head/frag",
5090 		.u.insns = {
5091 			BPF_STMT(BPF_LDX | BPF_IMM, 0x40),
5092 			BPF_STMT(BPF_LD | BPF_IND | BPF_W, -0x2),
5093 			BPF_STMT(BPF_RET | BPF_A, 0x0),
5094 		},
5095 		CLASSIC | FLAG_SKB_FRAG,
5096 		{ [0x3e] = 0x25, [0x3f] = 0x05, },
5097 		{ {0x40, 0x25051982} },
5098 		.frag_data = { 0x19, 0x82 },
5099 	},
5100 	{
5101 		"LD_ABS byte frag",
5102 		.u.insns = {
5103 			BPF_STMT(BPF_LD | BPF_ABS | BPF_B, 0x40),
5104 			BPF_STMT(BPF_RET | BPF_A, 0x0),
5105 		},
5106 		CLASSIC | FLAG_SKB_FRAG,
5107 		{ },
5108 		{ {0x40, 0x42} },
5109 		.frag_data = {
5110 			0x42, 0x00, 0x00, 0x00,
5111 			0x43, 0x44, 0x00, 0x00,
5112 			0x21, 0x07, 0x19, 0x83,
5113 		},
5114 	},
5115 	{
5116 		"LD_ABS halfword frag",
5117 		.u.insns = {
5118 			BPF_STMT(BPF_LD | BPF_ABS | BPF_H, 0x44),
5119 			BPF_STMT(BPF_RET | BPF_A, 0x0),
5120 		},
5121 		CLASSIC | FLAG_SKB_FRAG,
5122 		{ },
5123 		{ {0x40, 0x4344} },
5124 		.frag_data = {
5125 			0x42, 0x00, 0x00, 0x00,
5126 			0x43, 0x44, 0x00, 0x00,
5127 			0x21, 0x07, 0x19, 0x83,
5128 		},
5129 	},
5130 	{
5131 		"LD_ABS word frag",
5132 		.u.insns = {
5133 			BPF_STMT(BPF_LD | BPF_ABS | BPF_W, 0x48),
5134 			BPF_STMT(BPF_RET | BPF_A, 0x0),
5135 		},
5136 		CLASSIC | FLAG_SKB_FRAG,
5137 		{ },
5138 		{ {0x40, 0x21071983} },
5139 		.frag_data = {
5140 			0x42, 0x00, 0x00, 0x00,
5141 			0x43, 0x44, 0x00, 0x00,
5142 			0x21, 0x07, 0x19, 0x83,
5143 		},
5144 	},
5145 	{
5146 		"LD_ABS halfword mixed head/frag",
5147 		.u.insns = {
5148 			BPF_STMT(BPF_LD | BPF_ABS | BPF_H, 0x3f),
5149 			BPF_STMT(BPF_RET | BPF_A, 0x0),
5150 		},
5151 		CLASSIC | FLAG_SKB_FRAG,
5152 		{ [0x3e] = 0x25, [0x3f] = 0x05, },
5153 		{ {0x40, 0x0519} },
5154 		.frag_data = { 0x19, 0x82 },
5155 	},
5156 	{
5157 		"LD_ABS word mixed head/frag",
5158 		.u.insns = {
5159 			BPF_STMT(BPF_LD | BPF_ABS | BPF_W, 0x3e),
5160 			BPF_STMT(BPF_RET | BPF_A, 0x0),
5161 		},
5162 		CLASSIC | FLAG_SKB_FRAG,
5163 		{ [0x3e] = 0x25, [0x3f] = 0x05, },
5164 		{ {0x40, 0x25051982} },
5165 		.frag_data = { 0x19, 0x82 },
5166 	},
5167 	/*
5168 	 * LD_IND / LD_ABS on non fragmented SKBs
5169 	 */
5170 	{
5171 		/*
5172 		 * this tests that the JIT/interpreter correctly resets X
5173 		 * before using it in an LD_IND instruction.
5174 		 */
5175 		"LD_IND byte default X",
5176 		.u.insns = {
5177 			BPF_STMT(BPF_LD | BPF_IND | BPF_B, 0x1),
5178 			BPF_STMT(BPF_RET | BPF_A, 0x0),
5179 		},
5180 		CLASSIC,
5181 		{ [0x1] = 0x42 },
5182 		{ {0x40, 0x42 } },
5183 	},
5184 	{
5185 		"LD_IND byte positive offset",
5186 		.u.insns = {
5187 			BPF_STMT(BPF_LDX | BPF_IMM, 0x3e),
5188 			BPF_STMT(BPF_LD | BPF_IND | BPF_B, 0x1),
5189 			BPF_STMT(BPF_RET | BPF_A, 0x0),
5190 		},
5191 		CLASSIC,
5192 		{ [0x3c] = 0x25, [0x3d] = 0x05,  [0x3e] = 0x19, [0x3f] = 0x82 },
5193 		{ {0x40, 0x82 } },
5194 	},
5195 	{
5196 		"LD_IND byte negative offset",
5197 		.u.insns = {
5198 			BPF_STMT(BPF_LDX | BPF_IMM, 0x3e),
5199 			BPF_STMT(BPF_LD | BPF_IND | BPF_B, -0x1),
5200 			BPF_STMT(BPF_RET | BPF_A, 0x0),
5201 		},
5202 		CLASSIC,
5203 		{ [0x3c] = 0x25, [0x3d] = 0x05,  [0x3e] = 0x19, [0x3f] = 0x82 },
5204 		{ {0x40, 0x05 } },
5205 	},
5206 	{
5207 		"LD_IND halfword positive offset",
5208 		.u.insns = {
5209 			BPF_STMT(BPF_LDX | BPF_IMM, 0x20),
5210 			BPF_STMT(BPF_LD | BPF_IND | BPF_H, 0x2),
5211 			BPF_STMT(BPF_RET | BPF_A, 0x0),
5212 		},
5213 		CLASSIC,
5214 		{
5215 			[0x1c] = 0xaa, [0x1d] = 0x55,
5216 			[0x1e] = 0xbb, [0x1f] = 0x66,
5217 			[0x20] = 0xcc, [0x21] = 0x77,
5218 			[0x22] = 0xdd, [0x23] = 0x88,
5219 		},
5220 		{ {0x40, 0xdd88 } },
5221 	},
5222 	{
5223 		"LD_IND halfword negative offset",
5224 		.u.insns = {
5225 			BPF_STMT(BPF_LDX | BPF_IMM, 0x20),
5226 			BPF_STMT(BPF_LD | BPF_IND | BPF_H, -0x2),
5227 			BPF_STMT(BPF_RET | BPF_A, 0x0),
5228 		},
5229 		CLASSIC,
5230 		{
5231 			[0x1c] = 0xaa, [0x1d] = 0x55,
5232 			[0x1e] = 0xbb, [0x1f] = 0x66,
5233 			[0x20] = 0xcc, [0x21] = 0x77,
5234 			[0x22] = 0xdd, [0x23] = 0x88,
5235 		},
5236 		{ {0x40, 0xbb66 } },
5237 	},
5238 	{
5239 		"LD_IND halfword unaligned",
5240 		.u.insns = {
5241 			BPF_STMT(BPF_LDX | BPF_IMM, 0x20),
5242 			BPF_STMT(BPF_LD | BPF_IND | BPF_H, -0x1),
5243 			BPF_STMT(BPF_RET | BPF_A, 0x0),
5244 		},
5245 		CLASSIC,
5246 		{
5247 			[0x1c] = 0xaa, [0x1d] = 0x55,
5248 			[0x1e] = 0xbb, [0x1f] = 0x66,
5249 			[0x20] = 0xcc, [0x21] = 0x77,
5250 			[0x22] = 0xdd, [0x23] = 0x88,
5251 		},
5252 		{ {0x40, 0x66cc } },
5253 	},
5254 	{
5255 		"LD_IND word positive offset",
5256 		.u.insns = {
5257 			BPF_STMT(BPF_LDX | BPF_IMM, 0x20),
5258 			BPF_STMT(BPF_LD | BPF_IND | BPF_W, 0x4),
5259 			BPF_STMT(BPF_RET | BPF_A, 0x0),
5260 		},
5261 		CLASSIC,
5262 		{
5263 			[0x1c] = 0xaa, [0x1d] = 0x55,
5264 			[0x1e] = 0xbb, [0x1f] = 0x66,
5265 			[0x20] = 0xcc, [0x21] = 0x77,
5266 			[0x22] = 0xdd, [0x23] = 0x88,
5267 			[0x24] = 0xee, [0x25] = 0x99,
5268 			[0x26] = 0xff, [0x27] = 0xaa,
5269 		},
5270 		{ {0x40, 0xee99ffaa } },
5271 	},
5272 	{
5273 		"LD_IND word negative offset",
5274 		.u.insns = {
5275 			BPF_STMT(BPF_LDX | BPF_IMM, 0x20),
5276 			BPF_STMT(BPF_LD | BPF_IND | BPF_W, -0x4),
5277 			BPF_STMT(BPF_RET | BPF_A, 0x0),
5278 		},
5279 		CLASSIC,
5280 		{
5281 			[0x1c] = 0xaa, [0x1d] = 0x55,
5282 			[0x1e] = 0xbb, [0x1f] = 0x66,
5283 			[0x20] = 0xcc, [0x21] = 0x77,
5284 			[0x22] = 0xdd, [0x23] = 0x88,
5285 			[0x24] = 0xee, [0x25] = 0x99,
5286 			[0x26] = 0xff, [0x27] = 0xaa,
5287 		},
5288 		{ {0x40, 0xaa55bb66 } },
5289 	},
5290 	{
5291 		"LD_IND word unaligned (addr & 3 == 2)",
5292 		.u.insns = {
5293 			BPF_STMT(BPF_LDX | BPF_IMM, 0x20),
5294 			BPF_STMT(BPF_LD | BPF_IND | BPF_W, -0x2),
5295 			BPF_STMT(BPF_RET | BPF_A, 0x0),
5296 		},
5297 		CLASSIC,
5298 		{
5299 			[0x1c] = 0xaa, [0x1d] = 0x55,
5300 			[0x1e] = 0xbb, [0x1f] = 0x66,
5301 			[0x20] = 0xcc, [0x21] = 0x77,
5302 			[0x22] = 0xdd, [0x23] = 0x88,
5303 			[0x24] = 0xee, [0x25] = 0x99,
5304 			[0x26] = 0xff, [0x27] = 0xaa,
5305 		},
5306 		{ {0x40, 0xbb66cc77 } },
5307 	},
5308 	{
5309 		"LD_IND word unaligned (addr & 3 == 1)",
5310 		.u.insns = {
5311 			BPF_STMT(BPF_LDX | BPF_IMM, 0x20),
5312 			BPF_STMT(BPF_LD | BPF_IND | BPF_W, -0x3),
5313 			BPF_STMT(BPF_RET | BPF_A, 0x0),
5314 		},
5315 		CLASSIC,
5316 		{
5317 			[0x1c] = 0xaa, [0x1d] = 0x55,
5318 			[0x1e] = 0xbb, [0x1f] = 0x66,
5319 			[0x20] = 0xcc, [0x21] = 0x77,
5320 			[0x22] = 0xdd, [0x23] = 0x88,
5321 			[0x24] = 0xee, [0x25] = 0x99,
5322 			[0x26] = 0xff, [0x27] = 0xaa,
5323 		},
5324 		{ {0x40, 0x55bb66cc } },
5325 	},
5326 	{
5327 		"LD_IND word unaligned (addr & 3 == 3)",
5328 		.u.insns = {
5329 			BPF_STMT(BPF_LDX | BPF_IMM, 0x20),
5330 			BPF_STMT(BPF_LD | BPF_IND | BPF_W, -0x1),
5331 			BPF_STMT(BPF_RET | BPF_A, 0x0),
5332 		},
5333 		CLASSIC,
5334 		{
5335 			[0x1c] = 0xaa, [0x1d] = 0x55,
5336 			[0x1e] = 0xbb, [0x1f] = 0x66,
5337 			[0x20] = 0xcc, [0x21] = 0x77,
5338 			[0x22] = 0xdd, [0x23] = 0x88,
5339 			[0x24] = 0xee, [0x25] = 0x99,
5340 			[0x26] = 0xff, [0x27] = 0xaa,
5341 		},
5342 		{ {0x40, 0x66cc77dd } },
5343 	},
5344 	{
5345 		"LD_ABS byte",
5346 		.u.insns = {
5347 			BPF_STMT(BPF_LD | BPF_ABS | BPF_B, 0x20),
5348 			BPF_STMT(BPF_RET | BPF_A, 0x0),
5349 		},
5350 		CLASSIC,
5351 		{
5352 			[0x1c] = 0xaa, [0x1d] = 0x55,
5353 			[0x1e] = 0xbb, [0x1f] = 0x66,
5354 			[0x20] = 0xcc, [0x21] = 0x77,
5355 			[0x22] = 0xdd, [0x23] = 0x88,
5356 			[0x24] = 0xee, [0x25] = 0x99,
5357 			[0x26] = 0xff, [0x27] = 0xaa,
5358 		},
5359 		{ {0x40, 0xcc } },
5360 	},
5361 	{
5362 		"LD_ABS halfword",
5363 		.u.insns = {
5364 			BPF_STMT(BPF_LD | BPF_ABS | BPF_H, 0x22),
5365 			BPF_STMT(BPF_RET | BPF_A, 0x0),
5366 		},
5367 		CLASSIC,
5368 		{
5369 			[0x1c] = 0xaa, [0x1d] = 0x55,
5370 			[0x1e] = 0xbb, [0x1f] = 0x66,
5371 			[0x20] = 0xcc, [0x21] = 0x77,
5372 			[0x22] = 0xdd, [0x23] = 0x88,
5373 			[0x24] = 0xee, [0x25] = 0x99,
5374 			[0x26] = 0xff, [0x27] = 0xaa,
5375 		},
5376 		{ {0x40, 0xdd88 } },
5377 	},
5378 	{
5379 		"LD_ABS halfword unaligned",
5380 		.u.insns = {
5381 			BPF_STMT(BPF_LD | BPF_ABS | BPF_H, 0x25),
5382 			BPF_STMT(BPF_RET | BPF_A, 0x0),
5383 		},
5384 		CLASSIC,
5385 		{
5386 			[0x1c] = 0xaa, [0x1d] = 0x55,
5387 			[0x1e] = 0xbb, [0x1f] = 0x66,
5388 			[0x20] = 0xcc, [0x21] = 0x77,
5389 			[0x22] = 0xdd, [0x23] = 0x88,
5390 			[0x24] = 0xee, [0x25] = 0x99,
5391 			[0x26] = 0xff, [0x27] = 0xaa,
5392 		},
5393 		{ {0x40, 0x99ff } },
5394 	},
5395 	{
5396 		"LD_ABS word",
5397 		.u.insns = {
5398 			BPF_STMT(BPF_LD | BPF_ABS | BPF_W, 0x1c),
5399 			BPF_STMT(BPF_RET | BPF_A, 0x0),
5400 		},
5401 		CLASSIC,
5402 		{
5403 			[0x1c] = 0xaa, [0x1d] = 0x55,
5404 			[0x1e] = 0xbb, [0x1f] = 0x66,
5405 			[0x20] = 0xcc, [0x21] = 0x77,
5406 			[0x22] = 0xdd, [0x23] = 0x88,
5407 			[0x24] = 0xee, [0x25] = 0x99,
5408 			[0x26] = 0xff, [0x27] = 0xaa,
5409 		},
5410 		{ {0x40, 0xaa55bb66 } },
5411 	},
5412 	{
5413 		"LD_ABS word unaligned (addr & 3 == 2)",
5414 		.u.insns = {
5415 			BPF_STMT(BPF_LD | BPF_ABS | BPF_W, 0x22),
5416 			BPF_STMT(BPF_RET | BPF_A, 0x0),
5417 		},
5418 		CLASSIC,
5419 		{
5420 			[0x1c] = 0xaa, [0x1d] = 0x55,
5421 			[0x1e] = 0xbb, [0x1f] = 0x66,
5422 			[0x20] = 0xcc, [0x21] = 0x77,
5423 			[0x22] = 0xdd, [0x23] = 0x88,
5424 			[0x24] = 0xee, [0x25] = 0x99,
5425 			[0x26] = 0xff, [0x27] = 0xaa,
5426 		},
5427 		{ {0x40, 0xdd88ee99 } },
5428 	},
5429 	{
5430 		"LD_ABS word unaligned (addr & 3 == 1)",
5431 		.u.insns = {
5432 			BPF_STMT(BPF_LD | BPF_ABS | BPF_W, 0x21),
5433 			BPF_STMT(BPF_RET | BPF_A, 0x0),
5434 		},
5435 		CLASSIC,
5436 		{
5437 			[0x1c] = 0xaa, [0x1d] = 0x55,
5438 			[0x1e] = 0xbb, [0x1f] = 0x66,
5439 			[0x20] = 0xcc, [0x21] = 0x77,
5440 			[0x22] = 0xdd, [0x23] = 0x88,
5441 			[0x24] = 0xee, [0x25] = 0x99,
5442 			[0x26] = 0xff, [0x27] = 0xaa,
5443 		},
5444 		{ {0x40, 0x77dd88ee } },
5445 	},
5446 	{
5447 		"LD_ABS word unaligned (addr & 3 == 3)",
5448 		.u.insns = {
5449 			BPF_STMT(BPF_LD | BPF_ABS | BPF_W, 0x23),
5450 			BPF_STMT(BPF_RET | BPF_A, 0x0),
5451 		},
5452 		CLASSIC,
5453 		{
5454 			[0x1c] = 0xaa, [0x1d] = 0x55,
5455 			[0x1e] = 0xbb, [0x1f] = 0x66,
5456 			[0x20] = 0xcc, [0x21] = 0x77,
5457 			[0x22] = 0xdd, [0x23] = 0x88,
5458 			[0x24] = 0xee, [0x25] = 0x99,
5459 			[0x26] = 0xff, [0x27] = 0xaa,
5460 		},
5461 		{ {0x40, 0x88ee99ff } },
5462 	},
5463 	/*
5464 	 * verify that the interpreter or JIT correctly sets A and X
5465 	 * to 0.
5466 	 */
5467 	{
5468 		"ADD default X",
5469 		.u.insns = {
5470 			/*
5471 			 * A = 0x42
5472 			 * A = A + X
5473 			 * ret A
5474 			 */
5475 			BPF_STMT(BPF_LD | BPF_IMM, 0x42),
5476 			BPF_STMT(BPF_ALU | BPF_ADD | BPF_X, 0),
5477 			BPF_STMT(BPF_RET | BPF_A, 0x0),
5478 		},
5479 		CLASSIC | FLAG_NO_DATA,
5480 		{},
5481 		{ {0x1, 0x42 } },
5482 	},
5483 	{
5484 		"ADD default A",
5485 		.u.insns = {
5486 			/*
5487 			 * A = A + 0x42
5488 			 * ret A
5489 			 */
5490 			BPF_STMT(BPF_ALU | BPF_ADD | BPF_K, 0x42),
5491 			BPF_STMT(BPF_RET | BPF_A, 0x0),
5492 		},
5493 		CLASSIC | FLAG_NO_DATA,
5494 		{},
5495 		{ {0x1, 0x42 } },
5496 	},
5497 	{
5498 		"SUB default X",
5499 		.u.insns = {
5500 			/*
5501 			 * A = 0x66
5502 			 * A = A - X
5503 			 * ret A
5504 			 */
5505 			BPF_STMT(BPF_LD | BPF_IMM, 0x66),
5506 			BPF_STMT(BPF_ALU | BPF_SUB | BPF_X, 0),
5507 			BPF_STMT(BPF_RET | BPF_A, 0x0),
5508 		},
5509 		CLASSIC | FLAG_NO_DATA,
5510 		{},
5511 		{ {0x1, 0x66 } },
5512 	},
5513 	{
5514 		"SUB default A",
5515 		.u.insns = {
5516 			/*
5517 			 * A = A - -0x66
5518 			 * ret A
5519 			 */
5520 			BPF_STMT(BPF_ALU | BPF_SUB | BPF_K, -0x66),
5521 			BPF_STMT(BPF_RET | BPF_A, 0x0),
5522 		},
5523 		CLASSIC | FLAG_NO_DATA,
5524 		{},
5525 		{ {0x1, 0x66 } },
5526 	},
5527 	{
5528 		"MUL default X",
5529 		.u.insns = {
5530 			/*
5531 			 * A = 0x42
5532 			 * A = A * X
5533 			 * ret A
5534 			 */
5535 			BPF_STMT(BPF_LD | BPF_IMM, 0x42),
5536 			BPF_STMT(BPF_ALU | BPF_MUL | BPF_X, 0),
5537 			BPF_STMT(BPF_RET | BPF_A, 0x0),
5538 		},
5539 		CLASSIC | FLAG_NO_DATA,
5540 		{},
5541 		{ {0x1, 0x0 } },
5542 	},
5543 	{
5544 		"MUL default A",
5545 		.u.insns = {
5546 			/*
5547 			 * A = A * 0x66
5548 			 * ret A
5549 			 */
5550 			BPF_STMT(BPF_ALU | BPF_MUL | BPF_K, 0x66),
5551 			BPF_STMT(BPF_RET | BPF_A, 0x0),
5552 		},
5553 		CLASSIC | FLAG_NO_DATA,
5554 		{},
5555 		{ {0x1, 0x0 } },
5556 	},
5557 	{
5558 		"DIV default X",
5559 		.u.insns = {
5560 			/*
5561 			 * A = 0x42
5562 			 * A = A / X ; this halt the filter execution if X is 0
5563 			 * ret 0x42
5564 			 */
5565 			BPF_STMT(BPF_LD | BPF_IMM, 0x42),
5566 			BPF_STMT(BPF_ALU | BPF_DIV | BPF_X, 0),
5567 			BPF_STMT(BPF_RET | BPF_K, 0x42),
5568 		},
5569 		CLASSIC | FLAG_NO_DATA,
5570 		{},
5571 		{ {0x1, 0x0 } },
5572 	},
5573 	{
5574 		"DIV default A",
5575 		.u.insns = {
5576 			/*
5577 			 * A = A / 1
5578 			 * ret A
5579 			 */
5580 			BPF_STMT(BPF_ALU | BPF_DIV | BPF_K, 0x1),
5581 			BPF_STMT(BPF_RET | BPF_A, 0x0),
5582 		},
5583 		CLASSIC | FLAG_NO_DATA,
5584 		{},
5585 		{ {0x1, 0x0 } },
5586 	},
5587 	{
5588 		"MOD default X",
5589 		.u.insns = {
5590 			/*
5591 			 * A = 0x42
5592 			 * A = A mod X ; this halt the filter execution if X is 0
5593 			 * ret 0x42
5594 			 */
5595 			BPF_STMT(BPF_LD | BPF_IMM, 0x42),
5596 			BPF_STMT(BPF_ALU | BPF_MOD | BPF_X, 0),
5597 			BPF_STMT(BPF_RET | BPF_K, 0x42),
5598 		},
5599 		CLASSIC | FLAG_NO_DATA,
5600 		{},
5601 		{ {0x1, 0x0 } },
5602 	},
5603 	{
5604 		"MOD default A",
5605 		.u.insns = {
5606 			/*
5607 			 * A = A mod 1
5608 			 * ret A
5609 			 */
5610 			BPF_STMT(BPF_ALU | BPF_MOD | BPF_K, 0x1),
5611 			BPF_STMT(BPF_RET | BPF_A, 0x0),
5612 		},
5613 		CLASSIC | FLAG_NO_DATA,
5614 		{},
5615 		{ {0x1, 0x0 } },
5616 	},
5617 	{
5618 		"JMP EQ default A",
5619 		.u.insns = {
5620 			/*
5621 			 * cmp A, 0x0, 0, 1
5622 			 * ret 0x42
5623 			 * ret 0x66
5624 			 */
5625 			BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, 0x0, 0, 1),
5626 			BPF_STMT(BPF_RET | BPF_K, 0x42),
5627 			BPF_STMT(BPF_RET | BPF_K, 0x66),
5628 		},
5629 		CLASSIC | FLAG_NO_DATA,
5630 		{},
5631 		{ {0x1, 0x42 } },
5632 	},
5633 	{
5634 		"JMP EQ default X",
5635 		.u.insns = {
5636 			/*
5637 			 * A = 0x0
5638 			 * cmp A, X, 0, 1
5639 			 * ret 0x42
5640 			 * ret 0x66
5641 			 */
5642 			BPF_STMT(BPF_LD | BPF_IMM, 0x0),
5643 			BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_X, 0x0, 0, 1),
5644 			BPF_STMT(BPF_RET | BPF_K, 0x42),
5645 			BPF_STMT(BPF_RET | BPF_K, 0x66),
5646 		},
5647 		CLASSIC | FLAG_NO_DATA,
5648 		{},
5649 		{ {0x1, 0x42 } },
5650 	},
5651 };
5652 
5653 static struct net_device dev;
5654 
5655 static struct sk_buff *populate_skb(char *buf, int size)
5656 {
5657 	struct sk_buff *skb;
5658 
5659 	if (size >= MAX_DATA)
5660 		return NULL;
5661 
5662 	skb = alloc_skb(MAX_DATA, GFP_KERNEL);
5663 	if (!skb)
5664 		return NULL;
5665 
5666 	memcpy(__skb_put(skb, size), buf, size);
5667 
5668 	/* Initialize a fake skb with test pattern. */
5669 	skb_reset_mac_header(skb);
5670 	skb->protocol = htons(ETH_P_IP);
5671 	skb->pkt_type = SKB_TYPE;
5672 	skb->mark = SKB_MARK;
5673 	skb->hash = SKB_HASH;
5674 	skb->queue_mapping = SKB_QUEUE_MAP;
5675 	skb->vlan_tci = SKB_VLAN_TCI;
5676 	skb->vlan_proto = htons(ETH_P_IP);
5677 	skb->dev = &dev;
5678 	skb->dev->ifindex = SKB_DEV_IFINDEX;
5679 	skb->dev->type = SKB_DEV_TYPE;
5680 	skb_set_network_header(skb, min(size, ETH_HLEN));
5681 
5682 	return skb;
5683 }
5684 
5685 static void *generate_test_data(struct bpf_test *test, int sub)
5686 {
5687 	struct sk_buff *skb;
5688 	struct page *page;
5689 
5690 	if (test->aux & FLAG_NO_DATA)
5691 		return NULL;
5692 
5693 	/* Test case expects an skb, so populate one. Various
5694 	 * subtests generate skbs of different sizes based on
5695 	 * the same data.
5696 	 */
5697 	skb = populate_skb(test->data, test->test[sub].data_size);
5698 	if (!skb)
5699 		return NULL;
5700 
5701 	if (test->aux & FLAG_SKB_FRAG) {
5702 		/*
5703 		 * when the test requires a fragmented skb, add a
5704 		 * single fragment to the skb, filled with
5705 		 * test->frag_data.
5706 		 */
5707 		void *ptr;
5708 
5709 		page = alloc_page(GFP_KERNEL);
5710 
5711 		if (!page)
5712 			goto err_kfree_skb;
5713 
5714 		ptr = kmap(page);
5715 		if (!ptr)
5716 			goto err_free_page;
5717 		memcpy(ptr, test->frag_data, MAX_DATA);
5718 		kunmap(page);
5719 		skb_add_rx_frag(skb, 0, page, 0, MAX_DATA, MAX_DATA);
5720 	}
5721 
5722 	return skb;
5723 
5724 err_free_page:
5725 	__free_page(page);
5726 err_kfree_skb:
5727 	kfree_skb(skb);
5728 	return NULL;
5729 }
5730 
5731 static void release_test_data(const struct bpf_test *test, void *data)
5732 {
5733 	if (test->aux & FLAG_NO_DATA)
5734 		return;
5735 
5736 	kfree_skb(data);
5737 }
5738 
5739 static int filter_length(int which)
5740 {
5741 	struct sock_filter *fp;
5742 	int len;
5743 
5744 	if (tests[which].fill_helper)
5745 		return tests[which].u.ptr.len;
5746 
5747 	fp = tests[which].u.insns;
5748 	for (len = MAX_INSNS - 1; len > 0; --len)
5749 		if (fp[len].code != 0 || fp[len].k != 0)
5750 			break;
5751 
5752 	return len + 1;
5753 }
5754 
5755 static void *filter_pointer(int which)
5756 {
5757 	if (tests[which].fill_helper)
5758 		return tests[which].u.ptr.insns;
5759 	else
5760 		return tests[which].u.insns;
5761 }
5762 
5763 static struct bpf_prog *generate_filter(int which, int *err)
5764 {
5765 	__u8 test_type = tests[which].aux & TEST_TYPE_MASK;
5766 	unsigned int flen = filter_length(which);
5767 	void *fptr = filter_pointer(which);
5768 	struct sock_fprog_kern fprog;
5769 	struct bpf_prog *fp;
5770 
5771 	switch (test_type) {
5772 	case CLASSIC:
5773 		fprog.filter = fptr;
5774 		fprog.len = flen;
5775 
5776 		*err = bpf_prog_create(&fp, &fprog);
5777 		if (tests[which].aux & FLAG_EXPECTED_FAIL) {
5778 			if (*err == -EINVAL) {
5779 				pr_cont("PASS\n");
5780 				/* Verifier rejected filter as expected. */
5781 				*err = 0;
5782 				return NULL;
5783 			} else {
5784 				pr_cont("UNEXPECTED_PASS\n");
5785 				/* Verifier didn't reject the test that's
5786 				 * bad enough, just return!
5787 				 */
5788 				*err = -EINVAL;
5789 				return NULL;
5790 			}
5791 		}
5792 		/* We don't expect to fail. */
5793 		if (*err) {
5794 			pr_cont("FAIL to attach err=%d len=%d\n",
5795 				*err, fprog.len);
5796 			return NULL;
5797 		}
5798 		break;
5799 
5800 	case INTERNAL:
5801 		fp = bpf_prog_alloc(bpf_prog_size(flen), 0);
5802 		if (fp == NULL) {
5803 			pr_cont("UNEXPECTED_FAIL no memory left\n");
5804 			*err = -ENOMEM;
5805 			return NULL;
5806 		}
5807 
5808 		fp->len = flen;
5809 		/* Type doesn't really matter here as long as it's not unspec. */
5810 		fp->type = BPF_PROG_TYPE_SOCKET_FILTER;
5811 		memcpy(fp->insnsi, fptr, fp->len * sizeof(struct bpf_insn));
5812 
5813 		/* We cannot error here as we don't need type compatibility
5814 		 * checks.
5815 		 */
5816 		fp = bpf_prog_select_runtime(fp, err);
5817 		break;
5818 	}
5819 
5820 	*err = 0;
5821 	return fp;
5822 }
5823 
5824 static void release_filter(struct bpf_prog *fp, int which)
5825 {
5826 	__u8 test_type = tests[which].aux & TEST_TYPE_MASK;
5827 
5828 	switch (test_type) {
5829 	case CLASSIC:
5830 		bpf_prog_destroy(fp);
5831 		break;
5832 	case INTERNAL:
5833 		bpf_prog_free(fp);
5834 		break;
5835 	}
5836 }
5837 
5838 static int __run_one(const struct bpf_prog *fp, const void *data,
5839 		     int runs, u64 *duration)
5840 {
5841 	u64 start, finish;
5842 	int ret = 0, i;
5843 
5844 	start = ktime_get_ns();
5845 
5846 	for (i = 0; i < runs; i++)
5847 		ret = BPF_PROG_RUN(fp, data);
5848 
5849 	finish = ktime_get_ns();
5850 
5851 	*duration = finish - start;
5852 	do_div(*duration, runs);
5853 
5854 	return ret;
5855 }
5856 
5857 static int run_one(const struct bpf_prog *fp, struct bpf_test *test)
5858 {
5859 	int err_cnt = 0, i, runs = MAX_TESTRUNS;
5860 
5861 	for (i = 0; i < MAX_SUBTESTS; i++) {
5862 		void *data;
5863 		u64 duration;
5864 		u32 ret;
5865 
5866 		if (test->test[i].data_size == 0 &&
5867 		    test->test[i].result == 0)
5868 			break;
5869 
5870 		data = generate_test_data(test, i);
5871 		if (!data && !(test->aux & FLAG_NO_DATA)) {
5872 			pr_cont("data generation failed ");
5873 			err_cnt++;
5874 			break;
5875 		}
5876 		ret = __run_one(fp, data, runs, &duration);
5877 		release_test_data(test, data);
5878 
5879 		if (ret == test->test[i].result) {
5880 			pr_cont("%lld ", duration);
5881 		} else {
5882 			pr_cont("ret %d != %d ", ret,
5883 				test->test[i].result);
5884 			err_cnt++;
5885 		}
5886 	}
5887 
5888 	return err_cnt;
5889 }
5890 
5891 static char test_name[64];
5892 module_param_string(test_name, test_name, sizeof(test_name), 0);
5893 
5894 static int test_id = -1;
5895 module_param(test_id, int, 0);
5896 
5897 static int test_range[2] = { 0, ARRAY_SIZE(tests) - 1 };
5898 module_param_array(test_range, int, NULL, 0);
5899 
5900 static __init int find_test_index(const char *test_name)
5901 {
5902 	int i;
5903 
5904 	for (i = 0; i < ARRAY_SIZE(tests); i++) {
5905 		if (!strcmp(tests[i].descr, test_name))
5906 			return i;
5907 	}
5908 	return -1;
5909 }
5910 
5911 static __init int prepare_bpf_tests(void)
5912 {
5913 	int i;
5914 
5915 	if (test_id >= 0) {
5916 		/*
5917 		 * if a test_id was specified, use test_range to
5918 		 * cover only that test.
5919 		 */
5920 		if (test_id >= ARRAY_SIZE(tests)) {
5921 			pr_err("test_bpf: invalid test_id specified.\n");
5922 			return -EINVAL;
5923 		}
5924 
5925 		test_range[0] = test_id;
5926 		test_range[1] = test_id;
5927 	} else if (*test_name) {
5928 		/*
5929 		 * if a test_name was specified, find it and setup
5930 		 * test_range to cover only that test.
5931 		 */
5932 		int idx = find_test_index(test_name);
5933 
5934 		if (idx < 0) {
5935 			pr_err("test_bpf: no test named '%s' found.\n",
5936 			       test_name);
5937 			return -EINVAL;
5938 		}
5939 		test_range[0] = idx;
5940 		test_range[1] = idx;
5941 	} else {
5942 		/*
5943 		 * check that the supplied test_range is valid.
5944 		 */
5945 		if (test_range[0] >= ARRAY_SIZE(tests) ||
5946 		    test_range[1] >= ARRAY_SIZE(tests) ||
5947 		    test_range[0] < 0 || test_range[1] < 0) {
5948 			pr_err("test_bpf: test_range is out of bound.\n");
5949 			return -EINVAL;
5950 		}
5951 
5952 		if (test_range[1] < test_range[0]) {
5953 			pr_err("test_bpf: test_range is ending before it starts.\n");
5954 			return -EINVAL;
5955 		}
5956 	}
5957 
5958 	for (i = 0; i < ARRAY_SIZE(tests); i++) {
5959 		if (tests[i].fill_helper &&
5960 		    tests[i].fill_helper(&tests[i]) < 0)
5961 			return -ENOMEM;
5962 	}
5963 
5964 	return 0;
5965 }
5966 
5967 static __init void destroy_bpf_tests(void)
5968 {
5969 	int i;
5970 
5971 	for (i = 0; i < ARRAY_SIZE(tests); i++) {
5972 		if (tests[i].fill_helper)
5973 			kfree(tests[i].u.ptr.insns);
5974 	}
5975 }
5976 
5977 static bool exclude_test(int test_id)
5978 {
5979 	return test_id < test_range[0] || test_id > test_range[1];
5980 }
5981 
5982 static __init int test_bpf(void)
5983 {
5984 	int i, err_cnt = 0, pass_cnt = 0;
5985 	int jit_cnt = 0, run_cnt = 0;
5986 
5987 	for (i = 0; i < ARRAY_SIZE(tests); i++) {
5988 		struct bpf_prog *fp;
5989 		int err;
5990 
5991 		if (exclude_test(i))
5992 			continue;
5993 
5994 		pr_info("#%d %s ", i, tests[i].descr);
5995 
5996 		fp = generate_filter(i, &err);
5997 		if (fp == NULL) {
5998 			if (err == 0) {
5999 				pass_cnt++;
6000 				continue;
6001 			}
6002 
6003 			return err;
6004 		}
6005 
6006 		pr_cont("jited:%u ", fp->jited);
6007 
6008 		run_cnt++;
6009 		if (fp->jited)
6010 			jit_cnt++;
6011 
6012 		err = run_one(fp, &tests[i]);
6013 		release_filter(fp, i);
6014 
6015 		if (err) {
6016 			pr_cont("FAIL (%d times)\n", err);
6017 			err_cnt++;
6018 		} else {
6019 			pr_cont("PASS\n");
6020 			pass_cnt++;
6021 		}
6022 	}
6023 
6024 	pr_info("Summary: %d PASSED, %d FAILED, [%d/%d JIT'ed]\n",
6025 		pass_cnt, err_cnt, jit_cnt, run_cnt);
6026 
6027 	return err_cnt ? -EINVAL : 0;
6028 }
6029 
6030 static int __init test_bpf_init(void)
6031 {
6032 	int ret;
6033 
6034 	ret = prepare_bpf_tests();
6035 	if (ret < 0)
6036 		return ret;
6037 
6038 	ret = test_bpf();
6039 
6040 	destroy_bpf_tests();
6041 	return ret;
6042 }
6043 
6044 static void __exit test_bpf_exit(void)
6045 {
6046 }
6047 
6048 module_init(test_bpf_init);
6049 module_exit(test_bpf_exit);
6050 
6051 MODULE_LICENSE("GPL");
6052