mbox series

[bpf-next,0/7] libbpf: further struct_ops fixes and improvements

Message ID 20240507001335.1445325-1-andrii@kernel.org (mailing list archive)
Headers show
Series libbpf: further struct_ops fixes and improvements | expand

Message

Andrii Nakryiko May 7, 2024, 12:13 a.m. UTC
Fix yet another case of mishandling SEC("struct_ops") programs that were
nulled out programmatically through BPF skeleton by the user.

While at it, add some improvements around detecting and reporting errors,
specifically a common case of declaring SEC("struct_ops") program, but
forgetting to actually make use of it by setting it as a callback
implementation in SEC(".struct_ops") variable (i.e., map) declaration.

A bunch of new selftests are added as well.

Andrii Nakryiko (7):
  libbpf: remove unnecessary struct_ops prog validity check
  libbpf: handle yet another corner case of nulling out struct_ops
    program
  selftests/bpf: add another struct_ops callback use case test
  libbpf: fix libbpf_strerror_r() handling unknown errors
  libbpf: improve early detection of doomed-to-fail BPF program loading
  selftests/bpf: validate struct_ops early failure detection logic
  selftests/bpf: shorten subtest names for struct_ops_module test

 tools/lib/bpf/libbpf.c                        | 38 ++++++---
 tools/lib/bpf/str_error.c                     | 16 +++-
 .../bpf/prog_tests/test_struct_ops_module.c   | 78 ++++++++++++++++++-
 .../bpf/progs/struct_ops_forgotten_cb.c       | 19 +++++
 .../bpf/progs/struct_ops_nulled_out_cb.c      | 22 ++++++
 5 files changed, 156 insertions(+), 17 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/progs/struct_ops_forgotten_cb.c
 create mode 100644 tools/testing/selftests/bpf/progs/struct_ops_nulled_out_cb.c

Comments

patchwork-bot+netdevbpf@kernel.org May 8, 2024, 12:30 a.m. UTC | #1
Hello:

This series was applied to bpf/bpf-next.git (master)
by Martin KaFai Lau <martin.lau@kernel.org>:

On Mon,  6 May 2024 17:13:28 -0700 you wrote:
> Fix yet another case of mishandling SEC("struct_ops") programs that were
> nulled out programmatically through BPF skeleton by the user.
> 
> While at it, add some improvements around detecting and reporting errors,
> specifically a common case of declaring SEC("struct_ops") program, but
> forgetting to actually make use of it by setting it as a callback
> implementation in SEC(".struct_ops") variable (i.e., map) declaration.
> 
> [...]

Here is the summary with links:
  - [bpf-next,1/7] libbpf: remove unnecessary struct_ops prog validity check
    https://git.kernel.org/bpf/bpf-next/c/8374b56b1df5
  - [bpf-next,2/7] libbpf: handle yet another corner case of nulling out struct_ops program
    https://git.kernel.org/bpf/bpf-next/c/e18e2e70dbd1
  - [bpf-next,3/7] selftests/bpf: add another struct_ops callback use case test
    https://git.kernel.org/bpf/bpf-next/c/9d66d60e968d
  - [bpf-next,4/7] libbpf: fix libbpf_strerror_r() handling unknown errors
    https://git.kernel.org/bpf/bpf-next/c/548c2ede0dc8
  - [bpf-next,5/7] libbpf: improve early detection of doomed-to-fail BPF program loading
    https://git.kernel.org/bpf/bpf-next/c/c78420bafe7c
  - [bpf-next,6/7] selftests/bpf: validate struct_ops early failure detection logic
    https://git.kernel.org/bpf/bpf-next/c/41df0733ea41
  - [bpf-next,7/7] selftests/bpf: shorten subtest names for struct_ops_module test
    https://git.kernel.org/bpf/bpf-next/c/7b9959b8cdbc

You are awesome, thank you!