bpf: fix percpu map update indexing with sparse CPU IDs - #13274
Open
kernel-patches-daemon-bpf[bot] wants to merge 1 commit into
Open
bpf: fix percpu map update indexing with sparse CPU IDs#13274kernel-patches-daemon-bpf[bot] wants to merge 1 commit into
kernel-patches-daemon-bpf[bot] wants to merge 1 commit into
Conversation
Author
|
Upstream branch: a13307e |
kernel-patches-daemon-bpf
Bot
force-pushed
the
bpf_base
branch
from
August 14, 2026 17:17
b73246f to
98d32d5
Compare
Author
|
Upstream branch: a13307e |
kernel-patches-daemon-bpf
Bot
force-pushed
the
series/1145562=>bpf
branch
from
August 14, 2026 17:24
397a28a to
fa1c4aa
Compare
kernel-patches-daemon-bpf
Bot
force-pushed
the
bpf_base
branch
from
August 14, 2026 22:52
98d32d5 to
51ea595
Compare
Author
|
Upstream branch: a13307e |
kernel-patches-daemon-bpf
Bot
force-pushed
the
series/1145562=>bpf
branch
from
August 14, 2026 22:57
fa1c4aa to
ce3526c
Compare
kernel-patches-daemon-bpf
Bot
force-pushed
the
bpf_base
branch
from
August 15, 2026 00:50
51ea595 to
3083173
Compare
Author
|
Upstream branch: a13307e |
kernel-patches-daemon-bpf
Bot
force-pushed
the
series/1145562=>bpf
branch
from
August 15, 2026 00:55
ce3526c to
65827af
Compare
kernel-patches-daemon-bpf
Bot
force-pushed
the
bpf_base
branch
from
August 16, 2026 06:35
3083173 to
6d6454e
Compare
Per-CPU array, hash, and cgroup storage map updates without BPF_F_CPU or BPF_F_ALL_CPUS use a value buffer whose per-CPU slots are packed in possible-CPU order. The buffer is sized as: round_up(value_size, 8) * num_possible_cpus() The update paths iterate over possible CPUs, but use the logical CPU ID to calculate the source offset: value + size * cpu This only works when possible CPU IDs are contiguous starting at zero. For example, with a possible CPU mask of 0,2-3, the buffer contains three slots corresponding to CPUs 0, 2, and 3. CPU2 is therefore expected to use slot 1 and CPU3 slot 2. Instead, the current code uses slots 2 and 3 respectively, causing incorrect per-CPU values and an out-of-bounds read from the update buffer for CPU3. The corresponding lookup paths already use a dense offset while iterating over possible CPUs. Do the same for the array, hash, and cgroup storage update paths, advancing the source offset once for each possible CPU. BPF_F_ALL_CPUS continues to use the same value for every CPU. Fixes: 8eb76cb ("bpf: Add BPF_F_CPU and BPF_F_ALL_CPUS flags support for percpu_array maps") Fixes: c693616 ("bpf: Add BPF_F_CPU and BPF_F_ALL_CPUS flags support for percpu_hash and lru_percpu_hash maps") Fixes: 47c79f0 ("bpf: Add BPF_F_CPU and BPF_F_ALL_CPUS flags support for percpu_cgroup_storage maps") Acked-by: Leon Hwang <leon.hwang@linux.dev> Signed-off-by: Hui Su <sh_def@163.com>
Author
|
Upstream branch: a13307e |
kernel-patches-daemon-bpf
Bot
force-pushed
the
series/1145562=>bpf
branch
from
August 16, 2026 06:41
65827af to
5c1772a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull request for series with
subject: bpf: fix percpu map update indexing with sparse CPU IDs
version: 2
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=1145562