Skip to content

Fixes for stack with allow_ptr_leaks

Kumar Kartikeya Dwivedi bpf 4 versions – Applied

Status from this message: This series was applied to bpf/bpf.git (master)

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest5 patches 0 repliesApplied 5/5
  2. v35 patches 6 repliesSuperseded
  3. v24 patches 7 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v14 patches0 repliesSuperseded

Changes in v4 from the cover letter

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

* Address Andrii's comments
* Fix bug paperered over by missing CAP_NET_ADMIN in verifier_mtu test
* Add warning when undefined CAP_ constant is specified, and fail test
* Reorder annotations to be more clear
* Verify that fixes fail without patches again
* Add Acked-by from Andrii

Patches in v4 All 5 applied

#Subject and filesSizeRepliesApplied
1/5bpf: Don't mark STACK_INVALID as STACK_MISC in mark_stack_slot_misckernel/bpf/verifier.c+6 -30 repliesApplied
2/5bpf: Fix narrow scalar spill onto 64-bit spilled scalar slotskernel/bpf/verifier.c+1 -00 repliesApplied
3/5selftests/bpf: Introduce __caps_unpriv annotation for teststools/testing/selftests/bpf/prog_tests/verifier.c tools/testing/selftests/bpf/progs/bpf_misc.h tools/testing/selftests/bpf/progs/verifier_mtu.c +1 more+62 -190 repliesApplied
4/5selftests/bpf: Add test for reading from STACK_INVALID slotstools/testing/selftests/bpf/progs/verifier_spill_fill.c+18 -00 repliesApplied
5/5selftests/bpf: Add test for narrow spill into 64-bit spilled scalartools/testing/selftests/bpf/progs/verifier_spill_fill.c+17 -00 repliesApplied

Reviews trailers per patch

3 of 5 patches have a Reviewed-by or Acked-by.

PatchAndrii NakryikoEduard Zingerman
1/5A-b
2/5A-b A-b
3/5
4/5
5/5A-b

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

Read the v4 thread

Cover letter [PATCH bpf v4 0/5] Fixes for stack with allow_ptr_leaks

Two fixes for usability/correctness gaps when interacting with the stack without CAP_PERFMON (i.e. with allow_ptr_leaks = false). See the commits for details. I've verified that the tests fail when run without the fixes.

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

* Address Andrii's comments
* Fix bug paperered over by missing CAP_NET_ADMIN in verifier_mtu test
* Add warning when undefined CAP_ constant is specified, and fail test
* Reorder annotations to be more clear
* Verify that fixes fail without patches again
* Add Acked-by from Andrii

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

* Address comments from Eduard
* Fix comment for mark_stack_slot_misc
* We can simply always return early when stype == STACK_INVALID
* Drop allow_ptr_leaks conditionals
* Add Eduard's __caps_unpriv patch into the series
* Convert test_verifier_mtu to use it
* Move existing tests to __caps_unpriv annotation and verifier_spill_fill.c
* Add Acked-by from Eduard

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

* Fix CI errors in selftest by removing dependence on BPF_ST

Eduard Zingerman (1):
selftests/bpf: Introduce __caps_unpriv annotation for tests

Kumar Kartikeya Dwivedi (3):
bpf: Don't mark STACK_INVALID as STACK_MISC in mark_stack_slot_misc selftests/bpf: Add test for reading from STACK_INVALID slots selftests/bpf: Add test for narrow spill into 64-bit spilled scalar

Tao Lyu (1):
bpf: Fix narrow scalar spill onto 64-bit spilled scalar slots

 kernel/bpf/verifier.c                         | 10 ++--
 .../selftests/bpf/prog_tests/verifier.c       | 19 +-------
 tools/testing/selftests/bpf/progs/bpf_misc.h  | 12 +++++
 .../selftests/bpf/progs/verifier_mtu.c        |  4 +-
 .../selftests/bpf/progs/verifier_spill_fill.c | 35 ++++++++++++++
 tools/testing/selftests/bpf/test_loader.c     | 46 +++++++++++++++++++
 6 files changed, 104 insertions(+), 22 deletions(-)

base-commit: 5a6ea7022ff4d2a65ae328619c586d6a8909b48b

Signature · 1 line
2.43.5