diff options
author | Daniel Xu <dxu@dxuuu.xyz> | 2025-02-04 20:25:16 +0300 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2025-02-08 02:45:43 +0300 |
commit | 884c3a18dadfda326dffa364477cc027728219de (patch) | |
tree | a9e30069042f2eb97c2f2c4f802408f0aa2ac3d4 /scripts/generate_rust_analyzer.py | |
parent | 517e8a7835e8cfb398a0aeb0133de50e31cae32b (diff) | |
download | linux-884c3a18dadfda326dffa364477cc027728219de.tar.xz |
bpf: verifier: Do not extract constant map keys for irrelevant maps
Previously, we were trying to extract constant map keys for all
bpf_map_lookup_elem(), regardless of map type. This is an issue if the
map has a u64 key and the value is very high, as it can be interpreted
as a negative signed value. This in turn is treated as an error value by
check_func_arg() which causes a valid program to be incorrectly
rejected.
Fix by only extracting constant map keys for relevant maps. This fix
works because nullness elision is only allowed for {PERCPU_}ARRAY maps,
and keys for these are within u32 range. See next commit for an example
via selftest.
Acked-by: Eduard Zingerman <eddyz87@gmail.com>
Reported-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reported-by: Ilya Leoshkevich <iii@linux.ibm.com>
Tested-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Signed-off-by: Daniel Xu <dxu@dxuuu.xyz>
Link: https://lore.kernel.org/r/aa868b642b026ff87ba6105ea151bc8693b35932.1738689872.git.dxu@dxuuu.xyz
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'scripts/generate_rust_analyzer.py')
0 files changed, 0 insertions, 0 deletions