From: xulang <xulang@uniontech.com>
To: martin.lau@linux.dev
Cc: andrii@kernel.org, ast@kernel.org, bpf@vger.kernel.org,
daniel@iogearbox.net, dzm91@hust.edu.cn, eddyz87@gmail.com,
haoluo@google.com, ihor.solodrai@linux.dev,
john.fastabend@gmail.com, jolsa@kernel.org, kaiyanm@hust.edu.cn,
kernel@uniontech.com, kpsingh@kernel.org,
linux-kernel@vger.kernel.org, paul.chaignon@gmail.com,
sdf@fomichev.me, song@kernel.org, yonghong.song@linux.dev,
Lang Xu <xulang@uniontech.com>
Subject: [PATCH bpf v5 0/2] bpf: Fix OOB in pcpu_init_value and add a test
Date: Thu, 2 Apr 2026 15:39:48 +0800 [thread overview]
Message-ID: <7653EEEC2BAB17DF+20260402073948.2185396-1-xulang@uniontech.com> (raw)
From: Lang Xu <xulang@uniontech.com>
Fix OOB read when copying element from a BPF_MAP_TYPE_CGROUP_STORAGE
map to another pcpu map with the same value_size that is not rounded
up to 8 bytes, and add a test case to reproduce the issue.
The root cause is that pcpu_init_value() uses copy_map_value_long() which
rounds up the copy size to 8 bytes, but CGROUP_STORAGE map values are not
8-byte aligned (e.g., 4-byte). This causes a 4-byte OOB read when
the copy is performed.
Lang Xu (2):
bpf: Fix OOB in pcpu_init_value
selftests/bpf: Add test for cgroup storage OOB read
Signed-off-by: Lang Xu <xulang@uniontech.com>
---
Changes since v4:
- Make the summary phrase of the cover different from patch 1
- Fix patch series format issues
Changes since v3:
- nothing changed, just resend the patch series manually.
There is something wrong with my email server(Message-ID overrided).
Changes since v2:
- Fix patch series format issues
- Instead of aligning CGROUP_STORAGE allocation,
fix it by replacing copy_map_value_long with copy_map_value in
pcpu_init_value
Changes since v1:
- Add self-test program to reproduce the issue
base-commit: 7aaa8047eafd ("Linux 7.0-rc6")
kernel/bpf/hashtab.c | 2 +-
tools/testing/selftests/bpf/prog_tests/cgroup_storage.c | 42 +++++++++++++++++++++
tools/testing/selftests/bpf/progs/cgroup_storage.c | 43 ++++++++++++++++++++++
3 files changed, 86 insertions(+), 1 deletion(-)
--
2.51.0
next reply other threads:[~2026-04-02 7:40 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-02 7:39 xulang [this message]
2026-04-02 7:42 ` [PATCH bpf v5 1/2] bpf: Fix OOB in pcpu_init_value xulang
2026-04-02 14:17 ` Alexei Starovoitov
2026-04-02 17:01 ` Martin KaFai Lau
2026-04-02 18:36 ` Alexei Starovoitov
2026-04-02 19:58 ` Martin KaFai Lau
2026-04-03 0:05 ` Alexei Starovoitov
2026-04-03 1:59 ` Martin KaFai Lau
2026-04-03 2:09 ` Alexei Starovoitov
2026-04-03 2:24 ` Martin KaFai Lau
2026-04-03 2:28 ` Alexei Starovoitov
2026-04-03 2:41 ` Martin KaFai Lau
2026-04-03 2:46 ` Alexei Starovoitov
2026-04-02 7:42 ` [PATCH bpf v5 2/2] selftests/bpf: Add test for cgroup storage OOB read xulang
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=7653EEEC2BAB17DF+20260402073948.2185396-1-xulang@uniontech.com \
--to=xulang@uniontech.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=dzm91@hust.edu.cn \
--cc=eddyz87@gmail.com \
--cc=haoluo@google.com \
--cc=ihor.solodrai@linux.dev \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kaiyanm@hust.edu.cn \
--cc=kernel@uniontech.com \
--cc=kpsingh@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=paul.chaignon@gmail.com \
--cc=sdf@fomichev.me \
--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
all inboxes | Powered by JetHome®