BPF List
 help / color / mirror / Atom feed
* [PATCH bpf v4 0/3] bpf: fix accesses to uninit stack slots
@ 2023-12-08  2:31 Andrei Matei
  2023-12-08  2:31 ` [PATCH bpf v4 1/3] bpf: add some comments to stack representation Andrei Matei
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Andrei Matei @ 2023-12-08  2:31 UTC (permalink / raw)
  To: bpf; +Cc: sunhao.th, andrii.nakryiko, eddyz87, Andrei Matei

Fix two related issues issues around verifying stack accesses:
1. accesses to uninitialized stack memory was allowed inconsistently
2. the maximum stack depth needed for a program was not always
maintained correctly

The two issues are fixed together in one commit because the code for one
affects the other.

V3 to V4:
- minor fixup to comment in patch 1 (Eduard)
- C89-style in patch 3 (Andrii)

V2 to V3:
- address review comments from Andrii and Eduard
- drop new verifier tests in favor of editing existing tests to check
  for stack depth
- append a patch with a bit of cleanup coming out of the previous review


Andrei Matei (3):
  bpf: add some comments to stack representation
  bpf: fix accesses to uninit stack slots
  bpf: minor cleanup around stack bounds

 include/linux/bpf_verifier.h                  | 14 ++++
 kernel/bpf/verifier.c                         | 76 +++++++++----------
 tools/testing/selftests/bpf/progs/iters.c     |  2 +-
 .../selftests/bpf/progs/test_global_func16.c  |  2 +-
 .../bpf/progs/verifier_basic_stack.c          |  8 +-
 .../selftests/bpf/progs/verifier_int_ptr.c    |  5 +-
 .../selftests/bpf/progs/verifier_raw_stack.c  |  5 +-
 .../selftests/bpf/progs/verifier_var_off.c    | 62 ++++++++++++---
 .../selftests/bpf/verifier/atomic_cmpxchg.c   | 11 ---
 tools/testing/selftests/bpf/verifier/calls.c  |  4 +-
 10 files changed, 115 insertions(+), 74 deletions(-)

-- 
2.40.1


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

end of thread, other threads:[~2023-12-08  3:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-08  2:31 [PATCH bpf v4 0/3] bpf: fix accesses to uninit stack slots Andrei Matei
2023-12-08  2:31 ` [PATCH bpf v4 1/3] bpf: add some comments to stack representation Andrei Matei
2023-12-08  2:31 ` [PATCH bpf v4 2/3] bpf: fix accesses to uninit stack slots Andrei Matei
2023-12-08  2:31 ` [PATCH bpf v4 3/3] bpf: minor cleanup around stack bounds Andrei Matei
2023-12-08  2:45 ` [PATCH bpf v4 0/3] bpf: fix accesses to uninit stack slots Andrei Matei
2023-12-08  2:50   ` Alexei Starovoitov
2023-12-08  3:01     ` Andrei Matei

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