Skip to content

Commit 7b5dd2b

Browse files
rgushchinborkmann
authored andcommitted
bpf: don't allow create maps of cgroup local storages
As there is one-to-one relation between a bpf program and cgroup local storage map, there is no sense in creating a map of cgroup local storage maps. Forbid it explicitly to avoid possible side effects. Signed-off-by: Roman Gushchin <guro@fb.com> Cc: Alexei Starovoitov <ast@kernel.org> Cc: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Martin KaFai Lau <kafai@fb.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
1 parent 3e6a4b3 commit 7b5dd2b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

kernel/bpf/map_in_map.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ struct bpf_map *bpf_map_meta_alloc(int inner_map_ufd)
2323
* is a runtime binding. Doing static check alone
2424
* in the verifier is not enough.
2525
*/
26-
if (inner_map->map_type == BPF_MAP_TYPE_PROG_ARRAY) {
26+
if (inner_map->map_type == BPF_MAP_TYPE_PROG_ARRAY ||
27+
inner_map->map_type == BPF_MAP_TYPE_CGROUP_STORAGE) {
2728
fdput(f);
2829
return ERR_PTR(-ENOTSUPP);
2930
}

0 commit comments

Comments
 (0)