From: Qi Tang <tpluszz77@gmail.com>
To: Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>
Cc: Eduard Zingerman <eddyz87@gmail.com>,
Andrii Nakryiko <andrii@kernel.org>,
Martin KaFai Lau <martin.lau@linux.dev>,
John Fastabend <john.fastabend@gmail.com>,
Song Liu <song@kernel.org>,
bpf@vger.kernel.org, Qi Tang <tpluszz77@gmail.com>
Subject: [PATCH bpf v3 0/2] bpf: reject direct access to nullable PTR_TO_BUF pointers
Date: Thu, 2 Apr 2026 17:29:21 +0800 [thread overview]
Message-ID: <20260402092923.38357-1-tpluszz77@gmail.com> (raw)
check_mem_access() allows direct dereference of PTR_TO_BUF |
PTR_MAYBE_NULL without a null check, causing kernel NULL dereference
on map iterator stop callbacks.
Patch 1 adds the missing type_may_be_null() guard.
Patch 2 adds a selftest.
Changes in v3:
- Drop stack trace from commit log
- Split kernel fix and selftest into separate patches
- Use [PATCH bpf] prefix
Changes in v2:
- Add selftest
Link: https://lore.kernel.org/all/20260401142316.2452-1-tpluszz77@gmail.com/ (v2)
Link: https://lore.kernel.org/all/20260331172720.29938-1-tpluszz77@gmail.com/ (v1)
Qi Tang (2):
bpf: reject direct access to nullable PTR_TO_BUF pointers
selftests/bpf: add test for nullable PTR_TO_BUF access
kernel/bpf/verifier.c | 3 ++-
tools/testing/selftests/bpf/progs/iter_buf_null_fail.c | 51 +++++++++++++++++
2 files changed, 53 insertions(+), 1 deletion(-)
create mode 100644 tools/testing/selftests/bpf/progs/iter_buf_null_fail.c
next reply other threads:[~2026-04-02 9:29 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-02 9:29 Qi Tang [this message]
2026-04-02 9:29 ` [PATCH bpf v3 1/2] bpf: reject direct access to nullable PTR_TO_BUF pointers Qi Tang
2026-04-02 16:40 ` Kumar Kartikeya Dwivedi
2026-04-02 9:29 ` [PATCH bpf v3 2/2] selftests/bpf: add test for nullable PTR_TO_BUF access Qi Tang
2026-04-02 16:43 ` Kumar Kartikeya Dwivedi
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=20260402092923.38357-1-tpluszz77@gmail.com \
--to=tpluszz77@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=john.fastabend@gmail.com \
--cc=martin.lau@linux.dev \
--cc=song@kernel.org \
/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