Skip to content

Dynptr fixes

Kumar Kartikeya Dwivedi bpf 5 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. v5 Latest12 patches 1 replyApplied 12/12
  2. v412 patches 3 repliesSuperseded
  3. v312 patches 4 repliesSuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v211 patches10 repliesSuperseded
v18 patches29 repliesSuperseded

Changes in v5 from the cover letter

v5: https://lore.kernel.org/bpf/[email protected]

* Add comments, tests from Joanne
* Add Joanne's acks

Patches in v5 All 12 applied

#Subject and filesSizeRepliesApplied
1/12bpf: Fix state pruning for STACK_DYNPTR stack slotskernel/bpf/verifier.c+84 -40 repliesApplied
2/12bpf: Fix missing var_off check for ARG_PTR_TO_DYNPTRkernel/bpf/verifier.c tools/testing/selftests/bpf/prog_tests/kfunc_dynptr_param.c tools/testing/selftests/bpf/progs/dynptr_fail.c+69 -210 repliesApplied
3/12bpf: Fix partial dynptr stack slot reads/writeskernel/bpf/verifier.c tools/testing/selftests/bpf/progs/dynptr_fail.c+91 -30 repliesApplied
4/12bpf: Invalidate slices on destruction of dynptrs on stackinclude/linux/bpf_verifier.h kernel/bpf/verifier.c tools/testing/selftests/bpf/progs/dynptr_fail.c+68 -150 repliesApplied
5/12bpf: Allow reinitializing unreferenced dynptr stack slotskernel/bpf/verifier.c+26 -80 repliesApplied
6/12bpf: Combine dynptr_get_spi and is_spi_bounds_validkernel/bpf/verifier.c+33 -420 repliesApplied
7/12bpf: Avoid recomputing spi in process_dynptr_funckernel/bpf/verifier.c+11 -130 repliesApplied
8/12selftests/bpf: convenience macro for use with 'asm volatile' blockstools/testing/selftests/bpf/progs/bpf_misc.h+7 -00 repliesApplied
9/12selftests/bpf: Add dynptr pruning teststools/testing/selftests/bpf/progs/dynptr_fail.c+141 -00 repliesApplied
10/12selftests/bpf: Add dynptr var_off teststools/testing/selftests/bpf/progs/dynptr_fail.c+40 -00 repliesApplied
11/12selftests/bpf: Add dynptr partial slot overwrite teststools/testing/selftests/bpf/progs/dynptr_fail.c+66 -00 repliesApplied
12/12selftests/bpf: Add dynptr helper teststools/testing/selftests/bpf/progs/dynptr_fail.c+192 -00 repliesApplied

Reviews trailers per patch

8 of 12 patches have a Reviewed-by or Acked-by.

PatchEduard ZingermanJoanne KoongAndrii NakryikoYonghong Song
1/12A-b
2/12A-b
3/12
4/12A-b
5/12A-b
6/12A-b
7/12A-b
8/12A-b A-b
9/12
10/12
11/12
12/12A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 4 reviewers.

Read the v5 thread

Cover letter [PATCH bpf-next v5 00/12] Dynptr fixes

This is part 2 of https://lore.kernel.org/bpf/[email protected].

Changelog:
----------
v4 -> v5
v5: https://lore.kernel.org/bpf/[email protected]

* Add comments, tests from Joanne
* Add Joanne's acks

v3 -> v4
v3: https://lore.kernel.org/bpf/[email protected]

* Adopt BPF ASM tests to more readable style (Alexei)

v2 -> v3
v2: https://lore.kernel.org/bpf/[email protected]

* Fix slice invalidation logic for unreferenced dynptrs (Joanne)
* Add selftests for precise slice invalidation on destruction
* Add Joanne's acks

v1 -> v2
v1: https://lore.kernel.org/bpf/[email protected]

* Return error early in case of overwriting referenced dynptr slots (Andrii, Joanne)
* Rename destroy_stack_slots_dynptr to destroy_if_dynptr_stack_slot (Joanne)
* Invalidate dynptr slices associated with dynptr in destroy_if_dynptr_stack_slot (Joanne)
* Combine both dynptr_get_spi and is_spi_bounds_valid (Joanne)
* Compute spi once in process_dynptr_func and pass it as parameter instead of recomputing (Joanne)
* Add comments expanding REG_LIVE_WRITTEN marking in unmark_stack_slots_dynptr (Joanne)
* Add comments explaining why destroy_if_dynptr_stack_slot call needs to be done for both spi and spi - 1 (Joanne)
* Port BPF assembly tests from test_verifier to test_progs framework (Andrii)
* Address misc feedback, rebase to bpf-next

Old v1 -> v1
Old v1: https://lore.kernel.org/bpf/[email protected]

* Allow overwriting dynptr stack slots from dynptr init helpers
* Fix a bug in alignment check where reg->var_off.value was still not included
* Address other minor nits

Eduard Zingerman (1):
selftests/bpf: convenience macro for use with 'asm volatile' blocks

Kumar Kartikeya Dwivedi (11):
bpf: Fix state pruning for STACK_DYNPTR stack slots
bpf: Fix missing var_off check for ARG_PTR_TO_DYNPTR
bpf: Fix partial dynptr stack slot reads/writes
bpf: Invalidate slices on destruction of dynptrs on stack
bpf: Allow reinitializing unreferenced dynptr stack slots
bpf: Combine dynptr_get_spi and is_spi_bounds_valid
bpf: Avoid recomputing spi in process_dynptr_func selftests/bpf: Add dynptr pruning tests selftests/bpf: Add dynptr var_off tests selftests/bpf: Add dynptr partial slot overwrite tests selftests/bpf: Add dynptr helper tests

 include/linux/bpf_verifier.h                  |   5 +-
 kernel/bpf/verifier.c                         | 407 +++++++++++++---
 .../bpf/prog_tests/kfunc_dynptr_param.c       |   2 +-
 tools/testing/selftests/bpf/progs/bpf_misc.h  |   7 +
 .../testing/selftests/bpf/progs/dynptr_fail.c | 453 +++++++++++++++++-
 5 files changed, 798 insertions(+), 76 deletions(-)

base-commit: 00b8f39f1d15c7e16e3f5ca7538f522f3a89131f

Signature · 1 line
2.39.1