Skip to content

Conversation

kernel-patches-daemon-bpf[bot]
Copy link

Pull request for series with
subject: Remove use of current->cgns in bpf_cgroup_from_id
version: 2
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=990210

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: fa47913
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=990210
version: 2

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 9e293d4
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=990210
version: 2

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 3e2b799
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=990210
version: 2

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: c93c59b
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=990210
version: 2

The bpf_cgroup_from_id kfunc relies on cgroup_get_from_id to obtain the
cgroup corresponding to a given cgroup ID. This helper can be called in
a lot of contexts where the current thread can be random. A recent
example was its use in sched_ext's ops.tick(), to obtain the root cgroup
pointer. Since the current task can be whatever random user space task
preempted by the timer tick, this makes the behavior of the helper
unreliable.

Resolve this by refactoring cgroup_get_from_id to take a parameter to
elide the cgroup_is_descendant check when root_cgns parameter is set to
true.

There is no compatibility breakage here, since changing the namespace
against which the lookup is being done to the root cgroup namespace only
permits a wider set of lookups to succeed now. The cgroup IDs across
namespaces are globally unique, and thus don't need to be retranslated.

Reported-by: Dan Schatzberg <[email protected]>
Acked-by: Tejun Heo <[email protected]>
Signed-off-by: Kumar Kartikeya Dwivedi <[email protected]>
@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: bf0c2a8
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=990210
version: 2

Make sure that we only switch the cgroup namespace and enter a new
cgroup in a child process separate from test_progs, to not mess up the
environment for subsequent tests.

Signed-off-by: Kumar Kartikeya Dwivedi <[email protected]>
@kernel-patches-daemon-bpf
Copy link
Author

At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=990210 expired. Closing PR.

@kernel-patches-daemon-bpf kernel-patches-daemon-bpf bot deleted the series/990210=>bpf-next branch August 16, 2025 00:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant