Skip to content

Add target-less tracing SEC() definitions

Andrii Nakryiko bpf 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 Latest3 patches 0 repliesApplied 3/3
  2. v13 patches 5 repliesSuperseded

Changes in v2 from the cover letter

- rebased and added Song's acks.

Patches in v2 All 3 applied

#Subject and filesSizeRepliesApplied
1/3libbpf: allow "incomplete" basic tracing SEC() definitionstools/lib/bpf/libbpf.c+51 -180 repliesApplied
2/3libbpf: support target-less SEC() definitions for BTF-backed programstools/lib/bpf/libbpf.c+32 -170 repliesApplied
3/3selftests/bpf: use target-less SEC() definitions in various teststools/testing/selftests/bpf/prog_tests/attach_probe.c tools/testing/selftests/bpf/prog_tests/kprobe_multi_test.c tools/testing/selftests/bpf/progs/kprobe_multi.c +2 more+52 -110 repliesApplied

Reviews trailers per patch

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

PatchSong Liu
1/3A-b
2/3A-b
3/3A-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 v2 bpf-next 0/3] Add target-less tracing SEC() definitions

Allow specifying "target-less" SEC() definitions for tracing BPF programs, both non-BTF-backed (kprobes, tracepoints, raw tracepoints) and BTF-backed (fentry/fexit, iter, lsm, etc).

There are various situations where attach target cannot be known at compilation time, so libbpf's insistence on specifying something leads to users having to add random test like SEC("kprobe/whatever") and then specifying correct target at runtime using APIs like bpf_program__attach_kprobe().

So this patch set improves ergonomics by allowing simple SEC() definitions that define BPF program type and nothing else. Such programs won't be auto-attachable, of course, but they also won't fail skeleton auto-attachment, just like we do this for uprobes.

v1->v2:
- rebased and added Song's acks.

Cc Delyan Kratunov <[email protected]>
Cc Jiri Olsa <[email protected]>

Andrii Nakryiko (3):
libbpf: allow "incomplete" basic tracing SEC() definitions
libbpf: support target-less SEC() definitions for BTF-backed programs selftests/bpf: use target-less SEC() definitions in various tests

 tools/lib/bpf/libbpf.c                        | 118 ++++++++++++------
 .../selftests/bpf/prog_tests/attach_probe.c   |  10 ++
 .../bpf/prog_tests/kprobe_multi_test.c        |  14 +--
 .../selftests/bpf/progs/kprobe_multi.c        |  14 +++
 .../selftests/bpf/progs/test_attach_probe.c   |  23 +++-
 .../selftests/bpf/progs/test_module_attach.c  |   2 +-
 6 files changed, 135 insertions(+), 46 deletions(-)
Signature · 1 line
2.30.2