2 "access skb fields ok",
4 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
5 offsetof(struct __sk_buff
, len
)),
6 BPF_JMP_IMM(BPF_JGE
, BPF_REG_0
, 0, 1),
7 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
8 offsetof(struct __sk_buff
, mark
)),
9 BPF_JMP_IMM(BPF_JGE
, BPF_REG_0
, 0, 1),
10 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
11 offsetof(struct __sk_buff
, pkt_type
)),
12 BPF_JMP_IMM(BPF_JGE
, BPF_REG_0
, 0, 1),
13 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
14 offsetof(struct __sk_buff
, queue_mapping
)),
15 BPF_JMP_IMM(BPF_JGE
, BPF_REG_0
, 0, 0),
16 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
17 offsetof(struct __sk_buff
, protocol
)),
18 BPF_JMP_IMM(BPF_JGE
, BPF_REG_0
, 0, 0),
19 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
20 offsetof(struct __sk_buff
, vlan_present
)),
21 BPF_JMP_IMM(BPF_JGE
, BPF_REG_0
, 0, 0),
22 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
23 offsetof(struct __sk_buff
, vlan_tci
)),
24 BPF_JMP_IMM(BPF_JGE
, BPF_REG_0
, 0, 0),
25 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
26 offsetof(struct __sk_buff
, napi_id
)),
27 BPF_JMP_IMM(BPF_JGE
, BPF_REG_0
, 0, 0),
33 "access skb fields bad1",
35 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
, -4),
38 .errstr
= "invalid bpf_context access",
42 "access skb fields bad2",
44 BPF_JMP_IMM(BPF_JGE
, BPF_REG_1
, 0, 9),
45 BPF_ST_MEM(BPF_DW
, BPF_REG_10
, -8, 0),
46 BPF_MOV64_REG(BPF_REG_2
, BPF_REG_10
),
47 BPF_ALU64_IMM(BPF_ADD
, BPF_REG_2
, -8),
48 BPF_LD_MAP_FD(BPF_REG_1
, 0),
49 BPF_RAW_INSN(BPF_JMP
| BPF_CALL
, 0, 0, 0, BPF_FUNC_map_lookup_elem
),
50 BPF_JMP_IMM(BPF_JNE
, BPF_REG_0
, 0, 1),
52 BPF_MOV64_REG(BPF_REG_1
, BPF_REG_0
),
53 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
54 offsetof(struct __sk_buff
, pkt_type
)),
57 .fixup_map_hash_8b
= { 4 },
58 .errstr
= "different pointers",
59 .errstr_unpriv
= "R1 pointer comparison",
63 "access skb fields bad3",
65 BPF_JMP_IMM(BPF_JGE
, BPF_REG_1
, 0, 2),
66 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
67 offsetof(struct __sk_buff
, pkt_type
)),
69 BPF_ST_MEM(BPF_DW
, BPF_REG_10
, -8, 0),
70 BPF_MOV64_REG(BPF_REG_2
, BPF_REG_10
),
71 BPF_ALU64_IMM(BPF_ADD
, BPF_REG_2
, -8),
72 BPF_LD_MAP_FD(BPF_REG_1
, 0),
73 BPF_RAW_INSN(BPF_JMP
| BPF_CALL
, 0, 0, 0, BPF_FUNC_map_lookup_elem
),
74 BPF_JMP_IMM(BPF_JNE
, BPF_REG_0
, 0, 1),
76 BPF_MOV64_REG(BPF_REG_1
, BPF_REG_0
),
77 BPF_JMP_IMM(BPF_JA
, 0, 0, -12),
79 .fixup_map_hash_8b
= { 6 },
80 .errstr
= "different pointers",
81 .errstr_unpriv
= "R1 pointer comparison",
85 "access skb fields bad4",
87 BPF_JMP_IMM(BPF_JGE
, BPF_REG_1
, 0, 3),
88 BPF_LDX_MEM(BPF_W
, BPF_REG_1
, BPF_REG_1
,
89 offsetof(struct __sk_buff
, len
)),
90 BPF_MOV64_IMM(BPF_REG_0
, 0),
92 BPF_ST_MEM(BPF_DW
, BPF_REG_10
, -8, 0),
93 BPF_MOV64_REG(BPF_REG_2
, BPF_REG_10
),
94 BPF_ALU64_IMM(BPF_ADD
, BPF_REG_2
, -8),
95 BPF_LD_MAP_FD(BPF_REG_1
, 0),
96 BPF_RAW_INSN(BPF_JMP
| BPF_CALL
, 0, 0, 0, BPF_FUNC_map_lookup_elem
),
97 BPF_JMP_IMM(BPF_JNE
, BPF_REG_0
, 0, 1),
99 BPF_MOV64_REG(BPF_REG_1
, BPF_REG_0
),
100 BPF_JMP_IMM(BPF_JA
, 0, 0, -13),
102 .fixup_map_hash_8b
= { 7 },
103 .errstr
= "different pointers",
104 .errstr_unpriv
= "R1 pointer comparison",
108 "invalid access __sk_buff family",
110 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
111 offsetof(struct __sk_buff
, family
)),
114 .errstr
= "invalid bpf_context access",
118 "invalid access __sk_buff remote_ip4",
120 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
121 offsetof(struct __sk_buff
, remote_ip4
)),
124 .errstr
= "invalid bpf_context access",
128 "invalid access __sk_buff local_ip4",
130 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
131 offsetof(struct __sk_buff
, local_ip4
)),
134 .errstr
= "invalid bpf_context access",
138 "invalid access __sk_buff remote_ip6",
140 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
141 offsetof(struct __sk_buff
, remote_ip6
)),
144 .errstr
= "invalid bpf_context access",
148 "invalid access __sk_buff local_ip6",
150 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
151 offsetof(struct __sk_buff
, local_ip6
)),
154 .errstr
= "invalid bpf_context access",
158 "invalid access __sk_buff remote_port",
160 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
161 offsetof(struct __sk_buff
, remote_port
)),
164 .errstr
= "invalid bpf_context access",
168 "invalid access __sk_buff remote_port",
170 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
171 offsetof(struct __sk_buff
, local_port
)),
174 .errstr
= "invalid bpf_context access",
178 "valid access __sk_buff family",
180 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
181 offsetof(struct __sk_buff
, family
)),
185 .prog_type
= BPF_PROG_TYPE_SK_SKB
,
188 "valid access __sk_buff remote_ip4",
190 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
191 offsetof(struct __sk_buff
, remote_ip4
)),
195 .prog_type
= BPF_PROG_TYPE_SK_SKB
,
198 "valid access __sk_buff local_ip4",
200 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
201 offsetof(struct __sk_buff
, local_ip4
)),
205 .prog_type
= BPF_PROG_TYPE_SK_SKB
,
208 "valid access __sk_buff remote_ip6",
210 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
211 offsetof(struct __sk_buff
, remote_ip6
[0])),
212 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
213 offsetof(struct __sk_buff
, remote_ip6
[1])),
214 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
215 offsetof(struct __sk_buff
, remote_ip6
[2])),
216 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
217 offsetof(struct __sk_buff
, remote_ip6
[3])),
221 .prog_type
= BPF_PROG_TYPE_SK_SKB
,
224 "valid access __sk_buff local_ip6",
226 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
227 offsetof(struct __sk_buff
, local_ip6
[0])),
228 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
229 offsetof(struct __sk_buff
, local_ip6
[1])),
230 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
231 offsetof(struct __sk_buff
, local_ip6
[2])),
232 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
233 offsetof(struct __sk_buff
, local_ip6
[3])),
237 .prog_type
= BPF_PROG_TYPE_SK_SKB
,
240 "valid access __sk_buff remote_port",
242 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
243 offsetof(struct __sk_buff
, remote_port
)),
247 .prog_type
= BPF_PROG_TYPE_SK_SKB
,
250 "valid access __sk_buff remote_port",
252 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
253 offsetof(struct __sk_buff
, local_port
)),
257 .prog_type
= BPF_PROG_TYPE_SK_SKB
,
260 "invalid access of tc_classid for SK_SKB",
262 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
263 offsetof(struct __sk_buff
, tc_classid
)),
267 .prog_type
= BPF_PROG_TYPE_SK_SKB
,
268 .errstr
= "invalid bpf_context access",
271 "invalid access of skb->mark for SK_SKB",
273 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
274 offsetof(struct __sk_buff
, mark
)),
278 .prog_type
= BPF_PROG_TYPE_SK_SKB
,
279 .errstr
= "invalid bpf_context access",
282 "check skb->mark is not writeable by SK_SKB",
284 BPF_MOV64_IMM(BPF_REG_0
, 0),
285 BPF_STX_MEM(BPF_W
, BPF_REG_1
, BPF_REG_0
,
286 offsetof(struct __sk_buff
, mark
)),
290 .prog_type
= BPF_PROG_TYPE_SK_SKB
,
291 .errstr
= "invalid bpf_context access",
294 "check skb->tc_index is writeable by SK_SKB",
296 BPF_MOV64_IMM(BPF_REG_0
, 0),
297 BPF_STX_MEM(BPF_W
, BPF_REG_1
, BPF_REG_0
,
298 offsetof(struct __sk_buff
, tc_index
)),
302 .prog_type
= BPF_PROG_TYPE_SK_SKB
,
305 "check skb->priority is writeable by SK_SKB",
307 BPF_MOV64_IMM(BPF_REG_0
, 0),
308 BPF_STX_MEM(BPF_W
, BPF_REG_1
, BPF_REG_0
,
309 offsetof(struct __sk_buff
, priority
)),
313 .prog_type
= BPF_PROG_TYPE_SK_SKB
,
316 "direct packet read for SK_SKB",
318 BPF_LDX_MEM(BPF_W
, BPF_REG_2
, BPF_REG_1
,
319 offsetof(struct __sk_buff
, data
)),
320 BPF_LDX_MEM(BPF_W
, BPF_REG_3
, BPF_REG_1
,
321 offsetof(struct __sk_buff
, data_end
)),
322 BPF_MOV64_REG(BPF_REG_0
, BPF_REG_2
),
323 BPF_ALU64_IMM(BPF_ADD
, BPF_REG_0
, 8),
324 BPF_JMP_REG(BPF_JGT
, BPF_REG_0
, BPF_REG_3
, 1),
325 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_2
, 0),
326 BPF_MOV64_IMM(BPF_REG_0
, 0),
330 .prog_type
= BPF_PROG_TYPE_SK_SKB
,
333 "direct packet write for SK_SKB",
335 BPF_LDX_MEM(BPF_W
, BPF_REG_2
, BPF_REG_1
,
336 offsetof(struct __sk_buff
, data
)),
337 BPF_LDX_MEM(BPF_W
, BPF_REG_3
, BPF_REG_1
,
338 offsetof(struct __sk_buff
, data_end
)),
339 BPF_MOV64_REG(BPF_REG_0
, BPF_REG_2
),
340 BPF_ALU64_IMM(BPF_ADD
, BPF_REG_0
, 8),
341 BPF_JMP_REG(BPF_JGT
, BPF_REG_0
, BPF_REG_3
, 1),
342 BPF_STX_MEM(BPF_B
, BPF_REG_2
, BPF_REG_2
, 0),
343 BPF_MOV64_IMM(BPF_REG_0
, 0),
347 .prog_type
= BPF_PROG_TYPE_SK_SKB
,
350 "overlapping checks for direct packet access SK_SKB",
352 BPF_LDX_MEM(BPF_W
, BPF_REG_2
, BPF_REG_1
,
353 offsetof(struct __sk_buff
, data
)),
354 BPF_LDX_MEM(BPF_W
, BPF_REG_3
, BPF_REG_1
,
355 offsetof(struct __sk_buff
, data_end
)),
356 BPF_MOV64_REG(BPF_REG_0
, BPF_REG_2
),
357 BPF_ALU64_IMM(BPF_ADD
, BPF_REG_0
, 8),
358 BPF_JMP_REG(BPF_JGT
, BPF_REG_0
, BPF_REG_3
, 4),
359 BPF_MOV64_REG(BPF_REG_1
, BPF_REG_2
),
360 BPF_ALU64_IMM(BPF_ADD
, BPF_REG_1
, 6),
361 BPF_JMP_REG(BPF_JGT
, BPF_REG_1
, BPF_REG_3
, 1),
362 BPF_LDX_MEM(BPF_H
, BPF_REG_0
, BPF_REG_2
, 6),
363 BPF_MOV64_IMM(BPF_REG_0
, 0),
367 .prog_type
= BPF_PROG_TYPE_SK_SKB
,
370 "check skb->mark is not writeable by sockets",
372 BPF_STX_MEM(BPF_W
, BPF_REG_1
, BPF_REG_1
,
373 offsetof(struct __sk_buff
, mark
)),
376 .errstr
= "invalid bpf_context access",
377 .errstr_unpriv
= "R1 leaks addr",
381 "check skb->tc_index is not writeable by sockets",
383 BPF_STX_MEM(BPF_W
, BPF_REG_1
, BPF_REG_1
,
384 offsetof(struct __sk_buff
, tc_index
)),
387 .errstr
= "invalid bpf_context access",
388 .errstr_unpriv
= "R1 leaks addr",
392 "check cb access: byte",
394 BPF_MOV64_IMM(BPF_REG_0
, 0),
395 BPF_STX_MEM(BPF_B
, BPF_REG_1
, BPF_REG_0
,
396 offsetof(struct __sk_buff
, cb
[0])),
397 BPF_STX_MEM(BPF_B
, BPF_REG_1
, BPF_REG_0
,
398 offsetof(struct __sk_buff
, cb
[0]) + 1),
399 BPF_STX_MEM(BPF_B
, BPF_REG_1
, BPF_REG_0
,
400 offsetof(struct __sk_buff
, cb
[0]) + 2),
401 BPF_STX_MEM(BPF_B
, BPF_REG_1
, BPF_REG_0
,
402 offsetof(struct __sk_buff
, cb
[0]) + 3),
403 BPF_STX_MEM(BPF_B
, BPF_REG_1
, BPF_REG_0
,
404 offsetof(struct __sk_buff
, cb
[1])),
405 BPF_STX_MEM(BPF_B
, BPF_REG_1
, BPF_REG_0
,
406 offsetof(struct __sk_buff
, cb
[1]) + 1),
407 BPF_STX_MEM(BPF_B
, BPF_REG_1
, BPF_REG_0
,
408 offsetof(struct __sk_buff
, cb
[1]) + 2),
409 BPF_STX_MEM(BPF_B
, BPF_REG_1
, BPF_REG_0
,
410 offsetof(struct __sk_buff
, cb
[1]) + 3),
411 BPF_STX_MEM(BPF_B
, BPF_REG_1
, BPF_REG_0
,
412 offsetof(struct __sk_buff
, cb
[2])),
413 BPF_STX_MEM(BPF_B
, BPF_REG_1
, BPF_REG_0
,
414 offsetof(struct __sk_buff
, cb
[2]) + 1),
415 BPF_STX_MEM(BPF_B
, BPF_REG_1
, BPF_REG_0
,
416 offsetof(struct __sk_buff
, cb
[2]) + 2),
417 BPF_STX_MEM(BPF_B
, BPF_REG_1
, BPF_REG_0
,
418 offsetof(struct __sk_buff
, cb
[2]) + 3),
419 BPF_STX_MEM(BPF_B
, BPF_REG_1
, BPF_REG_0
,
420 offsetof(struct __sk_buff
, cb
[3])),
421 BPF_STX_MEM(BPF_B
, BPF_REG_1
, BPF_REG_0
,
422 offsetof(struct __sk_buff
, cb
[3]) + 1),
423 BPF_STX_MEM(BPF_B
, BPF_REG_1
, BPF_REG_0
,
424 offsetof(struct __sk_buff
, cb
[3]) + 2),
425 BPF_STX_MEM(BPF_B
, BPF_REG_1
, BPF_REG_0
,
426 offsetof(struct __sk_buff
, cb
[3]) + 3),
427 BPF_STX_MEM(BPF_B
, BPF_REG_1
, BPF_REG_0
,
428 offsetof(struct __sk_buff
, cb
[4])),
429 BPF_STX_MEM(BPF_B
, BPF_REG_1
, BPF_REG_0
,
430 offsetof(struct __sk_buff
, cb
[4]) + 1),
431 BPF_STX_MEM(BPF_B
, BPF_REG_1
, BPF_REG_0
,
432 offsetof(struct __sk_buff
, cb
[4]) + 2),
433 BPF_STX_MEM(BPF_B
, BPF_REG_1
, BPF_REG_0
,
434 offsetof(struct __sk_buff
, cb
[4]) + 3),
435 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
436 offsetof(struct __sk_buff
, cb
[0])),
437 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
438 offsetof(struct __sk_buff
, cb
[0]) + 1),
439 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
440 offsetof(struct __sk_buff
, cb
[0]) + 2),
441 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
442 offsetof(struct __sk_buff
, cb
[0]) + 3),
443 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
444 offsetof(struct __sk_buff
, cb
[1])),
445 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
446 offsetof(struct __sk_buff
, cb
[1]) + 1),
447 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
448 offsetof(struct __sk_buff
, cb
[1]) + 2),
449 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
450 offsetof(struct __sk_buff
, cb
[1]) + 3),
451 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
452 offsetof(struct __sk_buff
, cb
[2])),
453 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
454 offsetof(struct __sk_buff
, cb
[2]) + 1),
455 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
456 offsetof(struct __sk_buff
, cb
[2]) + 2),
457 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
458 offsetof(struct __sk_buff
, cb
[2]) + 3),
459 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
460 offsetof(struct __sk_buff
, cb
[3])),
461 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
462 offsetof(struct __sk_buff
, cb
[3]) + 1),
463 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
464 offsetof(struct __sk_buff
, cb
[3]) + 2),
465 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
466 offsetof(struct __sk_buff
, cb
[3]) + 3),
467 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
468 offsetof(struct __sk_buff
, cb
[4])),
469 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
470 offsetof(struct __sk_buff
, cb
[4]) + 1),
471 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
472 offsetof(struct __sk_buff
, cb
[4]) + 2),
473 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
474 offsetof(struct __sk_buff
, cb
[4]) + 3),
480 "__sk_buff->hash, offset 0, byte store not permitted",
482 BPF_MOV64_IMM(BPF_REG_0
, 0),
483 BPF_STX_MEM(BPF_B
, BPF_REG_1
, BPF_REG_0
,
484 offsetof(struct __sk_buff
, hash
)),
487 .errstr
= "invalid bpf_context access",
491 "__sk_buff->tc_index, offset 3, byte store not permitted",
493 BPF_MOV64_IMM(BPF_REG_0
, 0),
494 BPF_STX_MEM(BPF_B
, BPF_REG_1
, BPF_REG_0
,
495 offsetof(struct __sk_buff
, tc_index
) + 3),
498 .errstr
= "invalid bpf_context access",
502 "check skb->hash byte load permitted",
504 BPF_MOV64_IMM(BPF_REG_0
, 0),
505 #if __BYTE_ORDER == __LITTLE_ENDIAN
506 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
507 offsetof(struct __sk_buff
, hash
)),
509 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
510 offsetof(struct __sk_buff
, hash
) + 3),
517 "check skb->hash byte load permitted 1",
519 BPF_MOV64_IMM(BPF_REG_0
, 0),
520 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
521 offsetof(struct __sk_buff
, hash
) + 1),
527 "check skb->hash byte load permitted 2",
529 BPF_MOV64_IMM(BPF_REG_0
, 0),
530 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
531 offsetof(struct __sk_buff
, hash
) + 2),
537 "check skb->hash byte load permitted 3",
539 BPF_MOV64_IMM(BPF_REG_0
, 0),
540 #if __BYTE_ORDER == __LITTLE_ENDIAN
541 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
542 offsetof(struct __sk_buff
, hash
) + 3),
544 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
545 offsetof(struct __sk_buff
, hash
)),
552 "check cb access: byte, wrong type",
554 BPF_MOV64_IMM(BPF_REG_0
, 0),
555 BPF_STX_MEM(BPF_B
, BPF_REG_1
, BPF_REG_0
,
556 offsetof(struct __sk_buff
, cb
[0])),
559 .errstr
= "invalid bpf_context access",
561 .prog_type
= BPF_PROG_TYPE_CGROUP_SOCK
,
564 "check cb access: half",
566 BPF_MOV64_IMM(BPF_REG_0
, 0),
567 BPF_STX_MEM(BPF_H
, BPF_REG_1
, BPF_REG_0
,
568 offsetof(struct __sk_buff
, cb
[0])),
569 BPF_STX_MEM(BPF_H
, BPF_REG_1
, BPF_REG_0
,
570 offsetof(struct __sk_buff
, cb
[0]) + 2),
571 BPF_STX_MEM(BPF_H
, BPF_REG_1
, BPF_REG_0
,
572 offsetof(struct __sk_buff
, cb
[1])),
573 BPF_STX_MEM(BPF_H
, BPF_REG_1
, BPF_REG_0
,
574 offsetof(struct __sk_buff
, cb
[1]) + 2),
575 BPF_STX_MEM(BPF_H
, BPF_REG_1
, BPF_REG_0
,
576 offsetof(struct __sk_buff
, cb
[2])),
577 BPF_STX_MEM(BPF_H
, BPF_REG_1
, BPF_REG_0
,
578 offsetof(struct __sk_buff
, cb
[2]) + 2),
579 BPF_STX_MEM(BPF_H
, BPF_REG_1
, BPF_REG_0
,
580 offsetof(struct __sk_buff
, cb
[3])),
581 BPF_STX_MEM(BPF_H
, BPF_REG_1
, BPF_REG_0
,
582 offsetof(struct __sk_buff
, cb
[3]) + 2),
583 BPF_STX_MEM(BPF_H
, BPF_REG_1
, BPF_REG_0
,
584 offsetof(struct __sk_buff
, cb
[4])),
585 BPF_STX_MEM(BPF_H
, BPF_REG_1
, BPF_REG_0
,
586 offsetof(struct __sk_buff
, cb
[4]) + 2),
587 BPF_LDX_MEM(BPF_H
, BPF_REG_0
, BPF_REG_1
,
588 offsetof(struct __sk_buff
, cb
[0])),
589 BPF_LDX_MEM(BPF_H
, BPF_REG_0
, BPF_REG_1
,
590 offsetof(struct __sk_buff
, cb
[0]) + 2),
591 BPF_LDX_MEM(BPF_H
, BPF_REG_0
, BPF_REG_1
,
592 offsetof(struct __sk_buff
, cb
[1])),
593 BPF_LDX_MEM(BPF_H
, BPF_REG_0
, BPF_REG_1
,
594 offsetof(struct __sk_buff
, cb
[1]) + 2),
595 BPF_LDX_MEM(BPF_H
, BPF_REG_0
, BPF_REG_1
,
596 offsetof(struct __sk_buff
, cb
[2])),
597 BPF_LDX_MEM(BPF_H
, BPF_REG_0
, BPF_REG_1
,
598 offsetof(struct __sk_buff
, cb
[2]) + 2),
599 BPF_LDX_MEM(BPF_H
, BPF_REG_0
, BPF_REG_1
,
600 offsetof(struct __sk_buff
, cb
[3])),
601 BPF_LDX_MEM(BPF_H
, BPF_REG_0
, BPF_REG_1
,
602 offsetof(struct __sk_buff
, cb
[3]) + 2),
603 BPF_LDX_MEM(BPF_H
, BPF_REG_0
, BPF_REG_1
,
604 offsetof(struct __sk_buff
, cb
[4])),
605 BPF_LDX_MEM(BPF_H
, BPF_REG_0
, BPF_REG_1
,
606 offsetof(struct __sk_buff
, cb
[4]) + 2),
612 "check cb access: half, unaligned",
614 BPF_MOV64_IMM(BPF_REG_0
, 0),
615 BPF_STX_MEM(BPF_H
, BPF_REG_1
, BPF_REG_0
,
616 offsetof(struct __sk_buff
, cb
[0]) + 1),
619 .errstr
= "misaligned context access",
621 .flags
= F_LOAD_WITH_STRICT_ALIGNMENT
,
624 "check __sk_buff->hash, offset 0, half store not permitted",
626 BPF_MOV64_IMM(BPF_REG_0
, 0),
627 BPF_STX_MEM(BPF_H
, BPF_REG_1
, BPF_REG_0
,
628 offsetof(struct __sk_buff
, hash
)),
631 .errstr
= "invalid bpf_context access",
635 "check __sk_buff->tc_index, offset 2, half store not permitted",
637 BPF_MOV64_IMM(BPF_REG_0
, 0),
638 BPF_STX_MEM(BPF_H
, BPF_REG_1
, BPF_REG_0
,
639 offsetof(struct __sk_buff
, tc_index
) + 2),
642 .errstr
= "invalid bpf_context access",
646 "check skb->hash half load permitted",
648 BPF_MOV64_IMM(BPF_REG_0
, 0),
649 #if __BYTE_ORDER == __LITTLE_ENDIAN
650 BPF_LDX_MEM(BPF_H
, BPF_REG_0
, BPF_REG_1
,
651 offsetof(struct __sk_buff
, hash
)),
653 BPF_LDX_MEM(BPF_H
, BPF_REG_0
, BPF_REG_1
,
654 offsetof(struct __sk_buff
, hash
) + 2),
661 "check skb->hash half load permitted 2",
663 BPF_MOV64_IMM(BPF_REG_0
, 0),
664 #if __BYTE_ORDER == __LITTLE_ENDIAN
665 BPF_LDX_MEM(BPF_H
, BPF_REG_0
, BPF_REG_1
,
666 offsetof(struct __sk_buff
, hash
) + 2),
668 BPF_LDX_MEM(BPF_H
, BPF_REG_0
, BPF_REG_1
,
669 offsetof(struct __sk_buff
, hash
)),
676 "check skb->hash half load not permitted, unaligned 1",
678 BPF_MOV64_IMM(BPF_REG_0
, 0),
679 #if __BYTE_ORDER == __LITTLE_ENDIAN
680 BPF_LDX_MEM(BPF_H
, BPF_REG_0
, BPF_REG_1
,
681 offsetof(struct __sk_buff
, hash
) + 1),
683 BPF_LDX_MEM(BPF_H
, BPF_REG_0
, BPF_REG_1
,
684 offsetof(struct __sk_buff
, hash
) + 3),
688 .errstr
= "invalid bpf_context access",
690 .flags
= F_NEEDS_EFFICIENT_UNALIGNED_ACCESS
,
693 "check skb->hash half load not permitted, unaligned 3",
695 BPF_MOV64_IMM(BPF_REG_0
, 0),
696 #if __BYTE_ORDER == __LITTLE_ENDIAN
697 BPF_LDX_MEM(BPF_H
, BPF_REG_0
, BPF_REG_1
,
698 offsetof(struct __sk_buff
, hash
) + 3),
700 BPF_LDX_MEM(BPF_H
, BPF_REG_0
, BPF_REG_1
,
701 offsetof(struct __sk_buff
, hash
) + 1),
705 .errstr
= "invalid bpf_context access",
707 .flags
= F_NEEDS_EFFICIENT_UNALIGNED_ACCESS
,
710 "check cb access: half, wrong type",
712 BPF_MOV64_IMM(BPF_REG_0
, 0),
713 BPF_STX_MEM(BPF_H
, BPF_REG_1
, BPF_REG_0
,
714 offsetof(struct __sk_buff
, cb
[0])),
717 .errstr
= "invalid bpf_context access",
719 .prog_type
= BPF_PROG_TYPE_CGROUP_SOCK
,
722 "check cb access: word",
724 BPF_MOV64_IMM(BPF_REG_0
, 0),
725 BPF_STX_MEM(BPF_W
, BPF_REG_1
, BPF_REG_0
,
726 offsetof(struct __sk_buff
, cb
[0])),
727 BPF_STX_MEM(BPF_W
, BPF_REG_1
, BPF_REG_0
,
728 offsetof(struct __sk_buff
, cb
[1])),
729 BPF_STX_MEM(BPF_W
, BPF_REG_1
, BPF_REG_0
,
730 offsetof(struct __sk_buff
, cb
[2])),
731 BPF_STX_MEM(BPF_W
, BPF_REG_1
, BPF_REG_0
,
732 offsetof(struct __sk_buff
, cb
[3])),
733 BPF_STX_MEM(BPF_W
, BPF_REG_1
, BPF_REG_0
,
734 offsetof(struct __sk_buff
, cb
[4])),
735 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
736 offsetof(struct __sk_buff
, cb
[0])),
737 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
738 offsetof(struct __sk_buff
, cb
[1])),
739 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
740 offsetof(struct __sk_buff
, cb
[2])),
741 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
742 offsetof(struct __sk_buff
, cb
[3])),
743 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
744 offsetof(struct __sk_buff
, cb
[4])),
750 "check cb access: word, unaligned 1",
752 BPF_MOV64_IMM(BPF_REG_0
, 0),
753 BPF_STX_MEM(BPF_W
, BPF_REG_1
, BPF_REG_0
,
754 offsetof(struct __sk_buff
, cb
[0]) + 2),
757 .errstr
= "misaligned context access",
759 .flags
= F_LOAD_WITH_STRICT_ALIGNMENT
,
762 "check cb access: word, unaligned 2",
764 BPF_MOV64_IMM(BPF_REG_0
, 0),
765 BPF_STX_MEM(BPF_W
, BPF_REG_1
, BPF_REG_0
,
766 offsetof(struct __sk_buff
, cb
[4]) + 1),
769 .errstr
= "misaligned context access",
771 .flags
= F_LOAD_WITH_STRICT_ALIGNMENT
,
774 "check cb access: word, unaligned 3",
776 BPF_MOV64_IMM(BPF_REG_0
, 0),
777 BPF_STX_MEM(BPF_W
, BPF_REG_1
, BPF_REG_0
,
778 offsetof(struct __sk_buff
, cb
[4]) + 2),
781 .errstr
= "misaligned context access",
783 .flags
= F_LOAD_WITH_STRICT_ALIGNMENT
,
786 "check cb access: word, unaligned 4",
788 BPF_MOV64_IMM(BPF_REG_0
, 0),
789 BPF_STX_MEM(BPF_W
, BPF_REG_1
, BPF_REG_0
,
790 offsetof(struct __sk_buff
, cb
[4]) + 3),
793 .errstr
= "misaligned context access",
795 .flags
= F_LOAD_WITH_STRICT_ALIGNMENT
,
798 "check cb access: double",
800 BPF_MOV64_IMM(BPF_REG_0
, 0),
801 BPF_STX_MEM(BPF_DW
, BPF_REG_1
, BPF_REG_0
,
802 offsetof(struct __sk_buff
, cb
[0])),
803 BPF_STX_MEM(BPF_DW
, BPF_REG_1
, BPF_REG_0
,
804 offsetof(struct __sk_buff
, cb
[2])),
805 BPF_LDX_MEM(BPF_DW
, BPF_REG_0
, BPF_REG_1
,
806 offsetof(struct __sk_buff
, cb
[0])),
807 BPF_LDX_MEM(BPF_DW
, BPF_REG_0
, BPF_REG_1
,
808 offsetof(struct __sk_buff
, cb
[2])),
814 "check cb access: double, unaligned 1",
816 BPF_MOV64_IMM(BPF_REG_0
, 0),
817 BPF_STX_MEM(BPF_DW
, BPF_REG_1
, BPF_REG_0
,
818 offsetof(struct __sk_buff
, cb
[1])),
821 .errstr
= "misaligned context access",
823 .flags
= F_LOAD_WITH_STRICT_ALIGNMENT
,
826 "check cb access: double, unaligned 2",
828 BPF_MOV64_IMM(BPF_REG_0
, 0),
829 BPF_STX_MEM(BPF_DW
, BPF_REG_1
, BPF_REG_0
,
830 offsetof(struct __sk_buff
, cb
[3])),
833 .errstr
= "misaligned context access",
835 .flags
= F_LOAD_WITH_STRICT_ALIGNMENT
,
838 "check cb access: double, oob 1",
840 BPF_MOV64_IMM(BPF_REG_0
, 0),
841 BPF_STX_MEM(BPF_DW
, BPF_REG_1
, BPF_REG_0
,
842 offsetof(struct __sk_buff
, cb
[4])),
845 .errstr
= "invalid bpf_context access",
849 "check cb access: double, oob 2",
851 BPF_MOV64_IMM(BPF_REG_0
, 0),
852 BPF_LDX_MEM(BPF_DW
, BPF_REG_0
, BPF_REG_1
,
853 offsetof(struct __sk_buff
, cb
[4])),
856 .errstr
= "invalid bpf_context access",
860 "check __sk_buff->ifindex dw store not permitted",
862 BPF_MOV64_IMM(BPF_REG_0
, 0),
863 BPF_STX_MEM(BPF_DW
, BPF_REG_1
, BPF_REG_0
,
864 offsetof(struct __sk_buff
, ifindex
)),
867 .errstr
= "invalid bpf_context access",
871 "check __sk_buff->ifindex dw load not permitted",
873 BPF_MOV64_IMM(BPF_REG_0
, 0),
874 BPF_LDX_MEM(BPF_DW
, BPF_REG_0
, BPF_REG_1
,
875 offsetof(struct __sk_buff
, ifindex
)),
878 .errstr
= "invalid bpf_context access",
882 "check cb access: double, wrong type",
884 BPF_MOV64_IMM(BPF_REG_0
, 0),
885 BPF_STX_MEM(BPF_DW
, BPF_REG_1
, BPF_REG_0
,
886 offsetof(struct __sk_buff
, cb
[0])),
889 .errstr
= "invalid bpf_context access",
891 .prog_type
= BPF_PROG_TYPE_CGROUP_SOCK
,
894 "check out of range skb->cb access",
896 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
897 offsetof(struct __sk_buff
, cb
[0]) + 256),
900 .errstr
= "invalid bpf_context access",
903 .prog_type
= BPF_PROG_TYPE_SCHED_ACT
,
906 "write skb fields from socket prog",
908 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
909 offsetof(struct __sk_buff
, cb
[4])),
910 BPF_JMP_IMM(BPF_JGE
, BPF_REG_0
, 0, 1),
911 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
912 offsetof(struct __sk_buff
, mark
)),
913 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
914 offsetof(struct __sk_buff
, tc_index
)),
915 BPF_JMP_IMM(BPF_JGE
, BPF_REG_0
, 0, 1),
916 BPF_STX_MEM(BPF_W
, BPF_REG_1
, BPF_REG_1
,
917 offsetof(struct __sk_buff
, cb
[0])),
918 BPF_STX_MEM(BPF_W
, BPF_REG_1
, BPF_REG_1
,
919 offsetof(struct __sk_buff
, cb
[2])),
923 .errstr_unpriv
= "R1 leaks addr",
924 .result_unpriv
= REJECT
,
927 "write skb fields from tc_cls_act prog",
929 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
930 offsetof(struct __sk_buff
, cb
[0])),
931 BPF_STX_MEM(BPF_W
, BPF_REG_1
, BPF_REG_0
,
932 offsetof(struct __sk_buff
, mark
)),
933 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
934 offsetof(struct __sk_buff
, tc_index
)),
935 BPF_STX_MEM(BPF_W
, BPF_REG_1
, BPF_REG_0
,
936 offsetof(struct __sk_buff
, tc_index
)),
937 BPF_STX_MEM(BPF_W
, BPF_REG_1
, BPF_REG_0
,
938 offsetof(struct __sk_buff
, cb
[3])),
939 BPF_LDX_MEM(BPF_DW
, BPF_REG_0
, BPF_REG_1
,
940 offsetof(struct __sk_buff
, tstamp
)),
941 BPF_STX_MEM(BPF_DW
, BPF_REG_1
, BPF_REG_0
,
942 offsetof(struct __sk_buff
, tstamp
)),
946 .result_unpriv
= REJECT
,
948 .prog_type
= BPF_PROG_TYPE_SCHED_CLS
,
951 "check skb->data half load not permitted",
953 BPF_MOV64_IMM(BPF_REG_0
, 0),
954 #if __BYTE_ORDER == __LITTLE_ENDIAN
955 BPF_LDX_MEM(BPF_H
, BPF_REG_0
, BPF_REG_1
,
956 offsetof(struct __sk_buff
, data
)),
958 BPF_LDX_MEM(BPF_H
, BPF_REG_0
, BPF_REG_1
,
959 offsetof(struct __sk_buff
, data
) + 2),
964 .errstr
= "invalid bpf_context access",
967 "read gso_segs from CGROUP_SKB",
969 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
970 offsetof(struct __sk_buff
, gso_segs
)),
971 BPF_MOV64_IMM(BPF_REG_0
, 0),
975 .prog_type
= BPF_PROG_TYPE_CGROUP_SKB
,
978 "read gso_segs from CGROUP_SKB",
980 BPF_LDX_MEM(BPF_W
, BPF_REG_1
, BPF_REG_1
,
981 offsetof(struct __sk_buff
, gso_segs
)),
982 BPF_MOV64_IMM(BPF_REG_0
, 0),
986 .prog_type
= BPF_PROG_TYPE_CGROUP_SKB
,
989 "write gso_segs from CGROUP_SKB",
991 BPF_MOV64_IMM(BPF_REG_0
, 0),
992 BPF_STX_MEM(BPF_W
, BPF_REG_1
, BPF_REG_0
,
993 offsetof(struct __sk_buff
, gso_segs
)),
994 BPF_MOV64_IMM(BPF_REG_0
, 0),
998 .result_unpriv
= REJECT
,
999 .errstr
= "invalid bpf_context access off=164 size=4",
1000 .prog_type
= BPF_PROG_TYPE_CGROUP_SKB
,
1003 "read gso_segs from CLS",
1005 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
1006 offsetof(struct __sk_buff
, gso_segs
)),
1007 BPF_MOV64_IMM(BPF_REG_0
, 0),
1011 .prog_type
= BPF_PROG_TYPE_SCHED_CLS
,
1014 "read gso_size from CGROUP_SKB",
1016 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
1017 offsetof(struct __sk_buff
, gso_size
)),
1018 BPF_MOV64_IMM(BPF_REG_0
, 0),
1022 .prog_type
= BPF_PROG_TYPE_CGROUP_SKB
,
1025 "read gso_size from CGROUP_SKB",
1027 BPF_LDX_MEM(BPF_W
, BPF_REG_1
, BPF_REG_1
,
1028 offsetof(struct __sk_buff
, gso_size
)),
1029 BPF_MOV64_IMM(BPF_REG_0
, 0),
1033 .prog_type
= BPF_PROG_TYPE_CGROUP_SKB
,
1036 "write gso_size from CGROUP_SKB",
1038 BPF_MOV64_IMM(BPF_REG_0
, 0),
1039 BPF_STX_MEM(BPF_W
, BPF_REG_1
, BPF_REG_0
,
1040 offsetof(struct __sk_buff
, gso_size
)),
1041 BPF_MOV64_IMM(BPF_REG_0
, 0),
1045 .result_unpriv
= REJECT
,
1046 .errstr
= "invalid bpf_context access off=176 size=4",
1047 .prog_type
= BPF_PROG_TYPE_CGROUP_SKB
,
1050 "read gso_size from CLS",
1052 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
1053 offsetof(struct __sk_buff
, gso_size
)),
1054 BPF_MOV64_IMM(BPF_REG_0
, 0),
1058 .prog_type
= BPF_PROG_TYPE_SCHED_CLS
,
1061 "check wire_len is not readable by sockets",
1063 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
1064 offsetof(struct __sk_buff
, wire_len
)),
1067 .errstr
= "invalid bpf_context access",
1071 "check wire_len is readable by tc classifier",
1073 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
1074 offsetof(struct __sk_buff
, wire_len
)),
1077 .prog_type
= BPF_PROG_TYPE_SCHED_CLS
,
1081 "check wire_len is not writable by tc classifier",
1083 BPF_STX_MEM(BPF_W
, BPF_REG_1
, BPF_REG_1
,
1084 offsetof(struct __sk_buff
, wire_len
)),
1087 .prog_type
= BPF_PROG_TYPE_SCHED_CLS
,
1088 .errstr
= "invalid bpf_context access",
1089 .errstr_unpriv
= "R1 leaks addr",
1093 "pkt > pkt_end taken check",
1095 BPF_LDX_MEM(BPF_W
, BPF_REG_2
, BPF_REG_1
, // 0. r2 = *(u32 *)(r1 + data_end)
1096 offsetof(struct __sk_buff
, data_end
)),
1097 BPF_LDX_MEM(BPF_W
, BPF_REG_4
, BPF_REG_1
, // 1. r4 = *(u32 *)(r1 + data)
1098 offsetof(struct __sk_buff
, data
)),
1099 BPF_MOV64_REG(BPF_REG_3
, BPF_REG_4
), // 2. r3 = r4
1100 BPF_ALU64_IMM(BPF_ADD
, BPF_REG_3
, 42), // 3. r3 += 42
1101 BPF_MOV64_IMM(BPF_REG_1
, 0), // 4. r1 = 0
1102 BPF_JMP_REG(BPF_JGT
, BPF_REG_3
, BPF_REG_2
, 2), // 5. if r3 > r2 goto 8
1103 BPF_ALU64_IMM(BPF_ADD
, BPF_REG_4
, 14), // 6. r4 += 14
1104 BPF_MOV64_REG(BPF_REG_1
, BPF_REG_4
), // 7. r1 = r4
1105 BPF_JMP_REG(BPF_JGT
, BPF_REG_3
, BPF_REG_2
, 1), // 8. if r3 > r2 goto 10
1106 BPF_LDX_MEM(BPF_H
, BPF_REG_2
, BPF_REG_1
, 9), // 9. r2 = *(u8 *)(r1 + 9)
1107 BPF_MOV64_IMM(BPF_REG_0
, 0), // 10. r0 = 0
1108 BPF_EXIT_INSN(), // 11. exit
1111 .prog_type
= BPF_PROG_TYPE_SK_SKB
,
1114 "pkt_end < pkt taken check",
1116 BPF_LDX_MEM(BPF_W
, BPF_REG_2
, BPF_REG_1
, // 0. r2 = *(u32 *)(r1 + data_end)
1117 offsetof(struct __sk_buff
, data_end
)),
1118 BPF_LDX_MEM(BPF_W
, BPF_REG_4
, BPF_REG_1
, // 1. r4 = *(u32 *)(r1 + data)
1119 offsetof(struct __sk_buff
, data
)),
1120 BPF_MOV64_REG(BPF_REG_3
, BPF_REG_4
), // 2. r3 = r4
1121 BPF_ALU64_IMM(BPF_ADD
, BPF_REG_3
, 42), // 3. r3 += 42
1122 BPF_MOV64_IMM(BPF_REG_1
, 0), // 4. r1 = 0
1123 BPF_JMP_REG(BPF_JGT
, BPF_REG_3
, BPF_REG_2
, 2), // 5. if r3 > r2 goto 8
1124 BPF_ALU64_IMM(BPF_ADD
, BPF_REG_4
, 14), // 6. r4 += 14
1125 BPF_MOV64_REG(BPF_REG_1
, BPF_REG_4
), // 7. r1 = r4
1126 BPF_JMP_REG(BPF_JLT
, BPF_REG_2
, BPF_REG_3
, 1), // 8. if r2 < r3 goto 10
1127 BPF_LDX_MEM(BPF_H
, BPF_REG_2
, BPF_REG_1
, 9), // 9. r2 = *(u8 *)(r1 + 9)
1128 BPF_MOV64_IMM(BPF_REG_0
, 0), // 10. r0 = 0
1129 BPF_EXIT_INSN(), // 11. exit
1132 .prog_type
= BPF_PROG_TYPE_SK_SKB
,