mbox series

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

Message ID 20221206233345.438540-1-andrii@kernel.org (mailing list archive)
Headers show
Series Refactor verifier prune and jump point handling | expand

Message

Andrii Nakryiko Dec. 6, 2022, 11:33 p.m. UTC
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(-)

Comments

patchwork-bot+netdevbpf@kernel.org Dec. 7, 2022, 3:30 a.m. UTC | #1
Hello:

This series was applied to bpf/bpf-next.git (master)
by Alexei Starovoitov <ast@kernel.org>:

On Tue, 6 Dec 2022 15:33:42 -0800 you wrote:
> 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.
> 
> [...]

Here is the summary with links:
  - [v2,bpf-next,1/3] bpf: decouple prune and jump points
    https://git.kernel.org/bpf/bpf-next/c/bffdeaa8a5af
  - [v2,bpf-next,2/3] bpf: mostly decouple jump history management from is_state_visited()
    https://git.kernel.org/bpf/bpf-next/c/a095f421057e
  - [v2,bpf-next,3/3] bpf: remove unnecessary prune and jump points
    https://git.kernel.org/bpf/bpf-next/c/618945fbed50

You are awesome, thank you!