]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: remove obsolete KMALLOC_MAX_SIZE restriction on array map value size
authorAndrii Nakryiko <andrii@kernel.org>
Fri, 15 Jul 2022 05:31:45 +0000 (22:31 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 19 Jul 2022 16:45:34 +0000 (09:45 -0700)
commit3ce4e28c6cab1cb4cb8eb1097b1076569328a00d
treeb810c32be46424de50c195fe408befb3fda9502d
parent95adc920176cbfabdaf1dec613eadcc816996705
bpf: remove obsolete KMALLOC_MAX_SIZE restriction on array map value size

Syscall-side map_lookup_elem() and map_update_elem() used to use
kmalloc() to allocate temporary buffers of value_size, so
KMALLOC_MAX_SIZE limit on value_size made sense to prevent creation of
array map that won't be accessible through syscall interface.

But this limitation since has been lifted by relying on kvmalloc() in
syscall handling code. So remove KMALLOC_MAX_SIZE, which among other
things means that it's possible to have BPF global variable sections
(.bss, .data, .rodata) bigger than 8MB now. Keep the sanity check to
prevent trivial overflows like round_up(map->value_size, 8) and restrict
value size to <= INT_MAX (2GB).

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/r/20220715053146.1291891-4-andrii@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
kernel/bpf/arraymap.c