summaryrefslogtreecommitdiff
path: root/rust/kernel/ptr/git@git.tavy.me:linux.git
diff options
context:
space:
mode:
authorLang Xu <xulang@uniontech.com>2026-04-02 15:42:35 +0800
committerAlexei Starovoitov <ast@kernel.org>2026-04-12 13:35:59 -0700
commit576afddfee8d1108ee299bf10f581593540d1a36 (patch)
treeee1f5747a5592810d34decee9371c022336eddb3 /rust/kernel/ptr/git@git.tavy.me:linux.git
parent7aaa8047eafd0bd628065b15757d9b48c5f9c07d (diff)
bpf: Fix OOB in pcpu_init_value
An out-of-bounds read occurs 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. The issue happens when: 1. A CGROUP_STORAGE map is created with value_size not aligned to 8 bytes (e.g., 4 bytes) 2. A pcpu map is created with the same value_size (e.g., 4 bytes) 3. Update element in 2 with data in 1 pcpu_init_value assumes that all sources are rounded up to 8 bytes, and invokes copy_map_value_long to make a data copy, However, the assumption doesn't stand since there are some cases where the source may not be rounded up to 8 bytes, e.g., CGROUP_STORAGE, skb->data. the verifier verifies exactly the size that the source claims, not the size rounded up to 8 bytes by kernel, an OOB happens when the source has only 4 bytes while the copy size(4) is rounded up to 8. Fixes: d3bec0138bfb ("bpf: Zero-fill re-used per-cpu map element") Reported-by: Kaiyan Mei <kaiyanm@hust.edu.cn> Closes: https://lore.kernel.org/all/14e6c70c.6c121.19c0399d948.Coremail.kaiyanm@hust.edu.cn/ Link: https://lore.kernel.org/r/420FEEDDC768A4BE+20260402074236.2187154-1-xulang@uniontech.com Signed-off-by: Lang Xu <xulang@uniontech.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'rust/kernel/ptr/git@git.tavy.me:linux.git')
0 files changed, 0 insertions, 0 deletions