bpf: Make bpf_get_current_[ancestor_]cgroup_id() available for all program types
authorTejun Heo <tj@kernel.org>
Thu, 2 Mar 2023 19:42:59 +0000 (09:42 -1000)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 3 Mar 2023 06:37:07 +0000 (22:37 -0800)
commitc501bf55c88b834adefda870c7c092ec9052a437
tree92fae07fc76e2f63bb24b759b5337b915a409f2b
parentcacad346f67ce9604dcc9db10f1f1769dabb3891
bpf: Make bpf_get_current_[ancestor_]cgroup_id() available for all program types

These helpers are safe to call from any context and there's no reason to
restrict access to them. Remove them from bpf_trace and filter lists and add
to bpf_base_func_proto() under perfmon_capable().

v2: After consulting with Andrii, relocated in bpf_base_func_proto() so that
    they require bpf_capable() but not perfomon_capable() as it doesn't read
    from or affect others on the system.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/r/ZAD8QyoszMZiTzBY@slm.duckdns.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
kernel/bpf/cgroup.c
kernel/bpf/helpers.c
kernel/trace/bpf_trace.c
net/core/filter.c