2 "skb->sk: no NULL check",
4 BPF_LDX_MEM(BPF_DW
, BPF_REG_1
, BPF_REG_1
, offsetof(struct __sk_buff
, sk
)),
5 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
, 0),
6 BPF_MOV64_IMM(BPF_REG_0
, 0),
9 .prog_type
= BPF_PROG_TYPE_CGROUP_SKB
,
11 .errstr
= "invalid mem access 'sock_common_or_null'",
14 "skb->sk: sk->family [non fullsock field]",
16 BPF_LDX_MEM(BPF_DW
, BPF_REG_1
, BPF_REG_1
, offsetof(struct __sk_buff
, sk
)),
17 BPF_JMP_IMM(BPF_JNE
, BPF_REG_1
, 0, 2),
18 BPF_MOV64_IMM(BPF_REG_0
, 0),
20 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
, offsetof(struct bpf_sock
, family
)),
21 BPF_MOV64_IMM(BPF_REG_0
, 0),
24 .prog_type
= BPF_PROG_TYPE_CGROUP_SKB
,
28 "skb->sk: sk->type [fullsock field]",
30 BPF_LDX_MEM(BPF_DW
, BPF_REG_1
, BPF_REG_1
, offsetof(struct __sk_buff
, sk
)),
31 BPF_JMP_IMM(BPF_JNE
, BPF_REG_1
, 0, 2),
32 BPF_MOV64_IMM(BPF_REG_0
, 0),
34 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
, offsetof(struct bpf_sock
, type
)),
35 BPF_MOV64_IMM(BPF_REG_0
, 0),
38 .prog_type
= BPF_PROG_TYPE_CGROUP_SKB
,
40 .errstr
= "invalid sock_common access",
43 "bpf_sk_fullsock(skb->sk): no !skb->sk check",
45 BPF_LDX_MEM(BPF_DW
, BPF_REG_1
, BPF_REG_1
, offsetof(struct __sk_buff
, sk
)),
46 BPF_EMIT_CALL(BPF_FUNC_sk_fullsock
),
47 BPF_MOV64_IMM(BPF_REG_0
, 0),
50 .prog_type
= BPF_PROG_TYPE_CGROUP_SKB
,
52 .errstr
= "type=sock_common_or_null expected=sock_common",
55 "sk_fullsock(skb->sk): no NULL check on ret",
57 BPF_LDX_MEM(BPF_DW
, BPF_REG_1
, BPF_REG_1
, offsetof(struct __sk_buff
, sk
)),
58 BPF_JMP_IMM(BPF_JNE
, BPF_REG_1
, 0, 2),
59 BPF_MOV64_IMM(BPF_REG_0
, 0),
61 BPF_EMIT_CALL(BPF_FUNC_sk_fullsock
),
62 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_0
, offsetof(struct bpf_sock
, type
)),
63 BPF_MOV64_IMM(BPF_REG_0
, 0),
66 .prog_type
= BPF_PROG_TYPE_CGROUP_SKB
,
68 .errstr
= "invalid mem access 'sock_or_null'",
71 "sk_fullsock(skb->sk): sk->type [fullsock field]",
73 BPF_LDX_MEM(BPF_DW
, BPF_REG_1
, BPF_REG_1
, offsetof(struct __sk_buff
, sk
)),
74 BPF_JMP_IMM(BPF_JNE
, BPF_REG_1
, 0, 2),
75 BPF_MOV64_IMM(BPF_REG_0
, 0),
77 BPF_EMIT_CALL(BPF_FUNC_sk_fullsock
),
78 BPF_JMP_IMM(BPF_JNE
, BPF_REG_0
, 0, 2),
79 BPF_MOV64_IMM(BPF_REG_0
, 0),
81 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_0
, offsetof(struct bpf_sock
, type
)),
82 BPF_MOV64_IMM(BPF_REG_0
, 0),
85 .prog_type
= BPF_PROG_TYPE_CGROUP_SKB
,
89 "sk_fullsock(skb->sk): sk->family [non fullsock field]",
91 BPF_LDX_MEM(BPF_DW
, BPF_REG_1
, BPF_REG_1
, offsetof(struct __sk_buff
, sk
)),
92 BPF_JMP_IMM(BPF_JNE
, BPF_REG_1
, 0, 2),
93 BPF_MOV64_IMM(BPF_REG_0
, 0),
95 BPF_EMIT_CALL(BPF_FUNC_sk_fullsock
),
96 BPF_JMP_IMM(BPF_JNE
, BPF_REG_0
, 0, 1),
98 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_0
, offsetof(struct bpf_sock
, family
)),
99 BPF_MOV64_IMM(BPF_REG_0
, 0),
102 .prog_type
= BPF_PROG_TYPE_CGROUP_SKB
,
106 "sk_fullsock(skb->sk): sk->state [narrow load]",
108 BPF_LDX_MEM(BPF_DW
, BPF_REG_1
, BPF_REG_1
, offsetof(struct __sk_buff
, sk
)),
109 BPF_JMP_IMM(BPF_JNE
, BPF_REG_1
, 0, 2),
110 BPF_MOV64_IMM(BPF_REG_0
, 0),
112 BPF_EMIT_CALL(BPF_FUNC_sk_fullsock
),
113 BPF_JMP_IMM(BPF_JNE
, BPF_REG_0
, 0, 2),
114 BPF_MOV64_IMM(BPF_REG_0
, 0),
116 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_0
, offsetof(struct bpf_sock
, state
)),
117 BPF_MOV64_IMM(BPF_REG_0
, 0),
120 .prog_type
= BPF_PROG_TYPE_CGROUP_SKB
,
124 "sk_fullsock(skb->sk): sk->dst_port [narrow load]",
126 BPF_LDX_MEM(BPF_DW
, BPF_REG_1
, BPF_REG_1
, offsetof(struct __sk_buff
, sk
)),
127 BPF_JMP_IMM(BPF_JNE
, BPF_REG_1
, 0, 2),
128 BPF_MOV64_IMM(BPF_REG_0
, 0),
130 BPF_EMIT_CALL(BPF_FUNC_sk_fullsock
),
131 BPF_JMP_IMM(BPF_JNE
, BPF_REG_0
, 0, 2),
132 BPF_MOV64_IMM(BPF_REG_0
, 0),
134 BPF_LDX_MEM(BPF_H
, BPF_REG_0
, BPF_REG_0
, offsetof(struct bpf_sock
, dst_port
)),
135 BPF_MOV64_IMM(BPF_REG_0
, 0),
138 .prog_type
= BPF_PROG_TYPE_CGROUP_SKB
,
142 "sk_fullsock(skb->sk): sk->dst_port [load 2nd byte]",
144 BPF_LDX_MEM(BPF_DW
, BPF_REG_1
, BPF_REG_1
, offsetof(struct __sk_buff
, sk
)),
145 BPF_JMP_IMM(BPF_JNE
, BPF_REG_1
, 0, 2),
146 BPF_MOV64_IMM(BPF_REG_0
, 0),
148 BPF_EMIT_CALL(BPF_FUNC_sk_fullsock
),
149 BPF_JMP_IMM(BPF_JNE
, BPF_REG_0
, 0, 2),
150 BPF_MOV64_IMM(BPF_REG_0
, 0),
152 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_0
, offsetof(struct bpf_sock
, dst_port
) + 1),
153 BPF_MOV64_IMM(BPF_REG_0
, 0),
156 .prog_type
= BPF_PROG_TYPE_CGROUP_SKB
,
158 .errstr
= "invalid sock access",
161 "sk_fullsock(skb->sk): sk->dst_ip6 [load 2nd byte]",
163 BPF_LDX_MEM(BPF_DW
, BPF_REG_1
, BPF_REG_1
, offsetof(struct __sk_buff
, sk
)),
164 BPF_JMP_IMM(BPF_JNE
, BPF_REG_1
, 0, 2),
165 BPF_MOV64_IMM(BPF_REG_0
, 0),
167 BPF_EMIT_CALL(BPF_FUNC_sk_fullsock
),
168 BPF_JMP_IMM(BPF_JNE
, BPF_REG_0
, 0, 2),
169 BPF_MOV64_IMM(BPF_REG_0
, 0),
171 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_0
, offsetof(struct bpf_sock
, dst_ip6
[0]) + 1),
172 BPF_MOV64_IMM(BPF_REG_0
, 0),
175 .prog_type
= BPF_PROG_TYPE_CGROUP_SKB
,
179 "sk_fullsock(skb->sk): sk->type [narrow load]",
181 BPF_LDX_MEM(BPF_DW
, BPF_REG_1
, BPF_REG_1
, offsetof(struct __sk_buff
, sk
)),
182 BPF_JMP_IMM(BPF_JNE
, BPF_REG_1
, 0, 2),
183 BPF_MOV64_IMM(BPF_REG_0
, 0),
185 BPF_EMIT_CALL(BPF_FUNC_sk_fullsock
),
186 BPF_JMP_IMM(BPF_JNE
, BPF_REG_0
, 0, 2),
187 BPF_MOV64_IMM(BPF_REG_0
, 0),
189 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_0
, offsetof(struct bpf_sock
, type
)),
190 BPF_MOV64_IMM(BPF_REG_0
, 0),
193 .prog_type
= BPF_PROG_TYPE_CGROUP_SKB
,
197 "sk_fullsock(skb->sk): sk->protocol [narrow load]",
199 BPF_LDX_MEM(BPF_DW
, BPF_REG_1
, BPF_REG_1
, offsetof(struct __sk_buff
, sk
)),
200 BPF_JMP_IMM(BPF_JNE
, BPF_REG_1
, 0, 2),
201 BPF_MOV64_IMM(BPF_REG_0
, 0),
203 BPF_EMIT_CALL(BPF_FUNC_sk_fullsock
),
204 BPF_JMP_IMM(BPF_JNE
, BPF_REG_0
, 0, 2),
205 BPF_MOV64_IMM(BPF_REG_0
, 0),
207 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_0
, offsetof(struct bpf_sock
, protocol
)),
208 BPF_MOV64_IMM(BPF_REG_0
, 0),
211 .prog_type
= BPF_PROG_TYPE_CGROUP_SKB
,
215 "sk_fullsock(skb->sk): beyond last field",
217 BPF_LDX_MEM(BPF_DW
, BPF_REG_1
, BPF_REG_1
, offsetof(struct __sk_buff
, sk
)),
218 BPF_JMP_IMM(BPF_JNE
, BPF_REG_1
, 0, 2),
219 BPF_MOV64_IMM(BPF_REG_0
, 0),
221 BPF_EMIT_CALL(BPF_FUNC_sk_fullsock
),
222 BPF_JMP_IMM(BPF_JNE
, BPF_REG_0
, 0, 2),
223 BPF_MOV64_IMM(BPF_REG_0
, 0),
225 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_0
, offsetofend(struct bpf_sock
, rx_queue_mapping
)),
226 BPF_MOV64_IMM(BPF_REG_0
, 0),
229 .prog_type
= BPF_PROG_TYPE_CGROUP_SKB
,
231 .errstr
= "invalid sock access",
234 "bpf_tcp_sock(skb->sk): no !skb->sk check",
236 BPF_LDX_MEM(BPF_DW
, BPF_REG_1
, BPF_REG_1
, offsetof(struct __sk_buff
, sk
)),
237 BPF_EMIT_CALL(BPF_FUNC_tcp_sock
),
238 BPF_MOV64_IMM(BPF_REG_0
, 0),
241 .prog_type
= BPF_PROG_TYPE_CGROUP_SKB
,
243 .errstr
= "type=sock_common_or_null expected=sock_common",
246 "bpf_tcp_sock(skb->sk): no NULL check on ret",
248 BPF_LDX_MEM(BPF_DW
, BPF_REG_1
, BPF_REG_1
, offsetof(struct __sk_buff
, sk
)),
249 BPF_JMP_IMM(BPF_JNE
, BPF_REG_1
, 0, 2),
250 BPF_MOV64_IMM(BPF_REG_0
, 0),
252 BPF_EMIT_CALL(BPF_FUNC_tcp_sock
),
253 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_0
, offsetof(struct bpf_tcp_sock
, snd_cwnd
)),
254 BPF_MOV64_IMM(BPF_REG_0
, 0),
257 .prog_type
= BPF_PROG_TYPE_CGROUP_SKB
,
259 .errstr
= "invalid mem access 'tcp_sock_or_null'",
262 "bpf_tcp_sock(skb->sk): tp->snd_cwnd",
264 BPF_LDX_MEM(BPF_DW
, BPF_REG_1
, BPF_REG_1
, offsetof(struct __sk_buff
, sk
)),
265 BPF_JMP_IMM(BPF_JNE
, BPF_REG_1
, 0, 2),
266 BPF_MOV64_IMM(BPF_REG_0
, 0),
268 BPF_EMIT_CALL(BPF_FUNC_tcp_sock
),
269 BPF_JMP_IMM(BPF_JNE
, BPF_REG_0
, 0, 1),
271 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_0
, offsetof(struct bpf_tcp_sock
, snd_cwnd
)),
272 BPF_MOV64_IMM(BPF_REG_0
, 0),
275 .prog_type
= BPF_PROG_TYPE_CGROUP_SKB
,
279 "bpf_tcp_sock(skb->sk): tp->bytes_acked",
281 BPF_LDX_MEM(BPF_DW
, BPF_REG_1
, BPF_REG_1
, offsetof(struct __sk_buff
, sk
)),
282 BPF_JMP_IMM(BPF_JNE
, BPF_REG_1
, 0, 2),
283 BPF_MOV64_IMM(BPF_REG_0
, 0),
285 BPF_EMIT_CALL(BPF_FUNC_tcp_sock
),
286 BPF_JMP_IMM(BPF_JNE
, BPF_REG_0
, 0, 1),
288 BPF_LDX_MEM(BPF_DW
, BPF_REG_0
, BPF_REG_0
, offsetof(struct bpf_tcp_sock
, bytes_acked
)),
289 BPF_MOV64_IMM(BPF_REG_0
, 0),
292 .prog_type
= BPF_PROG_TYPE_CGROUP_SKB
,
296 "bpf_tcp_sock(skb->sk): beyond last field",
298 BPF_LDX_MEM(BPF_DW
, BPF_REG_1
, BPF_REG_1
, offsetof(struct __sk_buff
, sk
)),
299 BPF_JMP_IMM(BPF_JNE
, BPF_REG_1
, 0, 2),
300 BPF_MOV64_IMM(BPF_REG_0
, 0),
302 BPF_EMIT_CALL(BPF_FUNC_tcp_sock
),
303 BPF_JMP_IMM(BPF_JNE
, BPF_REG_0
, 0, 1),
305 BPF_LDX_MEM(BPF_DW
, BPF_REG_0
, BPF_REG_0
, offsetofend(struct bpf_tcp_sock
, bytes_acked
)),
306 BPF_MOV64_IMM(BPF_REG_0
, 0),
309 .prog_type
= BPF_PROG_TYPE_CGROUP_SKB
,
311 .errstr
= "invalid tcp_sock access",
314 "bpf_tcp_sock(bpf_sk_fullsock(skb->sk)): tp->snd_cwnd",
316 BPF_LDX_MEM(BPF_DW
, BPF_REG_1
, BPF_REG_1
, offsetof(struct __sk_buff
, sk
)),
317 BPF_JMP_IMM(BPF_JNE
, BPF_REG_1
, 0, 2),
318 BPF_MOV64_IMM(BPF_REG_0
, 0),
320 BPF_EMIT_CALL(BPF_FUNC_sk_fullsock
),
321 BPF_JMP_IMM(BPF_JNE
, BPF_REG_0
, 0, 1),
323 BPF_MOV64_REG(BPF_REG_1
, BPF_REG_0
),
324 BPF_EMIT_CALL(BPF_FUNC_tcp_sock
),
325 BPF_JMP_IMM(BPF_JNE
, BPF_REG_0
, 0, 1),
327 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_0
, offsetof(struct bpf_tcp_sock
, snd_cwnd
)),
328 BPF_MOV64_IMM(BPF_REG_0
, 0),
331 .prog_type
= BPF_PROG_TYPE_CGROUP_SKB
,
335 "bpf_sk_release(skb->sk)",
337 BPF_LDX_MEM(BPF_DW
, BPF_REG_1
, BPF_REG_1
, offsetof(struct __sk_buff
, sk
)),
338 BPF_JMP_IMM(BPF_JEQ
, BPF_REG_1
, 0, 1),
339 BPF_EMIT_CALL(BPF_FUNC_sk_release
),
340 BPF_MOV64_IMM(BPF_REG_0
, 0),
343 .prog_type
= BPF_PROG_TYPE_SCHED_CLS
,
345 .errstr
= "reference has not been acquired before",
348 "bpf_sk_release(bpf_sk_fullsock(skb->sk))",
350 BPF_LDX_MEM(BPF_DW
, BPF_REG_1
, BPF_REG_1
, offsetof(struct __sk_buff
, sk
)),
351 BPF_JMP_IMM(BPF_JNE
, BPF_REG_1
, 0, 2),
352 BPF_MOV64_IMM(BPF_REG_0
, 0),
354 BPF_EMIT_CALL(BPF_FUNC_sk_fullsock
),
355 BPF_JMP_IMM(BPF_JNE
, BPF_REG_0
, 0, 1),
357 BPF_MOV64_REG(BPF_REG_1
, BPF_REG_0
),
358 BPF_EMIT_CALL(BPF_FUNC_sk_release
),
359 BPF_MOV64_IMM(BPF_REG_0
, 1),
362 .prog_type
= BPF_PROG_TYPE_SCHED_CLS
,
364 .errstr
= "reference has not been acquired before",
367 "bpf_sk_release(bpf_tcp_sock(skb->sk))",
369 BPF_LDX_MEM(BPF_DW
, BPF_REG_1
, BPF_REG_1
, offsetof(struct __sk_buff
, sk
)),
370 BPF_JMP_IMM(BPF_JNE
, BPF_REG_1
, 0, 2),
371 BPF_MOV64_IMM(BPF_REG_0
, 0),
373 BPF_EMIT_CALL(BPF_FUNC_tcp_sock
),
374 BPF_JMP_IMM(BPF_JNE
, BPF_REG_0
, 0, 1),
376 BPF_MOV64_REG(BPF_REG_1
, BPF_REG_0
),
377 BPF_EMIT_CALL(BPF_FUNC_sk_release
),
378 BPF_MOV64_IMM(BPF_REG_0
, 1),
381 .prog_type
= BPF_PROG_TYPE_SCHED_CLS
,
383 .errstr
= "reference has not been acquired before",
386 "sk_storage_get(map, skb->sk, NULL, 0): value == NULL",
388 BPF_LDX_MEM(BPF_DW
, BPF_REG_1
, BPF_REG_1
, offsetof(struct __sk_buff
, sk
)),
389 BPF_JMP_IMM(BPF_JNE
, BPF_REG_1
, 0, 2),
390 BPF_MOV64_IMM(BPF_REG_0
, 0),
392 BPF_EMIT_CALL(BPF_FUNC_sk_fullsock
),
393 BPF_JMP_IMM(BPF_JNE
, BPF_REG_0
, 0, 2),
394 BPF_MOV64_IMM(BPF_REG_0
, 0),
396 BPF_MOV64_IMM(BPF_REG_4
, 0),
397 BPF_MOV64_IMM(BPF_REG_3
, 0),
398 BPF_MOV64_REG(BPF_REG_2
, BPF_REG_0
),
399 BPF_LD_MAP_FD(BPF_REG_1
, 0),
400 BPF_EMIT_CALL(BPF_FUNC_sk_storage_get
),
401 BPF_MOV64_IMM(BPF_REG_0
, 0),
404 .fixup_sk_storage_map
= { 11 },
405 .prog_type
= BPF_PROG_TYPE_SCHED_CLS
,
409 "sk_storage_get(map, skb->sk, 1, 1): value == 1",
411 BPF_LDX_MEM(BPF_DW
, BPF_REG_1
, BPF_REG_1
, offsetof(struct __sk_buff
, sk
)),
412 BPF_JMP_IMM(BPF_JNE
, BPF_REG_1
, 0, 2),
413 BPF_MOV64_IMM(BPF_REG_0
, 0),
415 BPF_EMIT_CALL(BPF_FUNC_sk_fullsock
),
416 BPF_JMP_IMM(BPF_JNE
, BPF_REG_0
, 0, 2),
417 BPF_MOV64_IMM(BPF_REG_0
, 0),
419 BPF_MOV64_IMM(BPF_REG_4
, 1),
420 BPF_MOV64_IMM(BPF_REG_3
, 1),
421 BPF_MOV64_REG(BPF_REG_2
, BPF_REG_0
),
422 BPF_LD_MAP_FD(BPF_REG_1
, 0),
423 BPF_EMIT_CALL(BPF_FUNC_sk_storage_get
),
424 BPF_MOV64_IMM(BPF_REG_0
, 0),
427 .fixup_sk_storage_map
= { 11 },
428 .prog_type
= BPF_PROG_TYPE_SCHED_CLS
,
430 .errstr
= "R3 type=inv expected=fp",
433 "sk_storage_get(map, skb->sk, &stack_value, 1): stack_value",
435 BPF_MOV64_IMM(BPF_REG_2
, 0),
436 BPF_STX_MEM(BPF_DW
, BPF_REG_10
, BPF_REG_2
, -8),
437 BPF_LDX_MEM(BPF_DW
, BPF_REG_1
, BPF_REG_1
, offsetof(struct __sk_buff
, sk
)),
438 BPF_JMP_IMM(BPF_JNE
, BPF_REG_1
, 0, 2),
439 BPF_MOV64_IMM(BPF_REG_0
, 0),
441 BPF_EMIT_CALL(BPF_FUNC_sk_fullsock
),
442 BPF_JMP_IMM(BPF_JNE
, BPF_REG_0
, 0, 2),
443 BPF_MOV64_IMM(BPF_REG_0
, 0),
445 BPF_MOV64_IMM(BPF_REG_4
, 1),
446 BPF_MOV64_REG(BPF_REG_3
, BPF_REG_10
),
447 BPF_ALU64_IMM(BPF_ADD
, BPF_REG_3
, -8),
448 BPF_MOV64_REG(BPF_REG_2
, BPF_REG_0
),
449 BPF_LD_MAP_FD(BPF_REG_1
, 0),
450 BPF_EMIT_CALL(BPF_FUNC_sk_storage_get
),
451 BPF_MOV64_IMM(BPF_REG_0
, 0),
454 .fixup_sk_storage_map
= { 14 },
455 .prog_type
= BPF_PROG_TYPE_SCHED_CLS
,
459 "sk_storage_get(map, skb->sk, &stack_value, 1): partially init stack_value",
461 BPF_MOV64_IMM(BPF_REG_2
, 0),
462 BPF_STX_MEM(BPF_W
, BPF_REG_10
, BPF_REG_2
, -8),
463 BPF_LDX_MEM(BPF_DW
, BPF_REG_1
, BPF_REG_1
, offsetof(struct __sk_buff
, sk
)),
464 BPF_JMP_IMM(BPF_JNE
, BPF_REG_1
, 0, 2),
465 BPF_MOV64_IMM(BPF_REG_0
, 0),
467 BPF_EMIT_CALL(BPF_FUNC_sk_fullsock
),
468 BPF_JMP_IMM(BPF_JNE
, BPF_REG_0
, 0, 2),
469 BPF_MOV64_IMM(BPF_REG_0
, 0),
471 BPF_MOV64_IMM(BPF_REG_4
, 1),
472 BPF_MOV64_REG(BPF_REG_3
, BPF_REG_10
),
473 BPF_ALU64_IMM(BPF_ADD
, BPF_REG_3
, -8),
474 BPF_MOV64_REG(BPF_REG_2
, BPF_REG_0
),
475 BPF_LD_MAP_FD(BPF_REG_1
, 0),
476 BPF_EMIT_CALL(BPF_FUNC_sk_storage_get
),
477 BPF_MOV64_IMM(BPF_REG_0
, 0),
480 .fixup_sk_storage_map
= { 14 },
481 .prog_type
= BPF_PROG_TYPE_SCHED_CLS
,
483 .errstr
= "invalid indirect read from stack",
486 "bpf_map_lookup_elem(smap, &key)",
488 BPF_ST_MEM(BPF_W
, BPF_REG_10
, -4, 0),
489 BPF_MOV64_REG(BPF_REG_2
, BPF_REG_10
),
490 BPF_ALU64_IMM(BPF_ADD
, BPF_REG_2
, -4),
491 BPF_LD_MAP_FD(BPF_REG_1
, 0),
492 BPF_EMIT_CALL(BPF_FUNC_map_lookup_elem
),
493 BPF_MOV64_IMM(BPF_REG_0
, 0),
496 .fixup_sk_storage_map
= { 3 },
497 .prog_type
= BPF_PROG_TYPE_SCHED_CLS
,
499 .errstr
= "cannot pass map_type 24 into func bpf_map_lookup_elem",
502 "bpf_map_lookup_elem(xskmap, &key); xs->queue_id",
504 BPF_ST_MEM(BPF_W
, BPF_REG_10
, -8, 0),
505 BPF_MOV64_REG(BPF_REG_2
, BPF_REG_10
),
506 BPF_ALU64_IMM(BPF_ADD
, BPF_REG_2
, -8),
507 BPF_LD_MAP_FD(BPF_REG_1
, 0),
508 BPF_EMIT_CALL(BPF_FUNC_map_lookup_elem
),
509 BPF_JMP_IMM(BPF_JNE
, BPF_REG_0
, 0, 1),
511 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_0
, offsetof(struct bpf_xdp_sock
, queue_id
)),
512 BPF_MOV64_IMM(BPF_REG_0
, 0),
515 .fixup_map_xskmap
= { 3 },
516 .prog_type
= BPF_PROG_TYPE_XDP
,
520 "bpf_map_lookup_elem(sockmap, &key)",
522 BPF_ST_MEM(BPF_W
, BPF_REG_10
, -4, 0),
523 BPF_MOV64_REG(BPF_REG_2
, BPF_REG_10
),
524 BPF_ALU64_IMM(BPF_ADD
, BPF_REG_2
, -4),
525 BPF_LD_MAP_FD(BPF_REG_1
, 0),
526 BPF_EMIT_CALL(BPF_FUNC_map_lookup_elem
),
527 BPF_MOV64_IMM(BPF_REG_0
, 0),
530 .fixup_map_sockmap
= { 3 },
531 .prog_type
= BPF_PROG_TYPE_SK_SKB
,
533 .errstr
= "Unreleased reference id=2 alloc_insn=5",
536 "bpf_map_lookup_elem(sockhash, &key)",
538 BPF_ST_MEM(BPF_W
, BPF_REG_10
, -4, 0),
539 BPF_MOV64_REG(BPF_REG_2
, BPF_REG_10
),
540 BPF_ALU64_IMM(BPF_ADD
, BPF_REG_2
, -4),
541 BPF_LD_MAP_FD(BPF_REG_1
, 0),
542 BPF_EMIT_CALL(BPF_FUNC_map_lookup_elem
),
543 BPF_MOV64_IMM(BPF_REG_0
, 0),
546 .fixup_map_sockhash
= { 3 },
547 .prog_type
= BPF_PROG_TYPE_SK_SKB
,
549 .errstr
= "Unreleased reference id=2 alloc_insn=5",
552 "bpf_map_lookup_elem(sockmap, &key); sk->type [fullsock field]; bpf_sk_release(sk)",
554 BPF_ST_MEM(BPF_W
, BPF_REG_10
, -4, 0),
555 BPF_MOV64_REG(BPF_REG_2
, BPF_REG_10
),
556 BPF_ALU64_IMM(BPF_ADD
, BPF_REG_2
, -4),
557 BPF_LD_MAP_FD(BPF_REG_1
, 0),
558 BPF_EMIT_CALL(BPF_FUNC_map_lookup_elem
),
559 BPF_JMP_IMM(BPF_JNE
, BPF_REG_0
, 0, 1),
561 BPF_MOV64_REG(BPF_REG_1
, BPF_REG_0
),
562 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_0
, offsetof(struct bpf_sock
, type
)),
563 BPF_EMIT_CALL(BPF_FUNC_sk_release
),
566 .fixup_map_sockmap
= { 3 },
567 .prog_type
= BPF_PROG_TYPE_SK_SKB
,
571 "bpf_map_lookup_elem(sockhash, &key); sk->type [fullsock field]; bpf_sk_release(sk)",
573 BPF_ST_MEM(BPF_W
, BPF_REG_10
, -4, 0),
574 BPF_MOV64_REG(BPF_REG_2
, BPF_REG_10
),
575 BPF_ALU64_IMM(BPF_ADD
, BPF_REG_2
, -4),
576 BPF_LD_MAP_FD(BPF_REG_1
, 0),
577 BPF_EMIT_CALL(BPF_FUNC_map_lookup_elem
),
578 BPF_JMP_IMM(BPF_JNE
, BPF_REG_0
, 0, 1),
580 BPF_MOV64_REG(BPF_REG_1
, BPF_REG_0
),
581 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_0
, offsetof(struct bpf_sock
, type
)),
582 BPF_EMIT_CALL(BPF_FUNC_sk_release
),
585 .fixup_map_sockhash
= { 3 },
586 .prog_type
= BPF_PROG_TYPE_SK_SKB
,
590 "bpf_sk_select_reuseport(ctx, reuseport_array, &key, flags)",
592 BPF_MOV64_IMM(BPF_REG_4
, 0),
593 BPF_ST_MEM(BPF_W
, BPF_REG_10
, -4, 0),
594 BPF_MOV64_REG(BPF_REG_3
, BPF_REG_10
),
595 BPF_ALU64_IMM(BPF_ADD
, BPF_REG_3
, -4),
596 BPF_LD_MAP_FD(BPF_REG_2
, 0),
597 BPF_EMIT_CALL(BPF_FUNC_sk_select_reuseport
),
600 .fixup_map_reuseport_array
= { 4 },
601 .prog_type
= BPF_PROG_TYPE_SK_REUSEPORT
,
605 "bpf_sk_select_reuseport(ctx, sockmap, &key, flags)",
607 BPF_MOV64_IMM(BPF_REG_4
, 0),
608 BPF_ST_MEM(BPF_W
, BPF_REG_10
, -4, 0),
609 BPF_MOV64_REG(BPF_REG_3
, BPF_REG_10
),
610 BPF_ALU64_IMM(BPF_ADD
, BPF_REG_3
, -4),
611 BPF_LD_MAP_FD(BPF_REG_2
, 0),
612 BPF_EMIT_CALL(BPF_FUNC_sk_select_reuseport
),
615 .fixup_map_sockmap
= { 4 },
616 .prog_type
= BPF_PROG_TYPE_SK_REUSEPORT
,
620 "bpf_sk_select_reuseport(ctx, sockhash, &key, flags)",
622 BPF_MOV64_IMM(BPF_REG_4
, 0),
623 BPF_ST_MEM(BPF_W
, BPF_REG_10
, -4, 0),
624 BPF_MOV64_REG(BPF_REG_3
, BPF_REG_10
),
625 BPF_ALU64_IMM(BPF_ADD
, BPF_REG_3
, -4),
626 BPF_LD_MAP_FD(BPF_REG_2
, 0),
627 BPF_EMIT_CALL(BPF_FUNC_sk_select_reuseport
),
630 .fixup_map_sockmap
= { 4 },
631 .prog_type
= BPF_PROG_TYPE_SK_REUSEPORT
,
635 "mark null check on return value of bpf_skc_to helpers",
637 BPF_LDX_MEM(BPF_DW
, BPF_REG_1
, BPF_REG_1
, offsetof(struct __sk_buff
, sk
)),
638 BPF_JMP_IMM(BPF_JNE
, BPF_REG_1
, 0, 2),
639 BPF_MOV64_IMM(BPF_REG_0
, 0),
641 BPF_MOV64_REG(BPF_REG_6
, BPF_REG_1
),
642 BPF_EMIT_CALL(BPF_FUNC_skc_to_tcp_sock
),
643 BPF_MOV64_REG(BPF_REG_7
, BPF_REG_0
),
644 BPF_MOV64_REG(BPF_REG_1
, BPF_REG_6
),
645 BPF_EMIT_CALL(BPF_FUNC_skc_to_tcp_request_sock
),
646 BPF_MOV64_REG(BPF_REG_8
, BPF_REG_0
),
647 BPF_JMP_IMM(BPF_JNE
, BPF_REG_8
, 0, 2),
648 BPF_MOV64_IMM(BPF_REG_0
, 0),
650 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_7
, 0),
653 .prog_type
= BPF_PROG_TYPE_SCHED_CLS
,
655 .errstr
= "invalid mem access",
656 .result_unpriv
= REJECT
,
657 .errstr_unpriv
= "unknown func",