2 "direct map access, write test 1",
4 BPF_MOV64_IMM(BPF_REG_0
, 1),
5 BPF_LD_MAP_VALUE(BPF_REG_1
, 0, 0),
6 BPF_ST_MEM(BPF_DW
, BPF_REG_1
, 0, 4242),
9 .fixup_map_array_48b
= { 1 },
14 "direct map access, write test 2",
16 BPF_MOV64_IMM(BPF_REG_0
, 1),
17 BPF_LD_MAP_VALUE(BPF_REG_1
, 0, 8),
18 BPF_ST_MEM(BPF_DW
, BPF_REG_1
, 0, 4242),
21 .fixup_map_array_48b
= { 1 },
26 "direct map access, write test 3",
28 BPF_MOV64_IMM(BPF_REG_0
, 1),
29 BPF_LD_MAP_VALUE(BPF_REG_1
, 0, 8),
30 BPF_ST_MEM(BPF_DW
, BPF_REG_1
, 8, 4242),
33 .fixup_map_array_48b
= { 1 },
38 "direct map access, write test 4",
40 BPF_MOV64_IMM(BPF_REG_0
, 1),
41 BPF_LD_MAP_VALUE(BPF_REG_1
, 0, 40),
42 BPF_ST_MEM(BPF_DW
, BPF_REG_1
, 0, 4242),
45 .fixup_map_array_48b
= { 1 },
50 "direct map access, write test 5",
52 BPF_MOV64_IMM(BPF_REG_0
, 1),
53 BPF_LD_MAP_VALUE(BPF_REG_1
, 0, 32),
54 BPF_ST_MEM(BPF_DW
, BPF_REG_1
, 8, 4242),
57 .fixup_map_array_48b
= { 1 },
62 "direct map access, write test 6",
64 BPF_MOV64_IMM(BPF_REG_0
, 1),
65 BPF_LD_MAP_VALUE(BPF_REG_1
, 0, 40),
66 BPF_ST_MEM(BPF_DW
, BPF_REG_1
, 4, 4242),
69 .fixup_map_array_48b
= { 1 },
71 .errstr
= "R1 min value is outside of the allowed memory range",
72 .flags
= F_NEEDS_EFFICIENT_UNALIGNED_ACCESS
,
75 "direct map access, write test 7",
77 BPF_MOV64_IMM(BPF_REG_0
, 1),
78 BPF_LD_MAP_VALUE(BPF_REG_1
, 0, -1),
79 BPF_ST_MEM(BPF_DW
, BPF_REG_1
, 4, 4242),
82 .fixup_map_array_48b
= { 1 },
84 .errstr
= "direct value offset of 4294967295 is not allowed",
87 "direct map access, write test 8",
89 BPF_MOV64_IMM(BPF_REG_0
, 1),
90 BPF_LD_MAP_VALUE(BPF_REG_1
, 0, 1),
91 BPF_ST_MEM(BPF_DW
, BPF_REG_1
, -1, 4242),
94 .fixup_map_array_48b
= { 1 },
99 "direct map access, write test 9",
101 BPF_MOV64_IMM(BPF_REG_0
, 1),
102 BPF_LD_MAP_VALUE(BPF_REG_1
, 0, 48),
103 BPF_ST_MEM(BPF_DW
, BPF_REG_1
, 0, 4242),
106 .fixup_map_array_48b
= { 1 },
108 .errstr
= "invalid access to map value pointer",
111 "direct map access, write test 10",
113 BPF_MOV64_IMM(BPF_REG_0
, 1),
114 BPF_LD_MAP_VALUE(BPF_REG_1
, 0, 47),
115 BPF_ST_MEM(BPF_B
, BPF_REG_1
, 0, 4),
118 .fixup_map_array_48b
= { 1 },
123 "direct map access, write test 11",
125 BPF_MOV64_IMM(BPF_REG_0
, 1),
126 BPF_LD_MAP_VALUE(BPF_REG_1
, 0, 48),
127 BPF_ST_MEM(BPF_B
, BPF_REG_1
, 0, 4),
130 .fixup_map_array_48b
= { 1 },
132 .errstr
= "invalid access to map value pointer",
135 "direct map access, write test 12",
137 BPF_MOV64_IMM(BPF_REG_0
, 1),
138 BPF_LD_MAP_VALUE(BPF_REG_1
, 0, (1<<29)),
139 BPF_ST_MEM(BPF_B
, BPF_REG_1
, 0, 4),
142 .fixup_map_array_48b
= { 1 },
144 .errstr
= "direct value offset of 536870912 is not allowed",
147 "direct map access, write test 13",
149 BPF_MOV64_IMM(BPF_REG_0
, 1),
150 BPF_LD_MAP_VALUE(BPF_REG_1
, 0, (1<<29)-1),
151 BPF_ST_MEM(BPF_B
, BPF_REG_1
, 0, 4),
154 .fixup_map_array_48b
= { 1 },
156 .errstr
= "invalid access to map value pointer, value_size=48 off=536870911",
159 "direct map access, write test 14",
161 BPF_MOV64_IMM(BPF_REG_0
, 1),
162 BPF_LD_MAP_VALUE(BPF_REG_1
, 0, 47),
163 BPF_LD_MAP_VALUE(BPF_REG_2
, 0, 46),
164 BPF_ST_MEM(BPF_H
, BPF_REG_2
, 0, 0xffff),
165 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
, 0),
168 .fixup_map_array_48b
= { 1, 3 },
173 "direct map access, write test 15",
175 BPF_MOV64_IMM(BPF_REG_0
, 1),
176 BPF_LD_MAP_VALUE(BPF_REG_1
, 0, 46),
177 BPF_LD_MAP_VALUE(BPF_REG_2
, 0, 46),
178 BPF_ST_MEM(BPF_H
, BPF_REG_2
, 0, 0xffff),
179 BPF_LDX_MEM(BPF_H
, BPF_REG_0
, BPF_REG_1
, 0),
182 .fixup_map_array_48b
= { 1, 3 },
187 "direct map access, write test 16",
189 BPF_MOV64_IMM(BPF_REG_0
, 1),
190 BPF_LD_MAP_VALUE(BPF_REG_1
, 0, 46),
191 BPF_LD_MAP_VALUE(BPF_REG_2
, 0, 47),
192 BPF_ST_MEM(BPF_H
, BPF_REG_2
, 0, 0xffff),
193 BPF_LDX_MEM(BPF_H
, BPF_REG_0
, BPF_REG_1
, 0),
196 .fixup_map_array_48b
= { 1, 3 },
198 .errstr
= "invalid access to map value, value_size=48 off=47 size=2",
199 .flags
= F_NEEDS_EFFICIENT_UNALIGNED_ACCESS
,
202 "direct map access, write test 17",
204 BPF_MOV64_IMM(BPF_REG_0
, 1),
205 BPF_LD_MAP_VALUE(BPF_REG_1
, 0, 46),
206 BPF_LD_MAP_VALUE(BPF_REG_2
, 0, 46),
207 BPF_ST_MEM(BPF_H
, BPF_REG_2
, 1, 0xffff),
208 BPF_LDX_MEM(BPF_H
, BPF_REG_0
, BPF_REG_1
, 0),
211 .fixup_map_array_48b
= { 1, 3 },
213 .errstr
= "invalid access to map value, value_size=48 off=47 size=2",
214 .flags
= F_NEEDS_EFFICIENT_UNALIGNED_ACCESS
,
217 "direct map access, write test 18",
219 BPF_MOV64_IMM(BPF_REG_0
, 1),
220 BPF_LD_MAP_VALUE(BPF_REG_1
, 0, 0),
221 BPF_ST_MEM(BPF_H
, BPF_REG_1
, 0, 42),
224 .fixup_map_array_small
= { 1 },
226 .errstr
= "R1 min value is outside of the allowed memory range",
229 "direct map access, write test 19",
231 BPF_MOV64_IMM(BPF_REG_0
, 1),
232 BPF_LD_MAP_VALUE(BPF_REG_1
, 0, 0),
233 BPF_ST_MEM(BPF_B
, BPF_REG_1
, 0, 42),
236 .fixup_map_array_small
= { 1 },
241 "direct map access, write test 20",
243 BPF_MOV64_IMM(BPF_REG_0
, 1),
244 BPF_LD_MAP_VALUE(BPF_REG_1
, 0, 1),
245 BPF_ST_MEM(BPF_B
, BPF_REG_1
, 0, 42),
248 .fixup_map_array_small
= { 1 },
250 .errstr
= "invalid access to map value pointer",
253 "direct map access, invalid insn test 1",
255 BPF_MOV64_IMM(BPF_REG_0
, 1),
256 BPF_LD_IMM64_RAW_FULL(BPF_REG_1
, BPF_PSEUDO_MAP_VALUE
, 0, 1, 0, 47),
259 .fixup_map_array_48b
= { 1 },
261 .errstr
= "invalid bpf_ld_imm64 insn",
264 "direct map access, invalid insn test 2",
266 BPF_MOV64_IMM(BPF_REG_0
, 1),
267 BPF_LD_IMM64_RAW_FULL(BPF_REG_1
, BPF_PSEUDO_MAP_VALUE
, 1, 0, 0, 47),
270 .fixup_map_array_48b
= { 1 },
272 .errstr
= "BPF_LD_IMM64 uses reserved fields",
275 "direct map access, invalid insn test 3",
277 BPF_MOV64_IMM(BPF_REG_0
, 1),
278 BPF_LD_IMM64_RAW_FULL(BPF_REG_1
, BPF_PSEUDO_MAP_VALUE
, ~0, 0, 0, 47),
281 .fixup_map_array_48b
= { 1 },
283 .errstr
= "BPF_LD_IMM64 uses reserved fields",
286 "direct map access, invalid insn test 4",
288 BPF_MOV64_IMM(BPF_REG_0
, 1),
289 BPF_LD_IMM64_RAW_FULL(BPF_REG_1
, BPF_PSEUDO_MAP_VALUE
, 0, ~0, 0, 47),
292 .fixup_map_array_48b
= { 1 },
294 .errstr
= "invalid bpf_ld_imm64 insn",
297 "direct map access, invalid insn test 5",
299 BPF_MOV64_IMM(BPF_REG_0
, 1),
300 BPF_LD_IMM64_RAW_FULL(BPF_REG_1
, BPF_PSEUDO_MAP_VALUE
, ~0, ~0, 0, 47),
303 .fixup_map_array_48b
= { 1 },
305 .errstr
= "invalid bpf_ld_imm64 insn",
308 "direct map access, invalid insn test 6",
310 BPF_MOV64_IMM(BPF_REG_0
, 1),
311 BPF_LD_IMM64_RAW_FULL(BPF_REG_1
, BPF_PSEUDO_MAP_FD
, ~0, 0, 0, 0),
314 .fixup_map_array_48b
= { 1 },
316 .errstr
= "BPF_LD_IMM64 uses reserved fields",
319 "direct map access, invalid insn test 7",
321 BPF_MOV64_IMM(BPF_REG_0
, 1),
322 BPF_LD_IMM64_RAW_FULL(BPF_REG_1
, BPF_PSEUDO_MAP_FD
, 0, ~0, 0, 0),
325 .fixup_map_array_48b
= { 1 },
327 .errstr
= "invalid bpf_ld_imm64 insn",
330 "direct map access, invalid insn test 8",
332 BPF_MOV64_IMM(BPF_REG_0
, 1),
333 BPF_LD_IMM64_RAW_FULL(BPF_REG_1
, BPF_PSEUDO_MAP_FD
, ~0, ~0, 0, 0),
336 .fixup_map_array_48b
= { 1 },
338 .errstr
= "invalid bpf_ld_imm64 insn",
341 "direct map access, invalid insn test 9",
343 BPF_MOV64_IMM(BPF_REG_0
, 1),
344 BPF_LD_IMM64_RAW_FULL(BPF_REG_1
, BPF_PSEUDO_MAP_FD
, 0, 0, 0, 47),
347 .fixup_map_array_48b
= { 1 },
349 .errstr
= "unrecognized bpf_ld_imm64 insn",