Skip to content

validate-bpf: add standalone validation debug tool

Marat Khalili dpdk-dev 1 version Applied

Status from this message: Applied, thanks.

Get series with b4
b4 am [email protected]

Versions newest first

  1. v4 Latest7 patches 4 repliesApplied

Changes in v4 from the cover letter

* addressed reviewer feedback from Konstantin Ananyev:
* changed variable and array names to lowercase to follow conventions;
* replaced strtoull()/strtoumax() with strtoul() and removed redundant

Patches in v4 Applied

#Subject and filesSizeRepliesApplied
1/7bpf/validate: fix finished status on restartlib/bpf/bpf_validate_debug.c+1 -00 replies
2/7bpf/validate: refactor internal step functionlib/bpf/bpf_validate.c lib/bpf/bpf_validate_debug.c lib/bpf/bpf_validate_debug.h+25 -230 replies
3/7bpf/validate: formalize call back requirementslib/bpf/bpf_validate.c lib/bpf/bpf_validate_debug.c lib/bpf/bpf_validate_debug.h +1 more+78 -490 replies
4/7bpf/validate: add jump notification eventslib/bpf/bpf_validate.c lib/bpf/bpf_validate_debug.c lib/bpf/rte_bpf_validate_debug.h+15 -20 replies
5/7bpf/validate: add get current event APIlib/bpf/bpf_validate_debug.c lib/bpf/rte_bpf_validate_debug.h+26 -00 replies
6/7app/test: add test for bpf validate debug eventsapp/test/test_bpf_validate.c+340 -40 replies
7/7app/validate-bpf: add BPF validation applicationMAINTAINERS app/meson.build app/validate-bpf/alloc_list.c +12 more+2883 -02 replies

Reviews trailers per patch

None of the 7 patches has a Reviewed-by or Acked-by.

PatchKonstantin Ananyev
SeriesSeries-Acked-by
1/7
2/7
3/7
4/7
5/7
6/7
7/7

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 0/7] validate-bpf: add standalone validation debug tool

This patchset introduces a new standalone tool for pre-validating eBPF programs and debugging validation problems. Its should allow developers to trace validator state changes per instruction and understand verifier decisions, simplifying the debugging of rejected programs before loading them into a real application context.

v4:
* addressed reviewer feedback from Konstantin Ananyev:
* changed variable and array names to lowercase to follow conventions;
* replaced strtoull()/strtoumax() with strtoul() and removed redundant

    SIZE_MAX checks;
  * changed return types of point_infos_destroy_* functions to void;
  * replaced %jd and (intmax_t) cast with PRId32 when printing frame
    offsets;
  * refactored the inverted loop in print_frame() for clarity;
  * replaced return -ENOMEM with RTE_VERIFY() for allocations in debug.c
    print functions;

* simplified token matching logic in parse_decl.c by using strncmp().

v3:
* addressed another FreeBSD issue (spurious uninitialized warning);
* addressed more AI comments:
* fail if library fails to set step catchpoint on start command;
* fail nicer if external variables are too big;
* fail nicer if EAL initialization or cleanup fails;
* explain why 9 steps are expeced in the test;
* explain that non-zero buf_size marks mbuf;
* avoid symbols starting with RTE_ in the app;

v2:
* for FreeBSD compatibility switched from Linux to DPDK network structs;
* addressed small AI comments:
* clarified patch 1 commit message;
* renamed rte_validate_bpf_logtype to validate_bpf_logtype;
* corrected comment to an internal-use-only function to reflect that

    next-after-last value of the program counter is no longer allowed;

Marat Khalili (7):
bpf/validate: fix finished status on restart bpf/validate: refactor internal step function bpf/validate: formalize call back requirements bpf/validate: add jump notification events bpf/validate: add get current event API app/test: add test for bpf validate debug events app/validate-bpf: add BPF validation application

 MAINTAINERS                            |    2 +
 app/meson.build                        |    1 +
 app/test/test_bpf_validate.c           |  344 +++++++-
 app/validate-bpf/alloc_list.c          |   53 ++
 app/validate-bpf/args.c                |  262 ++++++
 app/validate-bpf/debug.c               | 1087 ++++++++++++++++++++++++
 app/validate-bpf/debug_command.c       |  383 +++++++++
 app/validate-bpf/debug_command.h       |   65 ++
 app/validate-bpf/eal_init_args.c       |   57 ++
 app/validate-bpf/internal.h            |  151 ++++
 app/validate-bpf/main.c                |   90 ++
 app/validate-bpf/meson.build           |   13 +
 app/validate-bpf/parse_decl.c          |  616 ++++++++++++++
 doc/guides/rel_notes/release_26_11.rst |    5 +
 doc/guides/tools/index.rst             |    1 +
 doc/guides/tools/validate_bpf.rst      |   97 +++
 lib/bpf/bpf_validate.c                 |   49 +-
 lib/bpf/bpf_validate_debug.c           |   92 +-
 lib/bpf/bpf_validate_debug.h           |   12 +-
 lib/bpf/rte_bpf_validate_debug.h       |   42 +-
 20 files changed, 3356 insertions(+), 66 deletions(-)
 create mode 100644 app/validate-bpf/alloc_list.c
 create mode 100644 app/validate-bpf/args.c
 create mode 100644 app/validate-bpf/debug.c
 create mode 100644 app/validate-bpf/debug_command.c
 create mode 100644 app/validate-bpf/debug_command.h
 create mode 100644 app/validate-bpf/eal_init_args.c
 create mode 100644 app/validate-bpf/internal.h
 create mode 100644 app/validate-bpf/main.c
 create mode 100644 app/validate-bpf/meson.build
 create mode 100644 app/validate-bpf/parse_decl.c
 create mode 100644 doc/guides/tools/validate_bpf.rst
Signature · 1 line
2.43.0