android_kernel_sony_sdm845/tools/testing
Repository files (latest commit first)
Filename Latest commit message Latest commit date
David Verbeiren af560e9b60 UPSTREAM: bpf: Zero-fill re-used per-cpu map element
[ Upstream commit d3bec0138bfbe58606fc1d6f57a4cdc1a20218db ]

Zero-fill element values for all other cpus than current, just as
when not using prealloc. This is the only way the bpf program can
ensure known initial values for all cpus ('onallcpus' cannot be
set when coming from the bpf program).

The scenario is: bpf program inserts some elements in a per-cpu
map, then deletes some (or userspace does). When later adding
new elements using bpf_map_update_elem(), the bpf program can
only set the value of the new elements for the current cpu.
When prealloc is enabled, previously deleted elements are re-used.
Without the fix, values for other cpus remain whatever they were
when the re-used entry was previously freed.

A selftest is added to validate correct operation in above
scenario as well as in case of LRU per-cpu map element re-use.

Fixes: 6c90598174 ("bpf: pre-allocate hash map elements")
Change-Id: I51fa789725ab02ee5eaf1c04bd8519135accf6a7
Signed-off-by: David Verbeiren <david.verbeiren@tessares.net>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20201104112332.15191-1-david.verbeiren@tessares.net
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Sorayukii <sorayukii69@gmail.com>
2026-05-15 17:58:12 +07:00
..
fault-injection
ktest ktest.pl minconfig: Unset configs instead of just removing them 2023-01-07 12:07:35 +01:00
nvdimm BACKPORT: treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 295 2026-05-15 17:57:45 +07:00
radix-tree radix-tree tests: properly initialize mutex 2016-10-11 15:06:30 -07:00
selftests UPSTREAM: bpf: Zero-fill re-used per-cpu map element 2026-05-15 17:58:12 +07:00