* [PATCH bpf-next v2 0/2] Allow calling kfuncs from raw_tp programs
@ 2025-12-22 13:32 Puranjay Mohan
2025-12-22 13:32 ` [PATCH bpf-next v2 1/2] bpf: allow " Puranjay Mohan
2025-12-22 13:32 ` [PATCH bpf-next v2 2/2] selftests: bpf: fix tests with raw_tp calling kfuncs Puranjay Mohan
0 siblings, 2 replies; 5+ messages in thread
From: Puranjay Mohan @ 2025-12-22 13:32 UTC (permalink / raw)
To: bpf
Cc: Puranjay Mohan, Puranjay Mohan, Alexei Starovoitov,
Andrii Nakryiko, Daniel Borkmann, Martin KaFai Lau,
Eduard Zingerman, Kumar Kartikeya Dwivedi, kernel-team
V1: https://lore.kernel.org/all/20251218145514.339819-1-puranjay@kernel.org/
Changes in V1->V2:
- Update selftests to allow success for raw_tp programs calling kfuncs.
This set enables calling kfuncs from raw_tp programs.
Puranjay Mohan (2):
bpf: allow calling kfuncs from raw_tp programs
selftests: bpf: fix tests with raw_tp calling kfuncs
kernel/bpf/btf.c | 1 +
tools/testing/selftests/bpf/progs/dynptr_fail.c | 2 +-
.../testing/selftests/bpf/progs/verifier_kfunc_prog_types.c | 6 +++---
3 files changed, 5 insertions(+), 4 deletions(-)
base-commit: f785a31395d9cafb8b2c42c7358fad72a6463142
--
2.47.3
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH bpf-next v2 1/2] bpf: allow calling kfuncs from raw_tp programs
2025-12-22 13:32 [PATCH bpf-next v2 0/2] Allow calling kfuncs from raw_tp programs Puranjay Mohan
@ 2025-12-22 13:32 ` Puranjay Mohan
2025-12-22 18:28 ` Yonghong Song
2025-12-22 13:32 ` [PATCH bpf-next v2 2/2] selftests: bpf: fix tests with raw_tp calling kfuncs Puranjay Mohan
1 sibling, 1 reply; 5+ messages in thread
From: Puranjay Mohan @ 2025-12-22 13:32 UTC (permalink / raw)
To: bpf
Cc: Puranjay Mohan, Puranjay Mohan, Alexei Starovoitov,
Andrii Nakryiko, Daniel Borkmann, Martin KaFai Lau,
Eduard Zingerman, Kumar Kartikeya Dwivedi, kernel-team
Associate raw tracepoint program type with the kfunc tracing hook. This
allows calling kfuncs from raw_tp programs.
Signed-off-by: Puranjay Mohan <puranjay@kernel.org>
---
kernel/bpf/btf.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c
index 0de8fc8a0e0b..539c9fdea41d 100644
--- a/kernel/bpf/btf.c
+++ b/kernel/bpf/btf.c
@@ -8681,6 +8681,7 @@ static int bpf_prog_type_to_kfunc_hook(enum bpf_prog_type prog_type)
return BTF_KFUNC_HOOK_STRUCT_OPS;
case BPF_PROG_TYPE_TRACING:
case BPF_PROG_TYPE_TRACEPOINT:
+ case BPF_PROG_TYPE_RAW_TRACEPOINT:
case BPF_PROG_TYPE_PERF_EVENT:
case BPF_PROG_TYPE_LSM:
return BTF_KFUNC_HOOK_TRACING;
--
2.47.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH bpf-next v2 1/2] bpf: allow calling kfuncs from raw_tp programs
2025-12-22 13:32 ` [PATCH bpf-next v2 1/2] bpf: allow " Puranjay Mohan
@ 2025-12-22 18:28 ` Yonghong Song
0 siblings, 0 replies; 5+ messages in thread
From: Yonghong Song @ 2025-12-22 18:28 UTC (permalink / raw)
To: Puranjay Mohan, bpf
Cc: Puranjay Mohan, Alexei Starovoitov, Andrii Nakryiko,
Daniel Borkmann, Martin KaFai Lau, Eduard Zingerman,
Kumar Kartikeya Dwivedi, kernel-team
On 12/22/25 5:32 AM, Puranjay Mohan wrote:
> Associate raw tracepoint program type with the kfunc tracing hook. This
> allows calling kfuncs from raw_tp programs.
>
> Signed-off-by: Puranjay Mohan <puranjay@kernel.org>
Acked-by: Yonghong Song <yonghong.song@linux.dev>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH bpf-next v2 2/2] selftests: bpf: fix tests with raw_tp calling kfuncs
2025-12-22 13:32 [PATCH bpf-next v2 0/2] Allow calling kfuncs from raw_tp programs Puranjay Mohan
2025-12-22 13:32 ` [PATCH bpf-next v2 1/2] bpf: allow " Puranjay Mohan
@ 2025-12-22 13:32 ` Puranjay Mohan
2025-12-22 18:35 ` Yonghong Song
1 sibling, 1 reply; 5+ messages in thread
From: Puranjay Mohan @ 2025-12-22 13:32 UTC (permalink / raw)
To: bpf
Cc: Puranjay Mohan, Puranjay Mohan, Alexei Starovoitov,
Andrii Nakryiko, Daniel Borkmann, Martin KaFai Lau,
Eduard Zingerman, Kumar Kartikeya Dwivedi, kernel-team
As the previous commit allowed raw_tp programs to call kfuncs, so of the
selftests that were expected to fail will now succeed.
Signed-off-by: Puranjay Mohan <puranjay@kernel.org>
---
tools/testing/selftests/bpf/progs/dynptr_fail.c | 2 +-
.../testing/selftests/bpf/progs/verifier_kfunc_prog_types.c | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/tools/testing/selftests/bpf/progs/dynptr_fail.c b/tools/testing/selftests/bpf/progs/dynptr_fail.c
index dda6a8dada82..8f2ae9640886 100644
--- a/tools/testing/selftests/bpf/progs/dynptr_fail.c
+++ b/tools/testing/selftests/bpf/progs/dynptr_fail.c
@@ -1465,7 +1465,7 @@ int xdp_invalid_data_slice2(struct xdp_md *xdp)
}
/* Only supported prog type can create skb-type dynptrs */
-SEC("?raw_tp")
+SEC("?xdp")
__failure __msg("calling kernel function bpf_dynptr_from_skb is not allowed")
int skb_invalid_ctx(void *ctx)
{
diff --git a/tools/testing/selftests/bpf/progs/verifier_kfunc_prog_types.c b/tools/testing/selftests/bpf/progs/verifier_kfunc_prog_types.c
index a509cad97e69..1fce7a7e8d03 100644
--- a/tools/testing/selftests/bpf/progs/verifier_kfunc_prog_types.c
+++ b/tools/testing/selftests/bpf/progs/verifier_kfunc_prog_types.c
@@ -32,7 +32,7 @@ static void task_kfunc_load_test(void)
}
SEC("raw_tp")
-__failure __msg("calling kernel function")
+__success
int BPF_PROG(task_kfunc_raw_tp)
{
task_kfunc_load_test();
@@ -86,7 +86,7 @@ static void cgrp_kfunc_load_test(void)
}
SEC("raw_tp")
-__failure __msg("calling kernel function")
+__success
int BPF_PROG(cgrp_kfunc_raw_tp)
{
cgrp_kfunc_load_test();
@@ -138,7 +138,7 @@ static void cpumask_kfunc_load_test(void)
}
SEC("raw_tp")
-__failure __msg("calling kernel function")
+__success
int BPF_PROG(cpumask_kfunc_raw_tp)
{
cpumask_kfunc_load_test();
--
2.47.3
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH bpf-next v2 2/2] selftests: bpf: fix tests with raw_tp calling kfuncs
2025-12-22 13:32 ` [PATCH bpf-next v2 2/2] selftests: bpf: fix tests with raw_tp calling kfuncs Puranjay Mohan
@ 2025-12-22 18:35 ` Yonghong Song
0 siblings, 0 replies; 5+ messages in thread
From: Yonghong Song @ 2025-12-22 18:35 UTC (permalink / raw)
To: Puranjay Mohan, bpf
Cc: Puranjay Mohan, Alexei Starovoitov, Andrii Nakryiko,
Daniel Borkmann, Martin KaFai Lau, Eduard Zingerman,
Kumar Kartikeya Dwivedi, kernel-team
On 12/22/25 5:32 AM, Puranjay Mohan wrote:
> As the previous commit allowed raw_tp programs to call kfuncs, so of the
> selftests that were expected to fail will now succeed.
>
> Signed-off-by: Puranjay Mohan <puranjay@kernel.org>
Acked-by: Yonghong Song <yonghong.song@linux.dev>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-12-22 18:35 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-22 13:32 [PATCH bpf-next v2 0/2] Allow calling kfuncs from raw_tp programs Puranjay Mohan
2025-12-22 13:32 ` [PATCH bpf-next v2 1/2] bpf: allow " Puranjay Mohan
2025-12-22 18:28 ` Yonghong Song
2025-12-22 13:32 ` [PATCH bpf-next v2 2/2] selftests: bpf: fix tests with raw_tp calling kfuncs Puranjay Mohan
2025-12-22 18:35 ` Yonghong Song
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox