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 array range",
74 "direct map access, write test 7",
76 BPF_MOV64_IMM(BPF_REG_0
, 1),
77 BPF_LD_MAP_VALUE(BPF_REG_1
, 0, -1),
78 BPF_ST_MEM(BPF_DW
, BPF_REG_1
, 4, 4242),
81 .fixup_map_array_48b
= { 1 },
83 .errstr
= "direct value offset of 4294967295 is not allowed",
86 "direct map access, write test 8",
88 BPF_MOV64_IMM(BPF_REG_0
, 1),
89 BPF_LD_MAP_VALUE(BPF_REG_1
, 0, 1),
90 BPF_ST_MEM(BPF_DW
, BPF_REG_1
, -1, 4242),
93 .fixup_map_array_48b
= { 1 },
98 "direct map access, write test 9",
100 BPF_MOV64_IMM(BPF_REG_0
, 1),
101 BPF_LD_MAP_VALUE(BPF_REG_1
, 0, 48),
102 BPF_ST_MEM(BPF_DW
, BPF_REG_1
, 0, 4242),
105 .fixup_map_array_48b
= { 1 },
107 .errstr
= "invalid access to map value pointer",
110 "direct map access, write test 10",
112 BPF_MOV64_IMM(BPF_REG_0
, 1),
113 BPF_LD_MAP_VALUE(BPF_REG_1
, 0, 47),
114 BPF_ST_MEM(BPF_B
, BPF_REG_1
, 0, 4),
117 .fixup_map_array_48b
= { 1 },
122 "direct map access, write test 11",
124 BPF_MOV64_IMM(BPF_REG_0
, 1),
125 BPF_LD_MAP_VALUE(BPF_REG_1
, 0, 48),
126 BPF_ST_MEM(BPF_B
, BPF_REG_1
, 0, 4),
129 .fixup_map_array_48b
= { 1 },
131 .errstr
= "invalid access to map value pointer",
134 "direct map access, write test 12",
136 BPF_MOV64_IMM(BPF_REG_0
, 1),
137 BPF_LD_MAP_VALUE(BPF_REG_1
, 0, (1<<29)),
138 BPF_ST_MEM(BPF_B
, BPF_REG_1
, 0, 4),
141 .fixup_map_array_48b
= { 1 },
143 .errstr
= "direct value offset of 536870912 is not allowed",
146 "direct map access, write test 13",
148 BPF_MOV64_IMM(BPF_REG_0
, 1),
149 BPF_LD_MAP_VALUE(BPF_REG_1
, 0, (1<<29)-1),
150 BPF_ST_MEM(BPF_B
, BPF_REG_1
, 0, 4),
153 .fixup_map_array_48b
= { 1 },
155 .errstr
= "invalid access to map value pointer, value_size=48 off=536870911",
158 "direct map access, write test 14",
160 BPF_MOV64_IMM(BPF_REG_0
, 1),
161 BPF_LD_MAP_VALUE(BPF_REG_1
, 0, 47),
162 BPF_LD_MAP_VALUE(BPF_REG_2
, 0, 46),
163 BPF_ST_MEM(BPF_H
, BPF_REG_2
, 0, 0xffff),
164 BPF_LDX_MEM(BPF_B
, BPF_REG_0
, BPF_REG_1
, 0),
167 .fixup_map_array_48b
= { 1, 3 },
172 "direct map access, write test 15",
174 BPF_MOV64_IMM(BPF_REG_0
, 1),
175 BPF_LD_MAP_VALUE(BPF_REG_1
, 0, 46),
176 BPF_LD_MAP_VALUE(BPF_REG_2
, 0, 46),
177 BPF_ST_MEM(BPF_H
, BPF_REG_2
, 0, 0xffff),
178 BPF_LDX_MEM(BPF_H
, BPF_REG_0
, BPF_REG_1
, 0),
181 .fixup_map_array_48b
= { 1, 3 },
186 "direct map access, write test 16",
188 BPF_MOV64_IMM(BPF_REG_0
, 1),
189 BPF_LD_MAP_VALUE(BPF_REG_1
, 0, 46),
190 BPF_LD_MAP_VALUE(BPF_REG_2
, 0, 47),
191 BPF_ST_MEM(BPF_H
, BPF_REG_2
, 0, 0xffff),
192 BPF_LDX_MEM(BPF_H
, BPF_REG_0
, BPF_REG_1
, 0),
195 .fixup_map_array_48b
= { 1, 3 },
197 .errstr
= "invalid access to map value, value_size=48 off=47 size=2",
200 "direct map access, write test 17",
202 BPF_MOV64_IMM(BPF_REG_0
, 1),
203 BPF_LD_MAP_VALUE(BPF_REG_1
, 0, 46),
204 BPF_LD_MAP_VALUE(BPF_REG_2
, 0, 46),
205 BPF_ST_MEM(BPF_H
, BPF_REG_2
, 1, 0xffff),
206 BPF_LDX_MEM(BPF_H
, BPF_REG_0
, BPF_REG_1
, 0),
209 .fixup_map_array_48b
= { 1, 3 },
211 .errstr
= "invalid access to map value, value_size=48 off=47 size=2",
214 "direct map access, write test 18",
216 BPF_MOV64_IMM(BPF_REG_0
, 1),
217 BPF_LD_MAP_VALUE(BPF_REG_1
, 0, 0),
218 BPF_ST_MEM(BPF_H
, BPF_REG_1
, 0, 42),
221 .fixup_map_array_small
= { 1 },
223 .errstr
= "R1 min value is outside of the array range",
226 "direct map access, write test 19",
228 BPF_MOV64_IMM(BPF_REG_0
, 1),
229 BPF_LD_MAP_VALUE(BPF_REG_1
, 0, 0),
230 BPF_ST_MEM(BPF_B
, BPF_REG_1
, 0, 42),
233 .fixup_map_array_small
= { 1 },
238 "direct map access, write test 20",
240 BPF_MOV64_IMM(BPF_REG_0
, 1),
241 BPF_LD_MAP_VALUE(BPF_REG_1
, 0, 1),
242 BPF_ST_MEM(BPF_B
, BPF_REG_1
, 0, 42),
245 .fixup_map_array_small
= { 1 },
247 .errstr
= "invalid access to map value pointer",
250 "direct map access, invalid insn test 1",
252 BPF_MOV64_IMM(BPF_REG_0
, 1),
253 BPF_LD_IMM64_RAW_FULL(BPF_REG_1
, BPF_PSEUDO_MAP_VALUE
, 0, 1, 0, 47),
256 .fixup_map_array_48b
= { 1 },
258 .errstr
= "invalid bpf_ld_imm64 insn",
261 "direct map access, invalid insn test 2",
263 BPF_MOV64_IMM(BPF_REG_0
, 1),
264 BPF_LD_IMM64_RAW_FULL(BPF_REG_1
, BPF_PSEUDO_MAP_VALUE
, 1, 0, 0, 47),
267 .fixup_map_array_48b
= { 1 },
269 .errstr
= "BPF_LD_IMM64 uses reserved fields",
272 "direct map access, invalid insn test 3",
274 BPF_MOV64_IMM(BPF_REG_0
, 1),
275 BPF_LD_IMM64_RAW_FULL(BPF_REG_1
, BPF_PSEUDO_MAP_VALUE
, ~0, 0, 0, 47),
278 .fixup_map_array_48b
= { 1 },
280 .errstr
= "BPF_LD_IMM64 uses reserved fields",
283 "direct map access, invalid insn test 4",
285 BPF_MOV64_IMM(BPF_REG_0
, 1),
286 BPF_LD_IMM64_RAW_FULL(BPF_REG_1
, BPF_PSEUDO_MAP_VALUE
, 0, ~0, 0, 47),
289 .fixup_map_array_48b
= { 1 },
291 .errstr
= "invalid bpf_ld_imm64 insn",
294 "direct map access, invalid insn test 5",
296 BPF_MOV64_IMM(BPF_REG_0
, 1),
297 BPF_LD_IMM64_RAW_FULL(BPF_REG_1
, BPF_PSEUDO_MAP_VALUE
, ~0, ~0, 0, 47),
300 .fixup_map_array_48b
= { 1 },
302 .errstr
= "invalid bpf_ld_imm64 insn",
305 "direct map access, invalid insn test 6",
307 BPF_MOV64_IMM(BPF_REG_0
, 1),
308 BPF_LD_IMM64_RAW_FULL(BPF_REG_1
, BPF_PSEUDO_MAP_FD
, ~0, 0, 0, 0),
311 .fixup_map_array_48b
= { 1 },
313 .errstr
= "BPF_LD_IMM64 uses reserved fields",
316 "direct map access, invalid insn test 7",
318 BPF_MOV64_IMM(BPF_REG_0
, 1),
319 BPF_LD_IMM64_RAW_FULL(BPF_REG_1
, BPF_PSEUDO_MAP_FD
, 0, ~0, 0, 0),
322 .fixup_map_array_48b
= { 1 },
324 .errstr
= "invalid bpf_ld_imm64 insn",
327 "direct map access, invalid insn test 8",
329 BPF_MOV64_IMM(BPF_REG_0
, 1),
330 BPF_LD_IMM64_RAW_FULL(BPF_REG_1
, BPF_PSEUDO_MAP_FD
, ~0, ~0, 0, 0),
333 .fixup_map_array_48b
= { 1 },
335 .errstr
= "invalid bpf_ld_imm64 insn",
338 "direct map access, invalid insn test 9",
340 BPF_MOV64_IMM(BPF_REG_0
, 1),
341 BPF_LD_IMM64_RAW_FULL(BPF_REG_1
, BPF_PSEUDO_MAP_FD
, 0, 0, 0, 47),
344 .fixup_map_array_48b
= { 1 },
346 .errstr
= "unrecognized bpf_ld_imm64 insn",