Skip to content

bpf: Add log support for tracing link_create

Leon Hwang bpf linux-kselftest linux-trace-kernel lkml netdev 4 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. v4 Latest6 patches 1 replyApplied 6/6
  2. v39 patches 6 repliesSuperseded
  3. v29 patches 5 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v19 patches6 repliesSuperseded

Changes in v4 from the cover letter

* Collect Acked-by tag from Jiri, thanks.
* Change 'tgt_fd' to 'target_fd' in patch 1. (Sashiko)
* Trim tests to 4 tests for tracing, tracing_multi, iter and cgroup links. (Alexei)
* v3: https://lore.kernel.org/bpf/[email protected]/

Patches in v4 All 6 applied

#Subject and filesSizeRepliesApplied
1/6bpf: Add log support for tracing link_createkernel/bpf/syscall.c kernel/bpf/verifier.c+21 -70 repliesApplied
2/6bpf: Add log support for tracing_multi link_createinclude/linux/bpf.h include/linux/bpf_verifier.h include/linux/trace_events.h +4 more+70 -251 replyApplied
3/6bpf: Add log support for iter link_createinclude/linux/bpf.h kernel/bpf/bpf_iter.c kernel/bpf/syscall.c+24 -80 repliesApplied
4/6bpf: Add log support for cgroup prog link_createinclude/linux/bpf-cgroup.h kernel/bpf/cgroup.c kernel/bpf/syscall.c+60 -260 repliesApplied
5/6libbpf: Add log_opts support for BPF_TRACE_ITERtools/lib/bpf/bpf.c tools/lib/bpf/bpf.h tools/lib/bpf/libbpf.c +1 more+30 -90 repliesApplied
6/6selftests/bpf: Test tracing and cgroup link creation logstools/testing/selftests/bpf/prog_tests/link_log.c+85 -00 repliesApplied

Reviews trailers per patch

2 of 6 patches have a Reviewed-by or Acked-by.

PatchJiri OlsaSteven Rostedt
1/6A-b
2/6A-b
3/6
4/6
5/6
6/6

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

Read the v4 thread

Cover letter [PATCH bpf-next v4 0/6] bpf: Add log support for tracing link_create

I'm planning to add syscall common attrs support for LINK_CREATE cmd.

This is the second series for the plan, that adds syscall common attrs support for LINK_CREATE of tracing prog and cgroup prog.

BTW, address Andrii's review [1] in patch 5:
1. Change if (!OPTS_ZEROED(opts, iter_info_len)) to if (!OPTS_ZEROED(opts, log_opts)).
2. Add comment to iter_info and iter_info_len that they are deprecated, and use iter.info and iter.len instead.

Links:
[1] https://lore.kernel.org/bpf/CAEf4BzbW4zwL-9j8e2B6KNXVNwsfWyMSAo_RsGCqv-nu_yGhTg@mail.gmail.com/

Changes:
v3 -> v4:
* Collect Acked-by tag from Jiri, thanks.
* Change 'tgt_fd' to 'target_fd' in patch 1. (Sashiko)
* Trim tests to 4 tests for tracing, tracing_multi, iter and cgroup links. (Alexei)
* v3: https://lore.kernel.org/bpf/[email protected]/

v2 -> v3:
* Add log support for bpf_check_attach_btf_id_multi().
* Add more selftests to cover more logs for link creation failures.
* Update some log messages in patch 1. (Alexei)
* Add log for dst attach type check in bpf_check_attach_target(). (Alexei)
* Update some log messages in patch 2. (Alexei)
* Pass 'log' to btf_attach_func_proto() and btf_distill_func_proto() in bpf_check_attach_btf_id_multi(). (Alexei)
* Add a log msg in check_dup_ids() when dup ids. (Alexei)
* Add a log msg in bpf_tracing_multi_attach() when it returns -EOPNOTSUPP. (Alexei)
* Swap function names between iter_info and iter_info_len selftests. (Sashiko)
* v2: https://lore.kernel.org/bpf/[email protected]/

v1 -> v2:
* Add log_opts support for bpf_program__attach_iter() API in libbpf.
* Add test to verify the log for freplace max_ctx_offset case.
* Update a subtest to verify the log_opts in bpf_program__attach_iter() API.
* Add log for freplace max_ctx_offset case. (bot+bpf-ci)
* Drop unnecessary bpf_verifier.h include. (bot+bpf-ci)
* Change log to "Invalid tracing attach_type.\n" when the link attach_type is not prog->expected_attach_type. (bot+bpf-ci)
* Change BPF_XDP to BPF_TRACE_FEXIT in tracing link_create test. (bot+bpf-ci)
* Drop dead iter.len check in libbpf. (bot+bpf-ci, Sashiko)
* Add OPTS_ZEROED(opts, iter) check. (bot+bpf-ci, Sashiko)
* Swap log positions of iter_info and iter_info_len. (Sashiko)
* Update bpf_program__attach_iter() to use iter.info and iter.len. (Sashiko)
* v1: https://lore.kernel.org/bpf/[email protected]/

Leon Hwang (6):
bpf: Add log support for tracing link_create
bpf: Add log support for tracing_multi link_create
bpf: Add log support for iter link_create
bpf: Add log support for cgroup prog link_create
libbpf: Add log_opts support for BPF_TRACE_ITER selftests/bpf: Test tracing and cgroup link creation logs

 include/linux/bpf-cgroup.h                    |  6 +-
 include/linux/bpf.h                           |  9 +-
 include/linux/bpf_verifier.h                  |  3 +-
 include/linux/trace_events.h                  |  7 +-
 kernel/bpf/bpf_iter.c                         | 27 ++++--
 kernel/bpf/cgroup.c                           | 76 ++++++++++++-----
 kernel/bpf/syscall.c                          | 30 +++++--
 kernel/bpf/trampoline.c                       |  5 +-
 kernel/bpf/verifier.c                         | 51 ++++++++---
 kernel/trace/bpf_trace.c                      | 27 ++++--
 tools/lib/bpf/bpf.c                           | 23 +++--
 tools/lib/bpf/bpf.h                           |  8 ++
 tools/lib/bpf/libbpf.c                        |  5 +-
 tools/lib/bpf/libbpf.h                        |  3 +-
 .../selftests/bpf/prog_tests/link_log.c       | 85 +++++++++++++++++++
 15 files changed, 290 insertions(+), 75 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/prog_tests/link_log.c
Signature · 1 line
2.55.0