Skip to content

veristat: add better support of freplace programs

Andrii Nakryiko bpf 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 Latest3 patches 8 repliesApplied 3/3
  2. v33 patches 0 repliesSuperseded
  3. v23 patches 4 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v13 patches0 repliesSuperseded

Changes in v4 from the cover letter

- fix optional kern_name check when guessing prog type (Alexei);

Patches in v4 All 3 applied

#Subject and filesSizeRepliesApplied
1/3libbpf: disassociate section handler on explicit bpf_program__set_type() calltools/lib/bpf/libbpf.c tools/testing/selftests/bpf/testing_helpers.c+2 -10 repliesApplied
2/3veristat: add -d debug mode option to see debug libbpf logtools/testing/selftests/bpf/veristat.c+7 -12 repliesApplied
3/3veristat: guess and substitue underlying program type for freplace (EXT) progstools/testing/selftests/bpf/veristat.c+117 -45 repliesApplied

Reviews trailers per patch

None of the 3 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchStanislav FomichevEduard Zingerman
SeriesA-b
1/3
2/3
3/3T-b

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 v4 bpf-next 0/3] veristat: add better support of freplace programs

Teach veristat how to deal with freplace BPF programs. As they can't be directly loaded by veristat without custom user-space part that sets correct target program FD, veristat always fails freplace programs. This patch set teaches veristat to guess target program type that will be inherited by freplace program itself, and subtitute it for BPF_PROG_TYPE_EXT (freplace) one for the purposes of BPF verification.

Patch #1 fixes bug in libbpf preventing overriding freplace with specific program type.

Patch #2 adds convenient -d flag to request veristat to emit libbpf debug logs. It help debugging why a specific BPF program fails to load, if the problem is not due to BPF verification itself.

v3->v4:
- fix optional kern_name check when guessing prog type (Alexei);
v2->v3:
- fix bpf_obj_id selftest that uses legacy bpf_prog_test_load() helper, which always sets program type programmatically; teach the helper to do it only if actually necessary (Stanislav);
v1->v2:
- fix compilation error reported by old GCC (my GCC v11 doesn't produce even a warning) and Clang (see CI failure at [0]):

GCC version:

veristat.c: In function ‘fixup_obj’:
veristat.c:908:1: error: label at end of compound statement

    908 | skip_freplace_fixup:
        | ^~~~~~~~~~~~~~~~~~~

Clang version:

veristat.c:909:1: error: label at end of compound statement is a C2x extension [-Werror,-Wc2x-extensions] }
^
1 error generated.

[0] https://github.com/kernel-patches/bpf/actions/runs/4515972059/jobs/7953845335

Andrii Nakryiko (3):
libbpf: disassociate section handler on explicit
bpf_program__set_type() call
veristat: add -d debug mode option to see debug libbpf log
veristat: guess and substitue underlying program type for freplace
(EXT) progs

 tools/lib/bpf/libbpf.c                        |   1 +
 tools/testing/selftests/bpf/testing_helpers.c |   2 +-
 tools/testing/selftests/bpf/veristat.c        | 129 +++++++++++++++++-
 3 files changed, 126 insertions(+), 6 deletions(-)
Signature · 1 line
2.34.1