summaryrefslogtreecommitdiff
path: root/kernel/bpf/verifier.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2023-03-14 11:59:49 -1000
committerAlexei Starovoitov <ast@kernel.org>2023-03-14 16:56:20 -0700
commitb8a2e3f93d412114a1539ea97b59b3e6ed6e1f9a (patch)
treec4255c9e3f13cbc6914cabe13e8f2296a2eb0f87 /kernel/bpf/verifier.c
parent3c2611bac08a834697be918ac357eaff2e47d5b3 (diff)
downloadlinux-b8a2e3f93d412114a1539ea97b59b3e6ed6e1f9a.tar.gz
linux-b8a2e3f93d412114a1539ea97b59b3e6ed6e1f9a.tar.bz2
linux-b8a2e3f93d412114a1539ea97b59b3e6ed6e1f9a.zip
cgroup: Make current_cgns_cgroup_dfl() safe to call after exit_task_namespace()
The commit 332ea1f697be ("bpf: Add bpf_cgroup_from_id() kfunc") added bpf_cgroup_from_id() which calls current_cgns_cgroup_dfl() through cgroup_get_from_id(). However, BPF programs may be attached to a point where current->nsproxy has already been cleared to NULL by exit_task_namespace() and calling bpf_cgroup_from_id() would cause an oops. Just return the system-wide root if nsproxy has been cleared. This allows all cgroups to be looked up after the task passed through exit_task_namespace(), which semantically makes sense. Given that the only way to get this behavior is through BPF programs, it seems safe but let's see what others think. Fixes: 332ea1f697be ("bpf: Add bpf_cgroup_from_id() kfunc") Signed-off-by: Tejun Heo <tj@kernel.org> Link: https://lore.kernel.org/r/ZBDuVWiFj2jiz3i8@slm.duckdns.org Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'kernel/bpf/verifier.c')
0 files changed, 0 insertions, 0 deletions