Hi David, hi Jakub, hi Paolo, hi Eric, The following pull-request contains BPF updates for your *net-next* tree. We've added 54 non-merge commits during the last 10 day(s) which contain a total of 50 files changed, 1887 insertions(+), 527 deletions(-). The main changes are: 1) Add a user space notification mechanism via epoll when a struct_ops object is getting detached/unregistered, from Kui-Feng Lee. 2) Big batch of BPF selftest refactoring for sockmap and BPF congctl tests, from Geliang Tang. 3) Add BTF field (type and string fields, right now) iterator support to libbpf instead of using existing callback-based approaches, from Andrii Nakryiko. 4) Extend BPF selftests for the latter with a new btf_field_iter selftest, from Alan Maguire. 5) Add new kfuncs for a generic, open-coded bits iterator, from Yafang Shao. 6) Fix BPF selftests' kallsyms_find() helper under kernels configured with CONFIG_LTO_CLANG_THIN, from Yonghong Song. 7) Remove a bunch of unused structs in BPF selftests, from David Alan Gilbert. 8) Convert test_sockmap section names into names understood by libbpf so it can deduce program type and attach type, from Jakub Sitnicki. 9) Extend libbpf with the ability to configure log verbosity via LIBBPF_LOG_LEVEL environment variable, from Mykyta Yatsenko. 10) Fix BPF selftests with regards to bpf_cookie and find_vma flakiness in nested VMs, from Song Liu. 11) Extend riscv32/64 JITs to introduce shift/add helpers to generate Zba optimization, from Xiao Wang. 12) Enable BPF programs to declare arrays and struct fields with kptr, bpf_rb_root, and bpf_list_head, from Kui-Feng Lee. Please consider pulling these changes from: git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git tags/for-netdev Thanks a lot! Also thanks to reporters, reviewers and testers of commits in this pull-request: Alan Maguire, Alexei Starovoitov, Björn Töpel, Eduard Zingerman, Jakub Sitnicki, Jiri Olsa, John Fastabend, Lennart Poettering, Quentin Monnet ---------------------------------------------------------------- The following changes since commit 4b3529edbb8ff069d762c6947e055e10c1748170: Merge tag 'for-netdev' of https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next (2024-05-28 07:27:29 -0700) are available in the Git repository at: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git tags/for-netdev for you to fetch changes up to f85af9d955ac9601174e1c64f4b3308c1cae4a7e: selftests/bpf: Drop useless arguments of do_test in bpf_tcp_ca (2024-06-06 23:04:06 +0200) ---------------------------------------------------------------- bpf-next-for-netdev ---------------------------------------------------------------- Alan Maguire (1): selftests/bpf: Add btf_field_iter selftests Alexei Starovoitov (1): Merge branch 'enable-bpf-programs-to-declare-arrays-of-kptr-bpf_rb_root-and-bpf_list_head' Andrii Nakryiko (7): Merge branch 'bpf-add-a-generic-bits-iterator' libbpf: keep FD_CLOEXEC flag when dup()'ing FD libbpf: Add BTF field iterator libbpf: Make use of BTF field iterator in BPF linker code libbpf: Make use of BTF field iterator in BTF handling code bpftool: Use BTF field iterator in btfgen libbpf: Remove callback-based type/string BTF field visitor helpers Dr. David Alan Gilbert (3): selftests/bpf: Remove unused struct 'scale_test_def' selftests/bpf: Remove unused 'key_t' structs selftests/bpf: Remove unused struct 'libcap' Geliang Tang (18): selftests/bpf: Drop struct post_socket_opts selftests/bpf: Add start_server_str helper selftests/bpf: Use post_socket_cb in connect_to_fd_opts selftests/bpf: Use post_socket_cb in start_server_str selftests/bpf: Use start_server_str in do_test in bpf_tcp_ca selftests/bpf: Fix tx_prog_fd values in test_sockmap selftests/bpf: Drop duplicate definition of i in test_sockmap selftests/bpf: Use bpf_link attachments in test_sockmap selftests/bpf: Replace tx_prog_fd with tx_prog in test_sockmap selftests/bpf: Drop prog_fd array in test_sockmap selftests/bpf: Fix size of map_fd in test_sockmap selftests/bpf: Check length of recv in test_sockmap selftests/bpf: Drop duplicate bpf_map_lookup_elem in test_sockmap selftests/bpf: Use connect_to_fd_opts in do_test in bpf_tcp_ca selftests/bpf: Add start_test helper in bpf_tcp_ca selftests/bpf: Use start_test in test_dctcp_fallback in bpf_tcp_ca selftests/bpf: Use start_test in test_dctcp in bpf_tcp_ca selftests/bpf: Drop useless arguments of do_test in bpf_tcp_ca Jakub Sitnicki (1): selftests/bpf: use section names understood by libbpf in test_sockmap Jeff Johnson (1): test_bpf: Add missing MODULE_DESCRIPTION() Kui-Feng Lee (15): bpf: pass bpf_struct_ops_link to callbacks in bpf_struct_ops. bpf: enable detaching links of struct_ops objects. bpf: support epoll from bpf struct_ops links. bpf: export bpf_link_inc_not_zero. selftests/bpf: test struct_ops with epoll bpftool: Change pid_iter.bpf.c to comply with the change of bpf_link_fops. bpf: Remove unnecessary checks on the offset of btf_field. bpf: Remove unnecessary call to btf_field_type_size(). bpf: refactor btf_find_struct_field() and btf_find_datasec_var(). bpf: create repeated fields for arrays. bpf: look into the types of the fields of a struct type recursively. bpf: limit the number of levels of a nested struct type. selftests/bpf: Test kptr arrays and kptrs in nested struct fields. selftests/bpf: Test global bpf_rb_root arrays and fields in nested struct types. selftests/bpf: Test global bpf_list_head arrays. Martin KaFai Lau (2): Merge branch 'use network helpers, part 5' Merge branch 'Notify user space when a struct_ops object is detached/unregistered' Mykyta Yatsenko (2): libbpf: Configure log verbosity with env variable libbpf: Auto-attach struct_ops BPF maps in BPF skeleton Song Liu (1): selftests/bpf: Fix bpf_cookie and find_vma in nested VM Swan Beaujard (1): bpftool: Fix typo in MAX_NUM_METRICS macro name Xiao Wang (1): riscv, bpf: Introduce shift add helper with Zba optimization Yafang Shao (2): bpf: Add bits iterator selftests/bpf: Add selftest for bits iter Yonghong Song (2): selftests/bpf: Ignore .llvm.<hash> suffix in kallsyms_find() selftests/bpf: Fix send_signal test with nested CONFIG_PARAVIRT Documentation/bpf/libbpf/libbpf_overview.rst | 8 + arch/riscv/net/bpf_jit.h | 33 +++ arch/riscv/net/bpf_jit_comp32.c | 3 +- arch/riscv/net/bpf_jit_comp64.c | 9 +- include/linux/bpf.h | 13 +- kernel/bpf/bpf_struct_ops.c | 75 ++++- kernel/bpf/btf.c | 310 ++++++++++++------- kernel/bpf/helpers.c | 119 ++++++++ kernel/bpf/syscall.c | 34 ++- kernel/bpf/verifier.c | 4 +- lib/test_bpf.c | 1 + net/bpf/bpf_dummy_struct_ops.c | 4 +- net/ipv4/bpf_tcp_ca.c | 6 +- tools/bpf/bpftool/gen.c | 52 +++- tools/bpf/bpftool/skeleton/pid_iter.bpf.c | 7 +- tools/bpf/bpftool/skeleton/profiler.bpf.c | 14 +- tools/lib/bpf/btf.c | 328 ++++++++++++--------- tools/lib/bpf/libbpf.c | 89 +++++- tools/lib/bpf/libbpf.h | 23 +- tools/lib/bpf/libbpf.map | 2 + tools/lib/bpf/libbpf_internal.h | 36 ++- tools/lib/bpf/linker.c | 58 ++-- .../bpf/bpf_test_no_cfi/bpf_test_no_cfi.c | 4 +- .../selftests/bpf/bpf_testmod/bpf_testmod.c | 6 +- tools/testing/selftests/bpf/network_helpers.c | 32 +- tools/testing/selftests/bpf/network_helpers.h | 8 +- .../testing/selftests/bpf/prog_tests/bpf_cookie.c | 2 +- .../testing/selftests/bpf/prog_tests/bpf_tcp_ca.c | 196 ++++++++---- .../selftests/bpf/prog_tests/bpf_verif_scale.c | 6 - .../selftests/bpf/prog_tests/btf_field_iter.c | 161 ++++++++++ tools/testing/selftests/bpf/prog_tests/cpumask.c | 5 + tools/testing/selftests/bpf/prog_tests/find_vma.c | 4 +- .../testing/selftests/bpf/prog_tests/linked_list.c | 12 + tools/testing/selftests/bpf/prog_tests/rbtree.c | 47 +++ .../testing/selftests/bpf/prog_tests/send_signal.c | 3 +- .../selftests/bpf/prog_tests/sockopt_inherit.c | 2 +- .../bpf/prog_tests/test_struct_ops_module.c | 57 ++++ tools/testing/selftests/bpf/prog_tests/verifier.c | 2 + .../selftests/bpf/progs/bpf_iter_bpf_array_map.c | 6 - .../bpf/progs/bpf_iter_bpf_percpu_array_map.c | 6 - .../testing/selftests/bpf/progs/cpumask_success.c | 171 +++++++++++ tools/testing/selftests/bpf/progs/linked_list.c | 42 +++ tools/testing/selftests/bpf/progs/rbtree.c | 77 +++++ .../selftests/bpf/progs/struct_ops_detach.c | 10 + .../selftests/bpf/progs/test_sockmap_kern.h | 20 +- .../selftests/bpf/progs/verifier_bits_iter.c | 153 ++++++++++ tools/testing/selftests/bpf/test_sockmap.c | 132 ++++----- .../selftests/bpf/test_tcp_check_syncookie_user.c | 4 +- tools/testing/selftests/bpf/test_verifier.c | 5 - tools/testing/selftests/bpf/trace_helpers.c | 13 +- 50 files changed, 1887 insertions(+), 527 deletions(-) create mode 100644 tools/testing/selftests/bpf/prog_tests/btf_field_iter.c create mode 100644 tools/testing/selftests/bpf/progs/struct_ops_detach.c create mode 100644 tools/testing/selftests/bpf/progs/verifier_bits_iter.c