diff options
| author | Guannan Wang <wgnbuaa@gmail.com> | 2026-05-14 15:44:54 +0800 |
|---|---|---|
| committer | Alexei Starovoitov <ast@kernel.org> | 2026-05-14 08:18:50 -0700 |
| commit | 593980175389a05793f6060aa20e626330960395 (patch) | |
| tree | 35a4bfb34d17e72b131c9fb87f7d9dbff0a8e954 /scripts/Makefile.vmlinux_o | |
| parent | d25e65a8b89725e9745bfc3acd738cdec3818a07 (diff) | |
bpf: Use array_map_meta_equal for percpu array inner map replacement
percpu_array_map_ops.map_meta_equal points to the generic
bpf_map_meta_equal(), which does not compare max_entries. When a
percpu array serves as an inner map, replacing it with one that has
fewer max_entries bypasses the check. Since percpu_array_map_gen_lookup()
inlines the original template's index_mask as a JIT immediate, a lookup
on the replacement map can access pptrs[] out of bounds.
Point percpu_array_map_ops.map_meta_equal to array_map_meta_equal(),
which already enforces the max_entries equality check.
Add a selftest to verify that replacing a percpu array inner map with
a differently-sized one is rejected.
Fixes: db69718b8efa ("bpf: inline bpf_map_lookup_elem() for PERCPU_ARRAY maps")
Signed-off-by: Guannan Wang <wgnbuaa@gmail.com>
Acked-by: Mykyta Yatsenko <yatsenko@meta.com>
Link: https://lore.kernel.org/r/20260514074454.77491-1-wgnbuaa@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'scripts/Makefile.vmlinux_o')
0 files changed, 0 insertions, 0 deletions
