BPF List
 help / color / mirror / Atom feed
* [PATCH bpf v2 0/2] bpf: fix accesses to uninit stack slots
@ 2023-11-26  1:50 Andrei Matei
  2023-11-26  1:50 ` [PATCH bpf v2 1/2] " Andrei Matei
  2023-11-26  1:50 ` [PATCH bpf v2 2/2] bpf: new verifier tests for stack access Andrei Matei
  0 siblings, 2 replies; 14+ messages in thread
From: Andrei Matei @ 2023-11-26  1:50 UTC (permalink / raw)
  To: bpf, andrii.nakryiko; +Cc: sunhao.th, eddyz87, kernel-team, 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.

The second patch is tests only. It was split for review purposes; it can
be squashed when merging if it looks good.

Andrei Matei (2):
  bpf: fix accesses to uninit stack slots
  bpf: new verifier tests for stack access

 include/linux/bpf_verifier.h                  |  4 ++
 kernel/bpf/verifier.c                         | 70 ++++++++-----------
 .../selftests/bpf/progs/test_global_func16.c  |  2 +-
 .../bpf/progs/verifier_basic_stack.c          |  6 +-
 .../selftests/bpf/progs/verifier_int_ptr.c    |  2 +-
 .../selftests/bpf/progs/verifier_raw_stack.c  |  2 +-
 .../selftests/bpf/progs/verifier_var_off.c    |  4 +-
 tools/testing/selftests/bpf/test_verifier.c   | 24 +++++++
 .../selftests/bpf/verifier/atomic_cmpxchg.c   | 11 ---
 tools/testing/selftests/bpf/verifier/calls.c  |  2 +-
 tools/testing/selftests/bpf/verifier/stack.c  | 40 +++++++++++
 11 files changed, 106 insertions(+), 61 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/verifier/stack.c

-- 
2.40.1


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

end of thread, other threads:[~2023-12-02 22:41 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-26  1:50 [PATCH bpf v2 0/2] bpf: fix accesses to uninit stack slots Andrei Matei
2023-11-26  1:50 ` [PATCH bpf v2 1/2] " Andrei Matei
2023-11-28  1:33   ` Eduard Zingerman
2023-11-28  1:43     ` Eduard Zingerman
2023-11-28 14:14     ` Eduard Zingerman
2023-11-29  6:05   ` Andrii Nakryiko
2023-11-29 16:48     ` Andrei Matei
2023-11-29 23:54       ` Andrii Nakryiko
2023-12-02 22:41         ` Andrei Matei
2023-11-26  1:50 ` [PATCH bpf v2 2/2] bpf: new verifier tests for stack access Andrei Matei
2023-11-28  1:23   ` Eduard Zingerman
2023-11-28  3:15     ` Andrei Matei
2023-11-28 12:55       ` Eduard Zingerman
2023-11-29  6:12         ` Andrii Nakryiko

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