Misc BPF gotox fixes
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
- v3 Latest16 patches 1 replyApplied 16/16
- v211 patches 9 repliesSuperseded
- v16 patches 11 repliesSuperseded
Changes in v3 from the cover letter
- Rebased onto bpf-next given indirect call series landed
- Split out the exit_idx sentinel as its own fix (Eduard)
- Return early from visit_gotox_insn() on a revisited gotox (Eduard)
- Check both ends of the target slice in check_indirect_jump() (Eduard)
- Rewrite edge limit and nop target tests in inline asm (Eduard)
- Name the patch modes BPF_PATCH_{KEEP,MOVE}_TARGET (Eduard)
- Drop the insn array stale reuse test (Eduard)
- Clear the insn array used flag with release semantics (sashiko)
- Add fix for the exception callback index after dead subprog removal
- Free the jump tables of removed subprogs and on a failed table build
- Shift the poke descriptors along with the insn array slots
Patches in v3 All 16 applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/16 | bpf: Avoid quadratic successor rescan in bpf_compute_scckernel/ | +20 | 0 replies | Applied |
| 2/16 | bpf: Bound the number of indirect jump edges in a programinclude/ kernel/ | +16 | 0 replies | Applied |
| 3/16 | bpf: Rebase the exception callback subprog when dead subprogs are removedkernel/ | +3 | 0 replies | Applied |
| 4/16 | bpf: Leave out the hidden exit edge of a subprogram without an exitinclude/ kernel/ kernel/ | +13 | 0 replies | Applied |
| 5/16 | bpf: Cache the jump table of a subprogram during CFG discoveryinclude/ kernel/ kernel/ +2 more | +134 | 1 reply | Applied |
| 6/16 | bpf: Reject indirect jumps that leave their subprogramkernel/ kernel/ tools/ | +51 | 0 replies | Applied |
| 7/16 | bpf: Don't remove indirect jump targets in the nop removal passkernel/ | +3 | 0 replies | Applied |
| 8/16 | bpf: Clear insn array jitted pointers on map reusekernel/ | +8 | 0 replies | Applied |
| 9/16 | bpf: Clear the insn array used flag with release semanticskernel/ | +2 | 0 replies | Applied |
| 10/16 | bpf: Retarget indirect jump targets across prologue prependsinclude/ kernel/ kernel/ | +43 | 0 replies | Applied |
| 11/16 | selftests/bpf: Add tests for the indirect jump edge limittools/ | +94 | 0 replies | Applied |
| 12/16 | selftests/bpf: Add a test for a tail call in a subprogram without an exittools/ | +38 | 0 replies | Applied |
| 13/16 | selftests/bpf: Add tests for indirect jumps across subprogramstools/ | +541 | 0 replies | Applied |
| 14/16 | selftests/bpf: Add a test for gotox nop targetstools/ | +29 | 0 replies | Applied |
| 15/16 | selftests/bpf: Add tests for gotox targets across prologue prependstools/ | +108 | 0 replies | Applied |
| 16/16 | selftests/bpf: Add a test for an exception callback behind a dead subprogtools/ tools/ | +47 | 0 replies | Applied |
Reviews trailers per patch
7 of 16 patches have a Reviewed-by or Acked-by.
| Patch | Eduard Zingerman | Anton Protopopov |
|---|---|---|
| 1/16 | A-b | |
| 2/16 | A-b | |
| 3/16 | ||
| 4/16 | ||
| 5/16 | ||
| 6/16 | A-b | A-b |
| 7/16 | A-b | A-b |
| 8/16 | A-b | A-b |
| 9/16 | ||
| 10/16 | A-b | A-b |
| 11/16 | ||
| 12/16 | ||
| 13/16 | ||
| 14/16 | ||
| 15/16 | A-b | |
| 16/16 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH bpf-next v3 00/16] Misc BPF gotox fixes
Address various open issues around gotox instruction, see individual commits for details. Also BPF selftests are added to assert that these are addressed.
v2 -> v3:
- Rebased onto bpf-next given indirect call series landed
- Split out the exit_idx sentinel as its own fix (Eduard)
- Return early from visit_gotox_insn() on a revisited gotox (Eduard)
- Check both ends of the target slice in check_indirect_jump() (Eduard)
- Rewrite edge limit and nop target tests in inline asm (Eduard)
- Name the patch modes BPF_PATCH_{KEEP,MOVE}_TARGET (Eduard)
- Drop the insn array stale reuse test (Eduard)
- Clear the insn array used flag with release semantics (sashiko)
- Add fix for the exception callback index after dead subprog removal
- Free the jump tables of removed subprogs and on a failed table build
- Shift the poke descriptors along with the insn array slots
v1 -> v2:
- Remove jt_spans_subprogs and reject right away (Eduard)
- Rework jump table to no longer keep it in insn_aux_data (Eduard)
- Fix up comments in bpf_compute_scc (Eduard)
- Fix up commit message nit wrt signed_loader (Anton)
- Added 3 more fixes related to gotox along with BPF selftests
Daniel Borkmann (16):
bpf: Avoid quadratic successor rescan in bpf_compute_scc
bpf: Bound the number of indirect jump edges in a program
bpf: Rebase the exception callback subprog when dead subprogs are removed
bpf: Leave out the hidden exit edge of a subprogram without an exit
bpf: Cache the jump table of a subprogram during CFG discovery
bpf: Reject indirect jumps that leave their subprogram
bpf: Don't remove indirect jump targets in the nop removal pass
bpf: Clear insn array jitted pointers on map reuse
bpf: Clear the insn array used flag with release semantics
bpf: Retarget indirect jump targets across prologue prepends selftests/bpf: Add tests for the indirect jump edge limit selftests/bpf: Add a test for a tail call in a subprogram without an exit selftests/bpf: Add tests for indirect jumps across subprograms selftests/bpf: Add a test for gotox nop targets selftests/bpf: Add tests for gotox targets across prologue prepends selftests/bpf: Add a test for an exception callback behind a dead subprog
include/linux/bpf.h | 2 +- include/linux/bpf_verifier.h | 12 +- kernel/bpf/bpf_insn_array.c | 19 +- kernel/bpf/cfg.c | 241 ++++--- kernel/bpf/fixups.c | 92 ++- kernel/bpf/liveness.c | 26 +- kernel/bpf/verifier.c | 37 +- .../selftests/bpf/prog_tests/bpf_insn_array.c | 650 +++++++++++++++++- .../selftests/bpf/prog_tests/exceptions.c | 7 + .../bpf/progs/exceptions_dead_subprog.c | 40 ++ .../selftests/bpf/progs/verifier_cfg.c | 38 + .../selftests/bpf/progs/verifier_gotox.c | 125 +++- 12 files changed, 1115 insertions(+), 174 deletions(-) create mode 100644 tools/testing/selftests/bpf/progs/exceptions_dead_subprog.c
Signature · 1 line
2.43.0