* [PATCH] bpf: selftests: fix missing declaration for bpf_copy_from_user_task_str
@ 2025-12-31 16:33 Sun Jian
2025-12-31 16:46 ` Alexei Starovoitov
0 siblings, 1 reply; 2+ messages in thread
From: Sun Jian @ 2025-12-31 16:33 UTC (permalink / raw)
To: Alexei Starovoitov, Daniel Borkmann; +Cc: bpf, linux-kselftest, Sun Jian
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.
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
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] bpf: selftests: fix missing declaration for bpf_copy_from_user_task_str
2025-12-31 16:33 [PATCH] bpf: selftests: fix missing declaration for bpf_copy_from_user_task_str Sun Jian
@ 2025-12-31 16:46 ` Alexei Starovoitov
0 siblings, 0 replies; 2+ messages in thread
From: Alexei Starovoitov @ 2025-12-31 16:46 UTC (permalink / raw)
To: Sun Jian
Cc: Alexei Starovoitov, Daniel Borkmann, bpf,
open list:KERNEL SELFTEST FRAMEWORK
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
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-12-31 16:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-31 16:33 [PATCH] bpf: selftests: fix missing declaration for bpf_copy_from_user_task_str Sun Jian
2025-12-31 16:46 ` Alexei Starovoitov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox