BPF List
 help / color / mirror / Atom feed
* [PATCH bpf-next v3 0/5] Fixes for stack with allow_ptr_leaks
@ 2024-12-02  8:38 Kumar Kartikeya Dwivedi
  2024-12-02  8:38 ` [PATCH bpf-next v3 1/5] bpf: Don't mark STACK_INVALID as STACK_MISC in mark_stack_slot_misc Kumar Kartikeya Dwivedi
                   ` (4 more replies)
  0 siblings, 5 replies; 12+ messages in thread
From: Kumar Kartikeya Dwivedi @ 2024-12-02  8:38 UTC (permalink / raw)
  To: bpf
  Cc: kkd, Alexei Starovoitov, Andrii Nakryiko, Daniel Borkmann,
	Martin KaFai Lau, Eduard Zingerman, Tao Lyu, Mathias Payer,
	Meng Xu, Sanidhya Kashyap

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:
----------
v2 -> v3
v2: https://lore.kernel.org/bpf/20241127212026.3580542-1-memxor@gmail.com

 * 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/20241127185135.2753982-1-memxor@gmail.com

 * 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  |  2 +
 .../selftests/bpf/progs/verifier_mtu.c        |  3 +-
 .../selftests/bpf/progs/verifier_spill_fill.c | 33 +++++++++++++++
 tools/testing/selftests/bpf/test_loader.c     | 41 +++++++++++++++++++
 6 files changed, 86 insertions(+), 22 deletions(-)


base-commit: 45e04eb4d9d85603539984bc9ca930c380c93b15
-- 
2.43.5


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

end of thread, other threads:[~2024-12-03  0:16 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-02  8:38 [PATCH bpf-next v3 0/5] Fixes for stack with allow_ptr_leaks Kumar Kartikeya Dwivedi
2024-12-02  8:38 ` [PATCH bpf-next v3 1/5] bpf: Don't mark STACK_INVALID as STACK_MISC in mark_stack_slot_misc Kumar Kartikeya Dwivedi
2024-12-02 22:51   ` Eduard Zingerman
2024-12-03  0:09   ` Andrii Nakryiko
2024-12-02  8:38 ` [PATCH bpf-next v3 2/5] bpf: Fix narrow scalar spill onto 64-bit spilled scalar slots Kumar Kartikeya Dwivedi
2024-12-03  0:12   ` Andrii Nakryiko
2024-12-02  8:38 ` [PATCH bpf-next v3 3/5] selftests/bpf: Introduce __caps_unpriv annotation for tests Kumar Kartikeya Dwivedi
2024-12-03  0:14   ` Andrii Nakryiko
2024-12-02  8:38 ` [PATCH bpf-next v3 4/5] selftests/bpf: Add test for reading from STACK_INVALID slots Kumar Kartikeya Dwivedi
2024-12-02 22:50   ` Eduard Zingerman
2024-12-03  0:16   ` Andrii Nakryiko
2024-12-02  8:38 ` [PATCH bpf-next v3 5/5] selftests/bpf: Add test for narrow spill into 64-bit spilled scalar Kumar Kartikeya Dwivedi

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