]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
selftests: bpf: fix cgroup_hierarchical_stats
authorPuranjay Mohan <puranjay@kernel.org>
Fri, 2 Jan 2026 18:00:35 +0000 (10:00 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 2 Jan 2026 20:04:29 +0000 (12:04 -0800)
The cgroup_hierarchical_stats selftests uses an fentry program attached
to cgroup_attach_task and then passes the received &dst_cgrp->self to
the css_rstat_updated() kfunc. The verifier now assumes that all kfuncs
only takes trusted pointer arguments, and pointers received by fentry
are not marked trustes by default.

Use a tp_btf program in place for fentry for this test, pointers
received by tp_btf programs are marked trusted by the verifier.

Acked-by: Eduard Zingerman <eddyz87@gmail.com>
Reviewed-by: Emil Tsalapatis <emil@etsalapatis.com>
Signed-off-by: Puranjay Mohan <puranjay@kernel.org>
Link: https://lore.kernel.org/r/20260102180038.2708325-10-puranjay@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/progs/cgroup_hierarchical_stats.c

index ff189a736ad8c563dcb595e9a98c80ed86c3317e..8fc38592a87be19234295f898c6569bc9ec316c7 100644 (file)
@@ -62,9 +62,9 @@ static int create_attach_counter(__u64 cg_id, __u64 state, __u64 pending)
                                   &init, BPF_NOEXIST);
 }
 
-SEC("fentry/cgroup_attach_task")
-int BPF_PROG(counter, struct cgroup *dst_cgrp, struct task_struct *leader,
-            bool threadgroup)
+SEC("tp_btf/cgroup_attach_task")
+int BPF_PROG(counter, struct cgroup *dst_cgrp, const char *path,
+            struct task_struct *task, bool threadgroup)
 {
        __u64 cg_id = cgroup_id(dst_cgrp);
        struct percpu_attach_counter *pcpu_counter = bpf_map_lookup_elem(