public inbox for bpf@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v5 bpf-next 0/6] bpf: Prep patches for static stack liveness.
@ 2026-04-03  2:44 Alexei Starovoitov
  2026-04-03  2:44 ` [PATCH v5 bpf-next 1/6] bpf: Do register range validation early Alexei Starovoitov
                   ` (6 more replies)
  0 siblings, 7 replies; 9+ messages in thread
From: Alexei Starovoitov @ 2026-04-03  2:44 UTC (permalink / raw)
  To: bpf; +Cc: daniel, andrii, martin.lau, memxor, eddyz87

From: Alexei Starovoitov <ast@kernel.org>

v4->v5:
- minor test fixup

v3->v4:
- fixed invalid recursion detection when calback is called multiple times

v3: https://lore.kernel.org/bpf/20260402212856.86606-1-alexei.starovoitov@gmail.com/

v2->v3:
- added recursive call detection
- fixed ubsan warning
- removed double declaration in the header
- added Acks

v2: https://lore.kernel.org/bpf/20260402061744.10885-1-alexei.starovoitov@gmail.com/

v1->v2:
. fixed bugs spotted by Eduard, Mykyta, claude and gemini
. fixed selftests that were failing in unpriv
. gemini(sashiko) found several precision improvements in patch 6,
  but they made no difference in real programs.

v1: https://lore.kernel.org/bpf/20260401021635.34636-1-alexei.starovoitov@gmail.com/
First 6 prep patches for static stack liveness.

. do src/dst_reg validation early and remove defensive checks

. sort subprog in topo order. We wanted to do this long ago
  to process global subprogs this way and in other cases.

. Add constant folding pass that computes map_ptr, subprog_idx,
  loads from readonly maps, and other constants that fit into 32-bit

. Use these constants to eliminate dead code. Replace predicted
  conditional branches with "jmp always". That reduces JIT prog size.

. Add two helpers that return access size from their arguments.

Alexei Starovoitov (6):
  bpf: Do register range validation early
  bpf: Sort subprogs in topological order after check_cfg()
  selftests/bpf: Add tests for subprog topological ordering
  bpf: Add bpf_compute_const_regs() and bpf_prune_dead_branches() passes
  bpf: Move verifier helpers to header
  bpf: Add helper and kfunc stack access size resolution

 include/linux/bpf_verifier.h                  |  59 +++
 kernel/bpf/Makefile                           |   2 +-
 kernel/bpf/const_fold.c                       | 396 ++++++++++++++++
 kernel/bpf/verifier.c                         | 431 ++++++++++++++----
 .../selftests/bpf/prog_tests/verifier.c       |   2 +
 .../selftests/bpf/progs/verifier_loops1.c     |   3 +-
 .../selftests/bpf/progs/verifier_scalar_ids.c |  20 +-
 .../bpf/progs/verifier_subprog_topo.c         | 226 +++++++++
 .../selftests/bpf/progs/verifier_unpriv.c     |   6 +-
 tools/testing/selftests/bpf/verifier/calls.c  |   6 +-
 .../selftests/bpf/verifier/junk_insn.c        |   4 +-
 11 files changed, 1057 insertions(+), 98 deletions(-)
 create mode 100644 kernel/bpf/const_fold.c
 create mode 100644 tools/testing/selftests/bpf/progs/verifier_subprog_topo.c

-- 
2.52.0


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2026-04-03 15:40 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-03  2:44 [PATCH v5 bpf-next 0/6] bpf: Prep patches for static stack liveness Alexei Starovoitov
2026-04-03  2:44 ` [PATCH v5 bpf-next 1/6] bpf: Do register range validation early Alexei Starovoitov
2026-04-03  2:44 ` [PATCH v5 bpf-next 2/6] bpf: Sort subprogs in topological order after check_cfg() Alexei Starovoitov
2026-04-03  2:44 ` [PATCH v5 bpf-next 3/6] selftests/bpf: Add tests for subprog topological ordering Alexei Starovoitov
2026-04-03  2:44 ` [PATCH v5 bpf-next 4/6] bpf: Add bpf_compute_const_regs() and bpf_prune_dead_branches() passes Alexei Starovoitov
2026-04-03  2:44 ` [PATCH v5 bpf-next 5/6] bpf: Move verifier helpers to header Alexei Starovoitov
2026-04-03  2:44 ` [PATCH v5 bpf-next 6/6] bpf: Add helper and kfunc stack access size resolution Alexei Starovoitov
2026-04-03  4:40   ` bot+bpf-ci
2026-04-03 15:40 ` [PATCH v5 bpf-next 0/6] bpf: Prep patches for static stack liveness patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox