2 "valid cgroup storage access",
4 BPF_MOV64_IMM(BPF_REG_2
, 0),
5 BPF_LD_MAP_FD(BPF_REG_1
, 0),
6 BPF_RAW_INSN(BPF_JMP
| BPF_CALL
, 0, 0, 0, BPF_FUNC_get_local_storage
),
7 BPF_LDX_MEM(BPF_W
, BPF_REG_1
, BPF_REG_0
, 0),
8 BPF_MOV64_REG(BPF_REG_0
, BPF_REG_1
),
9 BPF_ALU64_IMM(BPF_AND
, BPF_REG_0
, 1),
12 .fixup_cgroup_storage
= { 1 },
14 .prog_type
= BPF_PROG_TYPE_CGROUP_SKB
,
17 "invalid cgroup storage access 1",
19 BPF_MOV64_IMM(BPF_REG_2
, 0),
20 BPF_LD_MAP_FD(BPF_REG_1
, 0),
21 BPF_RAW_INSN(BPF_JMP
| BPF_CALL
, 0, 0, 0, BPF_FUNC_get_local_storage
),
22 BPF_LDX_MEM(BPF_W
, BPF_REG_1
, BPF_REG_0
, 0),
23 BPF_MOV64_REG(BPF_REG_0
, BPF_REG_1
),
24 BPF_ALU64_IMM(BPF_AND
, BPF_REG_0
, 1),
27 .fixup_map_hash_8b
= { 1 },
29 .errstr
= "cannot pass map_type 1 into func bpf_get_local_storage",
30 .prog_type
= BPF_PROG_TYPE_CGROUP_SKB
,
33 "invalid cgroup storage access 2",
35 BPF_MOV64_IMM(BPF_REG_2
, 0),
36 BPF_LD_MAP_FD(BPF_REG_1
, 1),
37 BPF_RAW_INSN(BPF_JMP
| BPF_CALL
, 0, 0, 0, BPF_FUNC_get_local_storage
),
38 BPF_ALU64_IMM(BPF_AND
, BPF_REG_0
, 1),
42 .errstr
= "fd 1 is not pointing to valid bpf_map",
43 .prog_type
= BPF_PROG_TYPE_CGROUP_SKB
,
46 "invalid cgroup storage access 3",
48 BPF_MOV64_IMM(BPF_REG_2
, 0),
49 BPF_LD_MAP_FD(BPF_REG_1
, 0),
50 BPF_RAW_INSN(BPF_JMP
| BPF_CALL
, 0, 0, 0, BPF_FUNC_get_local_storage
),
51 BPF_LDX_MEM(BPF_W
, BPF_REG_1
, BPF_REG_0
, 256),
52 BPF_ALU64_IMM(BPF_ADD
, BPF_REG_1
, 1),
53 BPF_MOV64_IMM(BPF_REG_0
, 0),
56 .fixup_cgroup_storage
= { 1 },
58 .errstr
= "invalid access to map value, value_size=64 off=256 size=4",
59 .prog_type
= BPF_PROG_TYPE_CGROUP_SKB
,
62 "invalid cgroup storage access 4",
64 BPF_MOV64_IMM(BPF_REG_2
, 0),
65 BPF_LD_MAP_FD(BPF_REG_1
, 0),
66 BPF_RAW_INSN(BPF_JMP
| BPF_CALL
, 0, 0, 0, BPF_FUNC_get_local_storage
),
67 BPF_LDX_MEM(BPF_W
, BPF_REG_1
, BPF_REG_0
, -2),
68 BPF_MOV64_REG(BPF_REG_0
, BPF_REG_1
),
69 BPF_ALU64_IMM(BPF_ADD
, BPF_REG_1
, 1),
72 .fixup_cgroup_storage
= { 1 },
74 .errstr
= "invalid access to map value, value_size=64 off=-2 size=4",
75 .prog_type
= BPF_PROG_TYPE_CGROUP_SKB
,
76 .flags
= F_NEEDS_EFFICIENT_UNALIGNED_ACCESS
,
79 "invalid cgroup storage access 5",
81 BPF_MOV64_IMM(BPF_REG_2
, 7),
82 BPF_LD_MAP_FD(BPF_REG_1
, 0),
83 BPF_RAW_INSN(BPF_JMP
| BPF_CALL
, 0, 0, 0, BPF_FUNC_get_local_storage
),
84 BPF_LDX_MEM(BPF_W
, BPF_REG_1
, BPF_REG_0
, 0),
85 BPF_MOV64_REG(BPF_REG_0
, BPF_REG_1
),
86 BPF_ALU64_IMM(BPF_AND
, BPF_REG_0
, 1),
89 .fixup_cgroup_storage
= { 1 },
91 .errstr
= "get_local_storage() doesn't support non-zero flags",
92 .prog_type
= BPF_PROG_TYPE_CGROUP_SKB
,
95 "invalid cgroup storage access 6",
97 BPF_MOV64_REG(BPF_REG_2
, BPF_REG_1
),
98 BPF_LD_MAP_FD(BPF_REG_1
, 0),
99 BPF_RAW_INSN(BPF_JMP
| BPF_CALL
, 0, 0, 0, BPF_FUNC_get_local_storage
),
100 BPF_LDX_MEM(BPF_W
, BPF_REG_1
, BPF_REG_0
, 0),
101 BPF_MOV64_REG(BPF_REG_0
, BPF_REG_1
),
102 BPF_ALU64_IMM(BPF_AND
, BPF_REG_0
, 1),
105 .fixup_cgroup_storage
= { 1 },
107 .errstr
= "get_local_storage() doesn't support non-zero flags",
108 .errstr_unpriv
= "R2 leaks addr into helper function",
109 .prog_type
= BPF_PROG_TYPE_CGROUP_SKB
,
112 "valid per-cpu cgroup storage access",
114 BPF_MOV64_IMM(BPF_REG_2
, 0),
115 BPF_LD_MAP_FD(BPF_REG_1
, 0),
116 BPF_RAW_INSN(BPF_JMP
| BPF_CALL
, 0, 0, 0, BPF_FUNC_get_local_storage
),
117 BPF_LDX_MEM(BPF_W
, BPF_REG_1
, BPF_REG_0
, 0),
118 BPF_MOV64_REG(BPF_REG_0
, BPF_REG_1
),
119 BPF_ALU64_IMM(BPF_AND
, BPF_REG_0
, 1),
122 .fixup_percpu_cgroup_storage
= { 1 },
124 .prog_type
= BPF_PROG_TYPE_CGROUP_SKB
,
127 "invalid per-cpu cgroup storage access 1",
129 BPF_MOV64_IMM(BPF_REG_2
, 0),
130 BPF_LD_MAP_FD(BPF_REG_1
, 0),
131 BPF_RAW_INSN(BPF_JMP
| BPF_CALL
, 0, 0, 0, BPF_FUNC_get_local_storage
),
132 BPF_LDX_MEM(BPF_W
, BPF_REG_1
, BPF_REG_0
, 0),
133 BPF_MOV64_REG(BPF_REG_0
, BPF_REG_1
),
134 BPF_ALU64_IMM(BPF_AND
, BPF_REG_0
, 1),
137 .fixup_map_hash_8b
= { 1 },
139 .errstr
= "cannot pass map_type 1 into func bpf_get_local_storage",
140 .prog_type
= BPF_PROG_TYPE_CGROUP_SKB
,
143 "invalid per-cpu cgroup storage access 2",
145 BPF_MOV64_IMM(BPF_REG_2
, 0),
146 BPF_LD_MAP_FD(BPF_REG_1
, 1),
147 BPF_RAW_INSN(BPF_JMP
| BPF_CALL
, 0, 0, 0, BPF_FUNC_get_local_storage
),
148 BPF_ALU64_IMM(BPF_AND
, BPF_REG_0
, 1),
152 .errstr
= "fd 1 is not pointing to valid bpf_map",
153 .prog_type
= BPF_PROG_TYPE_CGROUP_SKB
,
156 "invalid per-cpu cgroup storage access 3",
158 BPF_MOV64_IMM(BPF_REG_2
, 0),
159 BPF_LD_MAP_FD(BPF_REG_1
, 0),
160 BPF_RAW_INSN(BPF_JMP
| BPF_CALL
, 0, 0, 0, BPF_FUNC_get_local_storage
),
161 BPF_LDX_MEM(BPF_W
, BPF_REG_1
, BPF_REG_0
, 256),
162 BPF_ALU64_IMM(BPF_ADD
, BPF_REG_1
, 1),
163 BPF_MOV64_IMM(BPF_REG_0
, 0),
166 .fixup_percpu_cgroup_storage
= { 1 },
168 .errstr
= "invalid access to map value, value_size=64 off=256 size=4",
169 .prog_type
= BPF_PROG_TYPE_CGROUP_SKB
,
172 "invalid per-cpu cgroup storage access 4",
174 BPF_MOV64_IMM(BPF_REG_2
, 0),
175 BPF_LD_MAP_FD(BPF_REG_1
, 0),
176 BPF_RAW_INSN(BPF_JMP
| BPF_CALL
, 0, 0, 0, BPF_FUNC_get_local_storage
),
177 BPF_LDX_MEM(BPF_W
, BPF_REG_1
, BPF_REG_0
, -2),
178 BPF_MOV64_REG(BPF_REG_0
, BPF_REG_1
),
179 BPF_ALU64_IMM(BPF_ADD
, BPF_REG_1
, 1),
182 .fixup_cgroup_storage
= { 1 },
184 .errstr
= "invalid access to map value, value_size=64 off=-2 size=4",
185 .prog_type
= BPF_PROG_TYPE_CGROUP_SKB
,
186 .flags
= F_NEEDS_EFFICIENT_UNALIGNED_ACCESS
,
189 "invalid per-cpu cgroup storage access 5",
191 BPF_MOV64_IMM(BPF_REG_2
, 7),
192 BPF_LD_MAP_FD(BPF_REG_1
, 0),
193 BPF_RAW_INSN(BPF_JMP
| BPF_CALL
, 0, 0, 0, BPF_FUNC_get_local_storage
),
194 BPF_LDX_MEM(BPF_W
, BPF_REG_1
, BPF_REG_0
, 0),
195 BPF_MOV64_REG(BPF_REG_0
, BPF_REG_1
),
196 BPF_ALU64_IMM(BPF_AND
, BPF_REG_0
, 1),
199 .fixup_percpu_cgroup_storage
= { 1 },
201 .errstr
= "get_local_storage() doesn't support non-zero flags",
202 .prog_type
= BPF_PROG_TYPE_CGROUP_SKB
,
205 "invalid per-cpu cgroup storage access 6",
207 BPF_MOV64_REG(BPF_REG_2
, BPF_REG_1
),
208 BPF_LD_MAP_FD(BPF_REG_1
, 0),
209 BPF_RAW_INSN(BPF_JMP
| BPF_CALL
, 0, 0, 0, BPF_FUNC_get_local_storage
),
210 BPF_LDX_MEM(BPF_W
, BPF_REG_1
, BPF_REG_0
, 0),
211 BPF_MOV64_REG(BPF_REG_0
, BPF_REG_1
),
212 BPF_ALU64_IMM(BPF_AND
, BPF_REG_0
, 1),
215 .fixup_percpu_cgroup_storage
= { 1 },
217 .errstr
= "get_local_storage() doesn't support non-zero flags",
218 .errstr_unpriv
= "R2 leaks addr into helper function",
219 .prog_type
= BPF_PROG_TYPE_CGROUP_SKB
,