From: Sun Jian <sun.jian.kdev@gmail.com>
To: bpf@vger.kernel.org
Cc: ast@kernel.org, daniel@iogearbox.net, john.fastabend@gmail.com,
andrii@kernel.org, eddyz87@gmail.com, memxor@gmail.com,
martin.lau@linux.dev, song@kernel.org, yonghong.song@linux.dev,
jolsa@kernel.org, emil@etsalapatis.com, shuah@kernel.org,
mmullins@fb.com, linux-kernel@vger.kernel.org,
linux-kselftest@vger.kernel.org,
Sun Jian <sun.jian.kdev@gmail.com>
Subject: [PATCH bpf v2 0/2] bpf: Reject negative const offsets for buffer pointers
Date: Mon, 6 Jul 2026 23:08:02 -0700 [thread overview]
Message-ID: <20260707060804.93561-1-sun.jian.kdev@gmail.com> (raw)
Reject negative effective offsets for PTR_TO_TP_BUFFER and PTR_TO_BUF
buffer accesses, and add raw tracepoint writable coverage for both
load-time rejection and the attach-time max_tp_access path.
---
v1: https://lore.kernel.org/bpf/20260703035137.109608-1-sun.jian.kdev@gmail.com/
Changes in v2:
- Split the kernel fix and selftests into separate patches.
- Add attach-time raw tracepoint writable coverage for a negative
var_off whose effective offset stays non-negative. This exercises
the checked access_end accounting path and verifies that the
resulting max_tp_access is still checked against nbd_send_request's
writable size.
- Adjust selftest formatting to use the 100 character line width.
Tested:
- ./test_progs -t verifier_raw_tp_writable
- ./test_progs -t raw_tp_writable_reject_nbd_invalid -v
- ./test_progs -t raw_tp_writable_test_run
Sun Jian (2):
bpf: Reject negative const offsets for buffer pointers
selftests/bpf: Cover negative raw_tp writable buffer offsets
kernel/bpf/verifier.c | 40 +++++++++++--
.../raw_tp_writable_reject_nbd_invalid.c | 58 +++++++++++--------
.../bpf/progs/verifier_raw_tp_writable.c | 16 +++++
3 files changed, 85 insertions(+), 29 deletions(-)
base-commit: 12091470c6b4c1c14b2de12dcbae2ada6cb6d20b
--
2.43.0
next reply other threads:[~2026-07-07 6:08 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-07 6:08 Sun Jian [this message]
2026-07-07 6:08 ` [PATCH bpf v2 1/2] bpf: Reject negative const offsets for buffer pointers Sun Jian
2026-07-07 7:17 ` Shung-Hsi Yu
2026-07-07 8:38 ` sun jian
2026-07-07 6:08 ` [PATCH bpf v2 2/2] selftests/bpf: Cover negative raw_tp writable buffer offsets Sun Jian
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=20260707060804.93561-1-sun.jian.kdev@gmail.com \
--to=sun.jian.kdev@gmail.com \
--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=mmullins@fb.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox