* [PATCH bpf] bpf: handle the return of ftrace_set_filter_ip in register_fentry
@ 2025-11-10 12:07 Menglong Dong
2025-11-10 15:49 ` Song Liu
2025-11-14 21:40 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 5+ messages in thread
From: Menglong Dong @ 2025-11-10 12:07 UTC (permalink / raw)
To: ast, song
Cc: daniel, john.fastabend, andrii, martin.lau, eddyz87,
yonghong.song, kpsingh, sdf, haoluo, jolsa, jiang.biao, bpf,
linux-kernel
The error that returned by ftrace_set_filter_ip() in register_fentry() is
not handled properly. Just fix it.
Fixes: 00963a2e75a8 ("bpf: Support bpf_trampoline on functions with IPMODIFY (e.g. livepatch)")
Signed-off-by: Menglong Dong <dongml2@chinatelecom.cn>
---
kernel/bpf/trampoline.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/kernel/bpf/trampoline.c b/kernel/bpf/trampoline.c
index 5949095e51c3..3610c6db15ee 100644
--- a/kernel/bpf/trampoline.c
+++ b/kernel/bpf/trampoline.c
@@ -220,7 +220,9 @@ static int register_fentry(struct bpf_trampoline *tr, void *new_addr)
}
if (tr->func.ftrace_managed) {
- ftrace_set_filter_ip(tr->fops, (unsigned long)ip, 0, 1);
+ ret = ftrace_set_filter_ip(tr->fops, (unsigned long)ip, 0, 1);
+ if (ret)
+ return ret;
ret = register_ftrace_direct(tr->fops, (long)new_addr);
} else {
ret = bpf_arch_text_poke(ip, BPF_MOD_CALL, NULL, new_addr);
--
2.51.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH bpf] bpf: handle the return of ftrace_set_filter_ip in register_fentry
2025-11-10 12:07 [PATCH bpf] bpf: handle the return of ftrace_set_filter_ip in register_fentry Menglong Dong
@ 2025-11-10 15:49 ` Song Liu
2025-11-11 0:59 ` Menglong Dong
2025-11-14 21:40 ` patchwork-bot+netdevbpf
1 sibling, 1 reply; 5+ messages in thread
From: Song Liu @ 2025-11-10 15:49 UTC (permalink / raw)
To: Menglong Dong
Cc: ast, song, daniel, john.fastabend, andrii, martin.lau, eddyz87,
yonghong.song, kpsingh, sdf, haoluo, jolsa, jiang.biao, bpf,
linux-kernel
On Mon, Nov 10, 2025 at 4:07 AM Menglong Dong <menglong8.dong@gmail.com> wrote:
>
> The error that returned by ftrace_set_filter_ip() in register_fentry() is
> not handled properly. Just fix it.
>
> Fixes: 00963a2e75a8 ("bpf: Support bpf_trampoline on functions with IPMODIFY (e.g. livepatch)")
> Signed-off-by: Menglong Dong <dongml2@chinatelecom.cn>
> ---
> kernel/bpf/trampoline.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
LGTM. Thanks for the fix!
Acked-by: Song Liu <song@kernel.org>
Can we add a test for this code path?
Song
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH bpf] bpf: handle the return of ftrace_set_filter_ip in register_fentry
2025-11-10 15:49 ` Song Liu
@ 2025-11-11 0:59 ` Menglong Dong
2025-11-11 3:17 ` Menglong Dong
0 siblings, 1 reply; 5+ messages in thread
From: Menglong Dong @ 2025-11-11 0:59 UTC (permalink / raw)
To: Menglong Dong, Song Liu
Cc: ast, song, daniel, john.fastabend, andrii, martin.lau, eddyz87,
yonghong.song, kpsingh, sdf, haoluo, jolsa, jiang.biao, bpf,
linux-kernel
On 2025/11/10 23:49, Song Liu wrote:
> On Mon, Nov 10, 2025 at 4:07 AM Menglong Dong <menglong8.dong@gmail.com> wrote:
> >
> > The error that returned by ftrace_set_filter_ip() in register_fentry() is
> > not handled properly. Just fix it.
> >
> > Fixes: 00963a2e75a8 ("bpf: Support bpf_trampoline on functions with IPMODIFY (e.g. livepatch)")
> > Signed-off-by: Menglong Dong <dongml2@chinatelecom.cn>
> > ---
> > kernel/bpf/trampoline.c | 4 +++-
> > 1 file changed, 3 insertions(+), 1 deletion(-)
>
> LGTM. Thanks for the fix!
>
> Acked-by: Song Liu <song@kernel.org>
>
> Can we add a test for this code path?
I think it can be done by attach a fentry to a notrace function and
check the error number.
Let me have a try.
>
> Song
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH bpf] bpf: handle the return of ftrace_set_filter_ip in register_fentry
2025-11-11 0:59 ` Menglong Dong
@ 2025-11-11 3:17 ` Menglong Dong
0 siblings, 0 replies; 5+ messages in thread
From: Menglong Dong @ 2025-11-11 3:17 UTC (permalink / raw)
To: Menglong Dong, Song Liu
Cc: ast, song, daniel, john.fastabend, andrii, martin.lau, eddyz87,
yonghong.song, kpsingh, sdf, haoluo, jolsa, jiang.biao, bpf,
linux-kernel
On 2025/11/11 08:59, Menglong Dong wrote:
> On 2025/11/10 23:49, Song Liu wrote:
> > On Mon, Nov 10, 2025 at 4:07 AM Menglong Dong <menglong8.dong@gmail.com> wrote:
> > >
> > > The error that returned by ftrace_set_filter_ip() in register_fentry() is
> > > not handled properly. Just fix it.
> > >
> > > Fixes: 00963a2e75a8 ("bpf: Support bpf_trampoline on functions with IPMODIFY (e.g. livepatch)")
> > > Signed-off-by: Menglong Dong <dongml2@chinatelecom.cn>
> > > ---
> > > kernel/bpf/trampoline.c | 4 +++-
> > > 1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > LGTM. Thanks for the fix!
> >
> > Acked-by: Song Liu <song@kernel.org>
> >
> > Can we add a test for this code path?
>
> I think it can be done by attach a fentry to a notrace function and
> check the error number.
Hmm...it's a little difficult to trigger this problem, as attaching a
notrace function won't go to this code patch ;|
>
> Let me have a try.
>
> >
> > Song
> >
> >
>
>
>
>
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH bpf] bpf: handle the return of ftrace_set_filter_ip in register_fentry
2025-11-10 12:07 [PATCH bpf] bpf: handle the return of ftrace_set_filter_ip in register_fentry Menglong Dong
2025-11-10 15:49 ` Song Liu
@ 2025-11-14 21:40 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-11-14 21:40 UTC (permalink / raw)
To: Menglong Dong
Cc: ast, song, daniel, john.fastabend, andrii, martin.lau, eddyz87,
yonghong.song, kpsingh, sdf, haoluo, jolsa, jiang.biao, bpf,
linux-kernel
Hello:
This patch was applied to bpf/bpf-next.git (master)
by Alexei Starovoitov <ast@kernel.org>:
On Mon, 10 Nov 2025 20:07:05 +0800 you wrote:
> The error that returned by ftrace_set_filter_ip() in register_fentry() is
> not handled properly. Just fix it.
>
> Fixes: 00963a2e75a8 ("bpf: Support bpf_trampoline on functions with IPMODIFY (e.g. livepatch)")
> Signed-off-by: Menglong Dong <dongml2@chinatelecom.cn>
> ---
> kernel/bpf/trampoline.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
Here is the summary with links:
- [bpf] bpf: handle the return of ftrace_set_filter_ip in register_fentry
https://git.kernel.org/bpf/bpf-next/c/fea3f5e83c5c
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-11-14 21:40 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-10 12:07 [PATCH bpf] bpf: handle the return of ftrace_set_filter_ip in register_fentry Menglong Dong
2025-11-10 15:49 ` Song Liu
2025-11-11 0:59 ` Menglong Dong
2025-11-11 3:17 ` Menglong Dong
2025-11-14 21:40 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox