Skip to content

Refactor verifier prune and jump point handling

Andrii Nakryiko bpf 2 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. v2 Latest3 patches 4 repliesApplied 3/3
  2. v13 patches 5 repliesSuperseded

Changes in v2 from the cover letter

- clarified path #3 commit message and a comment in the code (John);
- added back mark_jmp_point() to right after subprog call to record non-linear implicit jump from BPF_EXIT to right after CALL <subprog>.

Patches in v2 All 3 applied

#Subject and filesSizeRepliesApplied
1/3bpf: decouple prune and jump pointsinclude/linux/bpf_verifier.h kernel/bpf/verifier.c+44 -140 repliesApplied
2/3bpf: mostly decouple jump history management from is_state_visited()kernel/bpf/verifier.c+26 -230 repliesApplied
3/3bpf: remove unnecessary prune and jump pointskernel/bpf/verifier.c+10 -244 repliesApplied

Reviews trailers per patch

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

PatchJohn Fastabend
1/3A-b
2/3A-b
3/3A-b

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

Read the v2 thread

Cover letter [PATCH v2 bpf-next 0/3] Refactor verifier prune and jump point handling

Disentangle prune and jump points in BPF verifier code. They are conceptually independent but currently coupled together. This small patch set refactors related code and make it possible to have some instruction marked as pruning or jump point independently.

Besides just conceptual cleanliness, this allows to remove unnecessary jump points (saving a tiny bit of performance and memory usage, potentially), and even more importantly it allows for clean extension of special pruning points, similarly to how it's done for BPF_FUNC_timer_set_callback. This will be used by future patches implementing open-coded BPF iterators.

v1->v2:
- clarified path #3 commit message and a comment in the code (John);
- added back mark_jmp_point() to right after subprog call to record non-linear implicit jump from BPF_EXIT to right after CALL <subprog>.

Andrii Nakryiko (3):
bpf: decouple prune and jump points
bpf: mostly decouple jump history management from is_state_visited()
bpf: remove unnecessary prune and jump points

 include/linux/bpf_verifier.h |   1 +
 kernel/bpf/verifier.c        | 108 ++++++++++++++++++++---------------
 2 files changed, 64 insertions(+), 45 deletions(-)
Signature · 1 line
2.30.2