Skip to content

Improve set_attach_target() and deprecate open_opts.attach_prog_fd

Andrii Nakryiko bpf 1 version Applied

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

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest7 patches 10 repliesApplied 7/7

Patches in v1 All 7 applied

#Subject and filesSizeRepliesApplied
1/7libbpf: use pre-setup sec_def in libbpf_find_attach_btf_id()tools/lib/bpf/libbpf.c+5 -91 replyApplied
2/7selftests/bpf: stop using relaxed_core_relocs which has no effecttools/testing/selftests/bpf/prog_tests/core_reloc.c+1 -21 replyApplied
3/7libbpf: deprecated bpf_object_open_opts.relaxed_core_relocstools/lib/bpf/libbpf.h+1 -01 replyApplied
4/7libbpf: allow skipping attach_func_name in bpf_program__set_attach_target()tools/lib/bpf/libbpf.c+12 -13 repliesApplied
5/7selftests/bpf: switch fexit_bpf2bpf selftest to set_attach_target() APItools/testing/selftests/bpf/prog_tests/fexit_bpf2bpf.c+26 -172 repliesApplied
6/7libbpf: schedule open_opts.attach_prog_fd deprecation since v0.7tools/lib/bpf/libbpf.c tools/lib/bpf/libbpf.h tools/lib/bpf/libbpf_common.h+10 -01 replyApplied
7/7libbpf: constify all high-level program attach APIstools/lib/bpf/libbpf.c tools/lib/bpf/libbpf.h+52 -521 replyApplied

Reviews trailers per patch

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

PatchYonghong Song
1/7A-b
2/7A-b
3/7A-b
4/7A-b
5/7A-b
6/7A-b
7/7A-b

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

Read the v1 thread

Cover letter [PATCH bpf-next 0/7] Improve set_attach_target() and deprecate open_opts.attach_prog_fd

This patch set deprecates bpf_object_open_opts.attach_prog_fd (in libbpf 0.7+) by extending bpf_program__set_attach_target() to support some more flexible scenarios. Existing fexit_bpf2bpf selftest is updated accordingly to not use deprecated APIs.

While at it, also deprecate no-op relaxed_core_relocs option (they are always "relaxed").

Last patch also const-ifies all high-level libbpf attach APIs, as there is no reason for them to assume bpf_program/bpf_map modifications.

Patch #1 also removes one more unneeded use of find_sec_def(), relying on prog->sec_def that's set during bpf_object__open() operation, simplifying upcoming refactoring a little bit more.

All these changes are preparatory patches before SEC() handling refactoring that will come next.

Andrii Nakryiko (7):
libbpf: use pre-setup sec_def in libbpf_find_attach_btf_id() selftests/bpf: stop using relaxed_core_relocs which has no effect
libbpf: deprecated bpf_object_open_opts.relaxed_core_relocs
libbpf: allow skipping attach_func_name in
bpf_program__set_attach_target()
selftests/bpf: switch fexit_bpf2bpf selftest to set_attach_target()
API
libbpf: schedule open_opts.attach_prog_fd deprecation since v0.7
libbpf: constify all high-level program attach APIs

 tools/lib/bpf/libbpf.c                        | 98 ++++++++++---------
 tools/lib/bpf/libbpf.h                        | 39 ++++----
 tools/lib/bpf/libbpf_common.h                 |  5 +
 .../selftests/bpf/prog_tests/core_reloc.c     |  3 +-
 .../selftests/bpf/prog_tests/fexit_bpf2bpf.c  | 43 ++++----
 5 files changed, 107 insertions(+), 81 deletions(-)
Signature · 1 line
2.30.2