mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/
synced 2026-11-10 20:48:12 +00:00
bpf: Fix u32 overflow issue in map batch operations
Several map batch operation implementations such as generic_map_lookup_batch() use calculations in the form of "values + cp * map->value_size" to compute the desired userspace memory address for reading or writing. This can overflow the u32 type (the result of "cp * map->value_size") when the map size exceeds 4GB. generic_map_lookup_batch() may corrupt values for some keys in userspace memory, and in some cases it mismatches values for some keys while still reporting success. Other batch operations may fail to delete or update some keys, or the syscall may return unexpected errors. Add size_t casts to prevent the affected offset and size calculations from overflowing. Fixes:cb4d03ab49("bpf: Add generic support for lookup batch op") Fixes:aa2e93b8e5("bpf: Add generic support for update and delete batch ops") Fixes:057996380a("bpf: Add batch ops to all htab bpf map") Signed-off-by: Masoud Aghasi <maghasi@disroot.org> Link: https://lore.kernel.org/r/20260903082734.623904-1-maghasi@disroot.org Signed-off-by: Alexei Starovoitov <ast@kernel.org>
This commit is contained in:
parent
490a83d638
commit
953824e508
2 changed files with 9 additions and 9 deletions
Loading…
Add table
Add a link
Reference in a new issue