BPF List
 help / color / mirror / Atom feed
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 v2 0/2] bpf: fix accesses to uninit stack slots
Date: Sat, 25 Nov 2023 20:50:44 -0500	[thread overview]
Message-ID: <20231126015045.1092826-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.

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


             reply	other threads:[~2023-11-26  1:53 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-26  1:50 Andrei Matei [this message]
2023-11-26  1:50 ` [PATCH bpf v2 1/2] bpf: fix accesses to uninit stack slots 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

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=20231126015045.1092826-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