From: Andrei Matei <andreimatei1@gmail.com>
To: bpf@vger.kernel.org, andrii.nakryiko@gmail.com
Cc: sunhao.th@gmail.com, eddyz87@gmail.com,
kernel-team@dataexmachina.dev,
Andrei Matei <andreimatei1@gmail.com>
Subject: [PATCH bpf v3 0/3] bpf: fix accesses to uninit stack slots
Date: Sat, 2 Dec 2023 18:05:55 -0500 [thread overview]
Message-ID: <20231202230558.1648708-1-andreimatei1@gmail.com> (raw)
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.
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 | 73 +++++++++----------
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, 113 insertions(+), 73 deletions(-)
--
2.40.1
next reply other threads:[~2023-12-02 23:06 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-02 23:05 Andrei Matei [this message]
2023-12-02 23:05 ` [PATCH bpf v3 1/3] bpf: add some comments to stack representation Andrei Matei
2023-12-04 18:18 ` Andrii Nakryiko
2023-12-04 18:25 ` Eduard Zingerman
2023-12-02 23:05 ` [PATCH bpf v3 2/3] bpf: fix accesses to uninit stack slots Andrei Matei
2023-12-02 23:09 ` Andrei Matei
2023-12-03 13:22 ` Eduard Zingerman
2023-12-04 18:19 ` Andrii Nakryiko
2023-12-02 23:05 ` [PATCH bpf v3 3/3] bpf: minor cleanup around stack bounds Andrei Matei
2023-12-04 18:19 ` Andrii Nakryiko
2023-12-04 18:43 ` Eduard Zingerman
2023-12-04 19:06 ` Andrii Nakryiko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231202230558.1648708-1-andreimatei1@gmail.com \
--to=andreimatei1@gmail.com \
--cc=andrii.nakryiko@gmail.com \
--cc=bpf@vger.kernel.org \
--cc=eddyz87@gmail.com \
--cc=kernel-team@dataexmachina.dev \
--cc=sunhao.th@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox