summaryrefslogtreecommitdiffstats
path: root/kernel/bpf/syscall.c
diff options
context:
space:
mode:
authorMartin KaFai Lau <martin.lau@kernel.org>2023-06-02 16:22:13 -0700
committerMartin KaFai Lau <martin.lau@kernel.org>2023-06-02 17:04:25 -0700
commit23509e92cf13ed22c17d160efac7d0f0602d0bcb (patch)
tree36f99c6b5dc4e6de25c5bd4882fee04eb6fe82b4 /kernel/bpf/syscall.c
parentb0fd1852bcc21accca6260ef245356d5c141ff66 (diff)
parent1022b67b89ce5b92906fec6447f02acf6ba018e4 (diff)
downloadlinux-23509e92cf13ed22c17d160efac7d0f0602d0bcb.tar.gz
linux-23509e92cf13ed22c17d160efac7d0f0602d0bcb.tar.bz2
linux-23509e92cf13ed22c17d160efac7d0f0602d0bcb.zip
Merge branch 'Fix elem_size not being set for inner maps'
Rhys Rustad-Elliott says: ==================== Commit d937bc3449fa ("bpf: make uniform use of array->elem_size everywhere in arraymap.c") changed array_map_gen_lookup to use array->elem_size instead of round_up(map->value_size, 8) as the element size when generating code to access a value in an array map. array->elem_size, however, is not set by bpf_map_meta_alloc when initializing an BPF_MAP_TYPE_ARRAY_OF_MAPS or BPF_MAP_TYPE_HASH_OF_MAPS. This results in array_map_gen_lookup incorrectly outputting code that always accesses index 0 in the array (as the index will be calculated via a multiplication with the element size, which is incorrectly set to 0). This patchset sets elem_size on the bpf_array object when allocating an array or hash of maps to fix this and adds a selftest that accesses an array map nested within a hash of maps at a nonzero index to prevent regressions. v1: https://lore.kernel.org/bpf/95b5da7c-ee52-3ecb-0a4e-f6a7a114f269@linux.dev/ Changelog: v1 -> v2: Address comments by Martin KaFai Lau: - Directly use inner_array->elem_size instead of using round_up - Move selftests to a new patch - Use ASSERT_* macros instead of CHECK and remove duration - Remove unnecessary usleep - Shorten selftest name ==================== Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Diffstat (limited to 'kernel/bpf/syscall.c')
0 files changed, 0 insertions, 0 deletions