bpf: don't accept cgroup local storage with zero value size
Subsystems (3)
PATCH 1/1 bpf: don't accept cgroup local storage with zero value size
Explicitly forbid creating cgroup local storage maps with zero value size, as it makes no sense and might even cause a panic.
Reported-by [email protected]
Signed-off-by Roman Gushchin <[email protected]>
Cc Alexei Starovoitov <[email protected]>
Cc Daniel Borkmann <[email protected]>
--- kernel/bpf/local_storage.c | 3 +++ 1 file changed, 3 insertions(+)
kernel/bpf/local_storage.c +3 -0
@@ -261,6 +261,9 @@ static struct bpf_map *cgroup_storage_map_alloc(union bpf_attr *attr)if (attr->key_size !=sizeof (struct bpf_cgroup_storage_key ))return ERR_PTR (-EINVAL ); +if (attr->value_size ==0 ) +return ERR_PTR (-EINVAL ); +if (attr->value_size >PAGE_SIZE )return ERR_PTR (-E2BIG );
Signature · 1 line
2.17.1
Quoted 7 lines · Roman Gushchin
Explicitly forbid creating cgroup local storage maps with zero value size, as it makes no sense and might even cause a panic.
Reported-by [email protected]Signed-off-by Roman Gushchin <[email protected]>Cc Alexei Starovoitov <[email protected]>Cc Daniel Borkmann <[email protected]>
Applied to bpf, thanks Roman!