diff options
| author | Donggeun Yoo <donggeunyoo.kernel@gmail.com> | 2026-09-24 19:23:20 +0900 |
|---|---|---|
| committer | Alexei Starovoitov <ast@kernel.org> | 2026-09-24 14:24:51 +0000 |
| commit | c3a66e5f5bab3912e9f84223c5a982bf4333d5a1 (patch) | |
| tree | 222763680363d57135022bf60c6df0bef44def13 /tools/perf/tests/shell/test_stackcollapse_python.sh | |
| parent | 8110ba09777873443db286b3cbb89b0e6311c554 (diff) | |
| download | linux-next-c3a66e5f5bab3912e9f84223c5a982bf4333d5a1.tar.gz linux-next-c3a66e5f5bab3912e9f84223c5a982bf4333d5a1.zip | |
bpf: Zero-fill other CPUs when BPF_F_CPU creates a per-cpu hash element
pcpu_init_value() initializes the per-cpu area of a newly created
[lru_]percpu_hash element. The area is recycled, so when the value
comes from a BPF program (onallcpus == false) it writes the running
CPU's slot and zeroes the rest.
bpf_percpu_hash_update() passes onallcpus == true, which delegates to
pcpu_copy_value(). pcpu_copy_value() writes only the CPU named in
map_flags when BPF_F_CPU is set, so on the create path the other slots
keep the recycled element's values:
update(k1, 0xdeadc0de, BPF_F_ALL_CPUS) every CPU holds 0xdeadc0de
delete(k1) element back on the freelist
update(k2, 0xc0ffee, BPF_F_CPU | 0) creates, writes CPU 0 only
lookup(k2) CPU 0 0xc0ffee, rest 0xdeadc0de
Zero-fill the other CPUs on that arm too.
Fixes: c6936161fd55 ("bpf: Add BPF_F_CPU and BPF_F_ALL_CPUS flags support for percpu_hash and lru_percpu_hash maps")
Signed-off-by: Donggeun Yoo <donggeunyoo.kernel@gmail.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20260924102321.2120434-2-donggeunyoo.kernel@gmail.com
Diffstat (limited to 'tools/perf/tests/shell/test_stackcollapse_python.sh')
0 files changed, 0 insertions, 0 deletions
