2 "valid 1,2,4,8-byte reads from bpf_sk_lookup",
4 /* 1-byte read from family field */
5 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
6 offsetof(struct bpf_sk_lookup
, family
)),
7 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
8 offsetof(struct bpf_sk_lookup
, family
) + 1),
9 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
10 offsetof(struct bpf_sk_lookup
, family
) + 2),
11 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
12 offsetof(struct bpf_sk_lookup
, family
) + 3),
13 /* 2-byte read from family field */
14 BPF_LDX_MEM(BPF_H
, BPF_REG_0
, BPF_REG_1
,
15 offsetof(struct bpf_sk_lookup
, family
)),
16 BPF_LDX_MEM(BPF_H
, BPF_REG_0
, BPF_REG_1
,
17 offsetof(struct bpf_sk_lookup
, family
) + 2),
18 /* 4-byte read from family field */
19 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
20 offsetof(struct bpf_sk_lookup
, family
)),
22 /* 1-byte read from protocol field */
23 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
24 offsetof(struct bpf_sk_lookup
, protocol
)),
25 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
26 offsetof(struct bpf_sk_lookup
, protocol
) + 1),
27 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
28 offsetof(struct bpf_sk_lookup
, protocol
) + 2),
29 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
30 offsetof(struct bpf_sk_lookup
, protocol
) + 3),
31 /* 2-byte read from protocol field */
32 BPF_LDX_MEM(BPF_H
, BPF_REG_0
, BPF_REG_1
,
33 offsetof(struct bpf_sk_lookup
, protocol
)),
34 BPF_LDX_MEM(BPF_H
, BPF_REG_0
, BPF_REG_1
,
35 offsetof(struct bpf_sk_lookup
, protocol
) + 2),
36 /* 4-byte read from protocol field */
37 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
38 offsetof(struct bpf_sk_lookup
, protocol
)),
40 /* 1-byte read from remote_ip4 field */
41 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
42 offsetof(struct bpf_sk_lookup
, remote_ip4
)),
43 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
44 offsetof(struct bpf_sk_lookup
, remote_ip4
) + 1),
45 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
46 offsetof(struct bpf_sk_lookup
, remote_ip4
) + 2),
47 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
48 offsetof(struct bpf_sk_lookup
, remote_ip4
) + 3),
49 /* 2-byte read from remote_ip4 field */
50 BPF_LDX_MEM(BPF_H
, BPF_REG_0
, BPF_REG_1
,
51 offsetof(struct bpf_sk_lookup
, remote_ip4
)),
52 BPF_LDX_MEM(BPF_H
, BPF_REG_0
, BPF_REG_1
,
53 offsetof(struct bpf_sk_lookup
, remote_ip4
) + 2),
54 /* 4-byte read from remote_ip4 field */
55 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
56 offsetof(struct bpf_sk_lookup
, remote_ip4
)),
58 /* 1-byte read from remote_ip6 field */
59 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
60 offsetof(struct bpf_sk_lookup
, remote_ip6
)),
61 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
62 offsetof(struct bpf_sk_lookup
, remote_ip6
) + 1),
63 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
64 offsetof(struct bpf_sk_lookup
, remote_ip6
) + 2),
65 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
66 offsetof(struct bpf_sk_lookup
, remote_ip6
) + 3),
67 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
68 offsetof(struct bpf_sk_lookup
, remote_ip6
) + 4),
69 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
70 offsetof(struct bpf_sk_lookup
, remote_ip6
) + 5),
71 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
72 offsetof(struct bpf_sk_lookup
, remote_ip6
) + 6),
73 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
74 offsetof(struct bpf_sk_lookup
, remote_ip6
) + 7),
75 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
76 offsetof(struct bpf_sk_lookup
, remote_ip6
) + 8),
77 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
78 offsetof(struct bpf_sk_lookup
, remote_ip6
) + 9),
79 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
80 offsetof(struct bpf_sk_lookup
, remote_ip6
) + 10),
81 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
82 offsetof(struct bpf_sk_lookup
, remote_ip6
) + 11),
83 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
84 offsetof(struct bpf_sk_lookup
, remote_ip6
) + 12),
85 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
86 offsetof(struct bpf_sk_lookup
, remote_ip6
) + 13),
87 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
88 offsetof(struct bpf_sk_lookup
, remote_ip6
) + 14),
89 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
90 offsetof(struct bpf_sk_lookup
, remote_ip6
) + 15),
91 /* 2-byte read from remote_ip6 field */
92 BPF_LDX_MEM(BPF_H
, BPF_REG_0
, BPF_REG_1
,
93 offsetof(struct bpf_sk_lookup
, remote_ip6
)),
94 BPF_LDX_MEM(BPF_H
, BPF_REG_0
, BPF_REG_1
,
95 offsetof(struct bpf_sk_lookup
, remote_ip6
) + 2),
96 BPF_LDX_MEM(BPF_H
, BPF_REG_0
, BPF_REG_1
,
97 offsetof(struct bpf_sk_lookup
, remote_ip6
) + 4),
98 BPF_LDX_MEM(BPF_H
, BPF_REG_0
, BPF_REG_1
,
99 offsetof(struct bpf_sk_lookup
, remote_ip6
) + 6),
100 BPF_LDX_MEM(BPF_H
, BPF_REG_0
, BPF_REG_1
,
101 offsetof(struct bpf_sk_lookup
, remote_ip6
) + 8),
102 BPF_LDX_MEM(BPF_H
, BPF_REG_0
, BPF_REG_1
,
103 offsetof(struct bpf_sk_lookup
, remote_ip6
) + 10),
104 BPF_LDX_MEM(BPF_H
, BPF_REG_0
, BPF_REG_1
,
105 offsetof(struct bpf_sk_lookup
, remote_ip6
) + 12),
106 BPF_LDX_MEM(BPF_H
, BPF_REG_0
, BPF_REG_1
,
107 offsetof(struct bpf_sk_lookup
, remote_ip6
) + 14),
108 /* 4-byte read from remote_ip6 field */
109 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
110 offsetof(struct bpf_sk_lookup
, remote_ip6
)),
111 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
112 offsetof(struct bpf_sk_lookup
, remote_ip6
) + 4),
113 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
114 offsetof(struct bpf_sk_lookup
, remote_ip6
) + 8),
115 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
116 offsetof(struct bpf_sk_lookup
, remote_ip6
) + 12),
118 /* 1-byte read from remote_port field */
119 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
120 offsetof(struct bpf_sk_lookup
, remote_port
)),
121 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
122 offsetof(struct bpf_sk_lookup
, remote_port
) + 1),
123 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
124 offsetof(struct bpf_sk_lookup
, remote_port
) + 2),
125 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
126 offsetof(struct bpf_sk_lookup
, remote_port
) + 3),
127 /* 2-byte read from remote_port field */
128 BPF_LDX_MEM(BPF_H
, BPF_REG_0
, BPF_REG_1
,
129 offsetof(struct bpf_sk_lookup
, remote_port
)),
130 BPF_LDX_MEM(BPF_H
, BPF_REG_0
, BPF_REG_1
,
131 offsetof(struct bpf_sk_lookup
, remote_port
) + 2),
132 /* 4-byte read from remote_port field */
133 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
134 offsetof(struct bpf_sk_lookup
, remote_port
)),
136 /* 1-byte read from local_ip4 field */
137 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
138 offsetof(struct bpf_sk_lookup
, local_ip4
)),
139 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
140 offsetof(struct bpf_sk_lookup
, local_ip4
) + 1),
141 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
142 offsetof(struct bpf_sk_lookup
, local_ip4
) + 2),
143 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
144 offsetof(struct bpf_sk_lookup
, local_ip4
) + 3),
145 /* 2-byte read from local_ip4 field */
146 BPF_LDX_MEM(BPF_H
, BPF_REG_0
, BPF_REG_1
,
147 offsetof(struct bpf_sk_lookup
, local_ip4
)),
148 BPF_LDX_MEM(BPF_H
, BPF_REG_0
, BPF_REG_1
,
149 offsetof(struct bpf_sk_lookup
, local_ip4
) + 2),
150 /* 4-byte read from local_ip4 field */
151 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
152 offsetof(struct bpf_sk_lookup
, local_ip4
)),
154 /* 1-byte read from local_ip6 field */
155 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
156 offsetof(struct bpf_sk_lookup
, local_ip6
)),
157 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
158 offsetof(struct bpf_sk_lookup
, local_ip6
) + 1),
159 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
160 offsetof(struct bpf_sk_lookup
, local_ip6
) + 2),
161 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
162 offsetof(struct bpf_sk_lookup
, local_ip6
) + 3),
163 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
164 offsetof(struct bpf_sk_lookup
, local_ip6
) + 4),
165 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
166 offsetof(struct bpf_sk_lookup
, local_ip6
) + 5),
167 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
168 offsetof(struct bpf_sk_lookup
, local_ip6
) + 6),
169 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
170 offsetof(struct bpf_sk_lookup
, local_ip6
) + 7),
171 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
172 offsetof(struct bpf_sk_lookup
, local_ip6
) + 8),
173 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
174 offsetof(struct bpf_sk_lookup
, local_ip6
) + 9),
175 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
176 offsetof(struct bpf_sk_lookup
, local_ip6
) + 10),
177 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
178 offsetof(struct bpf_sk_lookup
, local_ip6
) + 11),
179 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
180 offsetof(struct bpf_sk_lookup
, local_ip6
) + 12),
181 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
182 offsetof(struct bpf_sk_lookup
, local_ip6
) + 13),
183 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
184 offsetof(struct bpf_sk_lookup
, local_ip6
) + 14),
185 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
186 offsetof(struct bpf_sk_lookup
, local_ip6
) + 15),
187 /* 2-byte read from local_ip6 field */
188 BPF_LDX_MEM(BPF_H
, BPF_REG_0
, BPF_REG_1
,
189 offsetof(struct bpf_sk_lookup
, local_ip6
)),
190 BPF_LDX_MEM(BPF_H
, BPF_REG_0
, BPF_REG_1
,
191 offsetof(struct bpf_sk_lookup
, local_ip6
) + 2),
192 BPF_LDX_MEM(BPF_H
, BPF_REG_0
, BPF_REG_1
,
193 offsetof(struct bpf_sk_lookup
, local_ip6
) + 4),
194 BPF_LDX_MEM(BPF_H
, BPF_REG_0
, BPF_REG_1
,
195 offsetof(struct bpf_sk_lookup
, local_ip6
) + 6),
196 BPF_LDX_MEM(BPF_H
, BPF_REG_0
, BPF_REG_1
,
197 offsetof(struct bpf_sk_lookup
, local_ip6
) + 8),
198 BPF_LDX_MEM(BPF_H
, BPF_REG_0
, BPF_REG_1
,
199 offsetof(struct bpf_sk_lookup
, local_ip6
) + 10),
200 BPF_LDX_MEM(BPF_H
, BPF_REG_0
, BPF_REG_1
,
201 offsetof(struct bpf_sk_lookup
, local_ip6
) + 12),
202 BPF_LDX_MEM(BPF_H
, BPF_REG_0
, BPF_REG_1
,
203 offsetof(struct bpf_sk_lookup
, local_ip6
) + 14),
204 /* 4-byte read from local_ip6 field */
205 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
206 offsetof(struct bpf_sk_lookup
, local_ip6
)),
207 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
208 offsetof(struct bpf_sk_lookup
, local_ip6
) + 4),
209 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
210 offsetof(struct bpf_sk_lookup
, local_ip6
) + 8),
211 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
212 offsetof(struct bpf_sk_lookup
, local_ip6
) + 12),
214 /* 1-byte read from local_port field */
215 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
216 offsetof(struct bpf_sk_lookup
, local_port
)),
217 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
218 offsetof(struct bpf_sk_lookup
, local_port
) + 1),
219 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
220 offsetof(struct bpf_sk_lookup
, local_port
) + 2),
221 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
222 offsetof(struct bpf_sk_lookup
, local_port
) + 3),
223 /* 2-byte read from local_port field */
224 BPF_LDX_MEM(BPF_H
, BPF_REG_0
, BPF_REG_1
,
225 offsetof(struct bpf_sk_lookup
, local_port
)),
226 BPF_LDX_MEM(BPF_H
, BPF_REG_0
, BPF_REG_1
,
227 offsetof(struct bpf_sk_lookup
, local_port
) + 2),
228 /* 4-byte read from local_port field */
229 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
230 offsetof(struct bpf_sk_lookup
, local_port
)),
232 /* 8-byte read from sk field */
233 BPF_LDX_MEM(BPF_DW
, BPF_REG_0
, BPF_REG_1
,
234 offsetof(struct bpf_sk_lookup
, sk
)),
236 BPF_MOV32_IMM(BPF_REG_0
, 0),
240 .prog_type
= BPF_PROG_TYPE_SK_LOOKUP
,
241 .expected_attach_type
= BPF_SK_LOOKUP
,
243 /* invalid 8-byte reads from a 4-byte fields in bpf_sk_lookup */
245 "invalid 8-byte read from bpf_sk_lookup family field",
247 BPF_LDX_MEM(BPF_DW
, BPF_REG_0
, BPF_REG_1
,
248 offsetof(struct bpf_sk_lookup
, family
)),
249 BPF_MOV32_IMM(BPF_REG_0
, 0),
252 .errstr
= "invalid bpf_context access",
254 .prog_type
= BPF_PROG_TYPE_SK_LOOKUP
,
255 .expected_attach_type
= BPF_SK_LOOKUP
,
258 "invalid 8-byte read from bpf_sk_lookup protocol field",
260 BPF_LDX_MEM(BPF_DW
, BPF_REG_0
, BPF_REG_1
,
261 offsetof(struct bpf_sk_lookup
, protocol
)),
262 BPF_MOV32_IMM(BPF_REG_0
, 0),
265 .errstr
= "invalid bpf_context access",
267 .prog_type
= BPF_PROG_TYPE_SK_LOOKUP
,
268 .expected_attach_type
= BPF_SK_LOOKUP
,
269 .flags
= F_NEEDS_EFFICIENT_UNALIGNED_ACCESS
,
272 "invalid 8-byte read from bpf_sk_lookup remote_ip4 field",
274 BPF_LDX_MEM(BPF_DW
, BPF_REG_0
, BPF_REG_1
,
275 offsetof(struct bpf_sk_lookup
, remote_ip4
)),
276 BPF_MOV32_IMM(BPF_REG_0
, 0),
279 .errstr
= "invalid bpf_context access",
281 .prog_type
= BPF_PROG_TYPE_SK_LOOKUP
,
282 .expected_attach_type
= BPF_SK_LOOKUP
,
285 "invalid 8-byte read from bpf_sk_lookup remote_ip6 field",
287 BPF_LDX_MEM(BPF_DW
, BPF_REG_0
, BPF_REG_1
,
288 offsetof(struct bpf_sk_lookup
, remote_ip6
)),
289 BPF_MOV32_IMM(BPF_REG_0
, 0),
292 .errstr
= "invalid bpf_context access",
294 .prog_type
= BPF_PROG_TYPE_SK_LOOKUP
,
295 .expected_attach_type
= BPF_SK_LOOKUP
,
296 .flags
= F_NEEDS_EFFICIENT_UNALIGNED_ACCESS
,
299 "invalid 8-byte read from bpf_sk_lookup remote_port field",
301 BPF_LDX_MEM(BPF_DW
, BPF_REG_0
, BPF_REG_1
,
302 offsetof(struct bpf_sk_lookup
, remote_port
)),
303 BPF_MOV32_IMM(BPF_REG_0
, 0),
306 .errstr
= "invalid bpf_context access",
308 .prog_type
= BPF_PROG_TYPE_SK_LOOKUP
,
309 .expected_attach_type
= BPF_SK_LOOKUP
,
310 .flags
= F_NEEDS_EFFICIENT_UNALIGNED_ACCESS
,
313 "invalid 8-byte read from bpf_sk_lookup local_ip4 field",
315 BPF_LDX_MEM(BPF_DW
, BPF_REG_0
, BPF_REG_1
,
316 offsetof(struct bpf_sk_lookup
, local_ip4
)),
317 BPF_MOV32_IMM(BPF_REG_0
, 0),
320 .errstr
= "invalid bpf_context access",
322 .prog_type
= BPF_PROG_TYPE_SK_LOOKUP
,
323 .expected_attach_type
= BPF_SK_LOOKUP
,
326 "invalid 8-byte read from bpf_sk_lookup local_ip6 field",
328 BPF_LDX_MEM(BPF_DW
, BPF_REG_0
, BPF_REG_1
,
329 offsetof(struct bpf_sk_lookup
, local_ip6
)),
330 BPF_MOV32_IMM(BPF_REG_0
, 0),
333 .errstr
= "invalid bpf_context access",
335 .prog_type
= BPF_PROG_TYPE_SK_LOOKUP
,
336 .expected_attach_type
= BPF_SK_LOOKUP
,
337 .flags
= F_NEEDS_EFFICIENT_UNALIGNED_ACCESS
,
340 "invalid 8-byte read from bpf_sk_lookup local_port field",
342 BPF_LDX_MEM(BPF_DW
, BPF_REG_0
, BPF_REG_1
,
343 offsetof(struct bpf_sk_lookup
, local_port
)),
344 BPF_MOV32_IMM(BPF_REG_0
, 0),
347 .errstr
= "invalid bpf_context access",
349 .prog_type
= BPF_PROG_TYPE_SK_LOOKUP
,
350 .expected_attach_type
= BPF_SK_LOOKUP
,
351 .flags
= F_NEEDS_EFFICIENT_UNALIGNED_ACCESS
,
353 /* invalid 1,2,4-byte reads from 8-byte fields in bpf_sk_lookup */
355 "invalid 4-byte read from bpf_sk_lookup sk field",
357 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
358 offsetof(struct bpf_sk_lookup
, sk
)),
359 BPF_MOV32_IMM(BPF_REG_0
, 0),
362 .errstr
= "invalid bpf_context access",
364 .prog_type
= BPF_PROG_TYPE_SK_LOOKUP
,
365 .expected_attach_type
= BPF_SK_LOOKUP
,
368 "invalid 2-byte read from bpf_sk_lookup sk field",
370 BPF_LDX_MEM(BPF_H
, BPF_REG_0
, BPF_REG_1
,
371 offsetof(struct bpf_sk_lookup
, sk
)),
372 BPF_MOV32_IMM(BPF_REG_0
, 0),
375 .errstr
= "invalid bpf_context access",
377 .prog_type
= BPF_PROG_TYPE_SK_LOOKUP
,
378 .expected_attach_type
= BPF_SK_LOOKUP
,
381 "invalid 1-byte read from bpf_sk_lookup sk field",
383 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
,
384 offsetof(struct bpf_sk_lookup
, sk
)),
385 BPF_MOV32_IMM(BPF_REG_0
, 0),
388 .errstr
= "invalid bpf_context access",
390 .prog_type
= BPF_PROG_TYPE_SK_LOOKUP
,
391 .expected_attach_type
= BPF_SK_LOOKUP
,
393 /* out of bounds and unaligned reads from bpf_sk_lookup */
395 "invalid 4-byte read past end of bpf_sk_lookup",
397 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
398 sizeof(struct bpf_sk_lookup
)),
399 BPF_MOV32_IMM(BPF_REG_0
, 0),
402 .errstr
= "invalid bpf_context access",
404 .prog_type
= BPF_PROG_TYPE_SK_LOOKUP
,
405 .expected_attach_type
= BPF_SK_LOOKUP
,
408 "invalid 4-byte unaligned read from bpf_sk_lookup at odd offset",
410 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
, 1),
411 BPF_MOV32_IMM(BPF_REG_0
, 0),
414 .errstr
= "invalid bpf_context access",
416 .prog_type
= BPF_PROG_TYPE_SK_LOOKUP
,
417 .expected_attach_type
= BPF_SK_LOOKUP
,
418 .flags
= F_NEEDS_EFFICIENT_UNALIGNED_ACCESS
,
421 "invalid 4-byte unaligned read from bpf_sk_lookup at even offset",
423 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
, 2),
424 BPF_MOV32_IMM(BPF_REG_0
, 0),
427 .errstr
= "invalid bpf_context access",
429 .prog_type
= BPF_PROG_TYPE_SK_LOOKUP
,
430 .expected_attach_type
= BPF_SK_LOOKUP
,
431 .flags
= F_NEEDS_EFFICIENT_UNALIGNED_ACCESS
,
433 /* in-bound and out-of-bound writes to bpf_sk_lookup */
435 "invalid 8-byte write to bpf_sk_lookup",
437 BPF_MOV64_IMM(BPF_REG_0
, 0xcafe4a11U
),
438 BPF_STX_MEM(BPF_DW
, BPF_REG_1
, BPF_REG_0
, 0),
439 BPF_MOV32_IMM(BPF_REG_0
, 0),
442 .errstr
= "invalid bpf_context access",
444 .prog_type
= BPF_PROG_TYPE_SK_LOOKUP
,
445 .expected_attach_type
= BPF_SK_LOOKUP
,
448 "invalid 4-byte write to bpf_sk_lookup",
450 BPF_MOV64_IMM(BPF_REG_0
, 0xcafe4a11U
),
451 BPF_STX_MEM(BPF_W
, BPF_REG_1
, BPF_REG_0
, 0),
452 BPF_MOV32_IMM(BPF_REG_0
, 0),
455 .errstr
= "invalid bpf_context access",
457 .prog_type
= BPF_PROG_TYPE_SK_LOOKUP
,
458 .expected_attach_type
= BPF_SK_LOOKUP
,
461 "invalid 2-byte write to bpf_sk_lookup",
463 BPF_MOV64_IMM(BPF_REG_0
, 0xcafe4a11U
),
464 BPF_STX_MEM(BPF_H
, BPF_REG_1
, BPF_REG_0
, 0),
465 BPF_MOV32_IMM(BPF_REG_0
, 0),
468 .errstr
= "invalid bpf_context access",
470 .prog_type
= BPF_PROG_TYPE_SK_LOOKUP
,
471 .expected_attach_type
= BPF_SK_LOOKUP
,
474 "invalid 1-byte write to bpf_sk_lookup",
476 BPF_MOV64_IMM(BPF_REG_0
, 0xcafe4a11U
),
477 BPF_STX_MEM(BPF_B
, BPF_REG_1
, BPF_REG_0
, 0),
478 BPF_MOV32_IMM(BPF_REG_0
, 0),
481 .errstr
= "invalid bpf_context access",
483 .prog_type
= BPF_PROG_TYPE_SK_LOOKUP
,
484 .expected_attach_type
= BPF_SK_LOOKUP
,
487 "invalid 4-byte write past end of bpf_sk_lookup",
489 BPF_MOV64_IMM(BPF_REG_0
, 0xcafe4a11U
),
490 BPF_STX_MEM(BPF_W
, BPF_REG_1
, BPF_REG_0
,
491 sizeof(struct bpf_sk_lookup
)),
492 BPF_MOV32_IMM(BPF_REG_0
, 0),
495 .errstr
= "invalid bpf_context access",
497 .prog_type
= BPF_PROG_TYPE_SK_LOOKUP
,
498 .expected_attach_type
= BPF_SK_LOOKUP
,