[PATCH bpf-next v2 0/2] bpf: Fix WARNING in bpf_trampoline_multi_detach

From: Leon Hwang

Date: Sat Jul 11 2026 - 08:49:50 EST


Since tracing_multi link does not set ftrace_managed, it would fail to
release the tracing_multi link when attaching tracing_multi link and
then attaching fentry link.

[ 3.714215] WARNING: kernel/bpf/trampoline.c:1727 at bpf_trampoline_multi_detach+0x20b/0x240, CPU#1: test_progs/97
...
[ 3.733170] bpf_tracing_multi_link_release+0x14/0x30
[ 3.733890] bpf_link_free+0x58/0x130
[ 3.734414] bpf_link_release+0x23/0x30

Fix it by setting 'ftrace_managed = true' in register_fentry_multi().

Note: the reason of targeting bpf-next tree is I'm planning to add
tracing_multi link support for bpf progs, that would rely on the fix and
have code conflict with the test.

Changes:
v1 -> v2:
* Collect Acked-by from Jiri, thanks.
* Check arg using tracing_multi_arg_check() in bpf prog in test.
(per Sashiko)
* v1: https://lore.kernel.org/bpf/20260710144734.78203-1-leon.hwang@xxxxxxxxx/

Leon Hwang (2):
bpf: Mark tracing_multi trampolines as ftrace managed
selftests/bpf: Test fentry link after tracing_multi link

kernel/bpf/trampoline.c | 1 +
.../selftests/bpf/prog_tests/tracing_multi.c | 69 +++++++++++++++++++
.../progs/tracing_multi_intersect_attach.c | 8 +++
3 files changed, 78 insertions(+)

--
2.55.0