On Wed, Dec 31, 2025 at 8:33 AM Sun Jian sun.jian.kdev@gmail.com wrote:
Clang BPF compilation fails in bpf_iter_tasks.c due to an implicit declaration of bpf_copy_from_user_task_str(), which is a BPF kfunc exported by the kernel.
nope. It's there in vmlinux.h Fix your build setup instead.
pw-bot: cr
Add an explicit prototype in the test program to make the kfunc visible to the BPF compiler and fix the build error.
No functional change intended.
Signed-off-by: Sun Jian sun.jian.kdev@gmail.com
tools/testing/selftests/bpf/progs/bpf_iter_tasks.c | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/tools/testing/selftests/bpf/progs/bpf_iter_tasks.c b/tools/testing/selftests/bpf/progs/bpf_iter_tasks.c index 966ee5a7b066..f5f396b5aa27 100644 --- a/tools/testing/selftests/bpf/progs/bpf_iter_tasks.c +++ b/tools/testing/selftests/bpf/progs/bpf_iter_tasks.c @@ -4,6 +4,11 @@ #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h>
+extern int bpf_copy_from_user_task_str(void *dst, u32 dst__sz,
const void *unsafe_ptr,struct task_struct *task,u64 flags);char _license[] SEC("license") = "GPL";
uint32_t tid = 0;
2.43.0