From: Yiyang Chen <chenyy23@mails.tsinghua.edu.cn>
To: Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>,
Eduard Zingerman <eddyz87@gmail.com>,
Kumar Kartikeya Dwivedi <memxor@gmail.com>
Cc: Yiyang Chen <chenyy23@mails.tsinghua.edu.cn>,
John Fastabend <john.fastabend@gmail.com>,
Martin KaFai Lau <martin.lau@linux.dev>,
Song Liu <song@kernel.org>,
Yonghong Song <yonghong.song@linux.dev>,
Jiri Olsa <jolsa@kernel.org>, Shuah Khan <shuah@kernel.org>,
Emil Tsalapatis <emil@etsalapatis.com>,
bpf@vger.kernel.org, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [bpf-next v2 0/2] bpf: Preserve stack frame number for commuted arithmetic
Date: Tue, 21 Jul 2026 09:39:41 +0000 [thread overview]
Message-ID: <cover.1784563950.git.chenyy23@mails.tsinghua.edu.cn> (raw)
The verifier uses reg->frameno to distinguish stack pointers that have
the same offset but refer to different call frames. The scalar += pointer
path copies pointer type and id to the destination register, but it also
needs to preserve pointer provenance fields such as the stack frame
number.
Preserve the full pointer register state for commuted stack pointer
arithmetic and add a verifier regression test where a callee derives its
frame pointer through scalar += fp before overwriting and reloading the
same stack slot.
Changes in v2:
- Preserve the full pointer register state instead of copying only
selected fields, as suggested by Eduard.
- Use a temporary scalar offset register for the commuted scalar += fp
case, as suggested by Eduard.
- Add a Fixes tag to the verifier change.
- Drop CAP_SYS_ADMIN handling from the new verifier_basic_stack harness,
as requested by Eduard.
Yiyang Chen (2):
bpf: Preserve stack frame number for commuted arithmetic
selftests/bpf: Cover stack frame number after scalar plus fp
kernel/bpf/verifier.c | 14 +++++++-----
.../selftests/bpf/prog_tests/verifier.c | 2 -
.../bpf/prog_tests/verifier_basic_stack.c | 14 ++++++++
.../bpf/progs/verifier_basic_stack.c | 41 +++++++++++++++++++
4 files changed, 64 insertions(+), 10 deletions(-)
create mode 100644 tools/testing/selftests/bpf/prog_tests/verifier_basic_stack.c
base-commit: 0bcca2a42cc50b7d64a95c08dffc6b93661a7ea2
--
2.34.1
next reply other threads:[~2026-07-21 9:40 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-21 9:39 Yiyang Chen [this message]
2026-07-21 9:39 ` [PATCH 1/2] bpf: Preserve stack frame number for commuted arithmetic Yiyang Chen
2026-07-21 9:48 ` sashiko-bot
2026-07-22 7:44 ` Shung-Hsi Yu
2026-07-22 0:12 ` Eduard Zingerman
2026-07-22 8:46 ` Shung-Hsi Yu
2026-07-21 9:39 ` [PATCH 2/2] selftests/bpf: Cover stack frame number after scalar plus fp Yiyang Chen
2026-07-21 10:29 ` bot+bpf-ci
2026-07-21 23:53 ` Eduard Zingerman
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=cover.1784563950.git.chenyy23@mails.tsinghua.edu.cn \
--to=chenyy23@mails.tsinghua.edu.cn \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=emil@etsalapatis.com \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=memxor@gmail.com \
--cc=shuah@kernel.org \
--cc=song@kernel.org \
--cc=yonghong.song@linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.