Skip to content

bpf: Fix WARNING in bpf_trampoline_multi_detach

Leon Hwang bpf linux-kselftest lkml 2 versions – Applied

Status from this message: This series was applied to bpf/bpf-next.git (master)

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 1 replyApplied 2/2
  2. v12 patches 3 repliesSuperseded

Changes in v2 from the cover letter

* 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/[email protected]/

Patches in v2 All 2 applied

#Subject and filesSizeRepliesApplied
1/2bpf: Mark tracing_multi trampolines as ftrace managedkernel/bpf/trampoline.c+1 -00 repliesApplied
2/2selftests/bpf: Test fentry link after tracing_multi linktools/testing/selftests/bpf/prog_tests/tracing_multi.c tools/testing/selftests/bpf/progs/tracing_multi_intersect_attach.c+77 -01 replyApplied

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchJiri Olsa
1/2A-b
2/2A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

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

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/[email protected]/

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