In [0], we added support for storing struct task_struct * objects as kptrs. This patch set extends this effort to also include storing struct cgroup * object as kptrs. As with tasks, there are many possible use cases for storing cgroups in maps. During tracing, for example, it could be useful to query cgroup statistics such as PSI averages, or tracking which tasks are migrating to and from the cgroup. [0]: https://lore.kernel.org/all/20221120051004.3605026-1-void@xxxxxxxxxxxxx/ David Vernet (4): bpf: Enable cgroups to be used as kptrs selftests/bpf: Add cgroup kfunc / kptr selftests bpf: Add bpf_cgroup_ancestor() kfunc selftests/bpf: Add selftests for bpf_cgroup_ancestor() kfunc kernel/bpf/helpers.c | 103 ++++++- tools/testing/selftests/bpf/DENYLIST.s390x | 1 + .../selftests/bpf/prog_tests/cgrp_kfunc.c | 175 ++++++++++++ .../selftests/bpf/progs/cgrp_kfunc_common.h | 72 +++++ .../selftests/bpf/progs/cgrp_kfunc_failure.c | 260 ++++++++++++++++++ .../selftests/bpf/progs/cgrp_kfunc_success.c | 170 ++++++++++++ 6 files changed, 778 insertions(+), 3 deletions(-) create mode 100644 tools/testing/selftests/bpf/prog_tests/cgrp_kfunc.c create mode 100644 tools/testing/selftests/bpf/progs/cgrp_kfunc_common.h create mode 100644 tools/testing/selftests/bpf/progs/cgrp_kfunc_failure.c create mode 100644 tools/testing/selftests/bpf/progs/cgrp_kfunc_success.c -- 2.38.1