linux-stable/kernel/bpf
Rik van Riel 44d3e3d864 bpf: use kvzmalloc to allocate BPF verifier environment
[ Upstream commit 434247637c ]

The kzmalloc call in bpf_check can fail when memory is very fragmented,
which in turn can lead to an OOM kill.

Use kvzmalloc to fall back to vmalloc when memory is too fragmented to
allocate an order 3 sized bpf verifier environment.

Admittedly this is not a very common case, and only happens on systems
where memory has already been squeezed close to the limit, but this does
not seem like much of a hot path, and it's a simple enough fix.

Signed-off-by: Rik van Riel <riel@surriel.com>
Reviewed-by: Shakeel Butt <shakeel.butt@linux.dev>
Link: https://lore.kernel.org/r/20241008170735.16766766@imladris.surriel.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-17 14:58:08 +01:00
..
arraymap.c bpf: Check percpu map value size first 2024-11-08 16:19:16 +01:00
bpf_lru_list.c bpf: Address KCSAN report on bpf_lru_list 2023-08-11 11:45:25 +02:00
bpf_lru_list.h bpf: Address KCSAN report on bpf_lru_list 2023-08-11 11:45:25 +02:00
btf.c bpf: btf: fix truncated last_member_type_id in btf_struct_resolve 2022-10-26 13:19:25 +02:00
cgroup.c bpf: introduce update_effective_progs() 2018-08-07 14:29:55 +02:00
core.c bpf: Adjust insufficient default bpf_jit_limit 2023-04-05 11:15:34 +02:00
cpumap.c cpumap: Avoid warning when CONFIG_DEBUG_PER_CPU_MAPS is enabled 2020-05-02 17:25:53 +02:00
devmap.c bpf: devmap: fix wrong interface selection in notifier_call 2019-12-01 09:17:01 +01:00
disasm.c bpf: Introduce BPF nospec instruction for mitigating Spectre v4 2021-09-22 11:47:58 +02:00
disasm.h bpf: Remove struct bpf_verifier_env argument from print_bpf_insn 2018-03-23 17:38:57 +01:00
hashtab.c bpf: Check percpu map value size first 2024-11-08 16:19:16 +01:00
helpers.c bpf: introduce the bpf_get_local_storage() helper function 2018-08-03 00:47:32 +02:00
inode.c bpf: Fix a rcu warning for bpffs map pretty-print 2020-10-01 13:14:52 +02:00
local_storage.c bpf: allocate local storage buffers using GFP_ATOMIC 2018-12-17 09:24:33 +01:00
lpm_trie.c bpf: Fix out-of-bounds write in trie_get_next_key() 2024-11-08 16:19:22 +01:00
Makefile bpf: silence warning messages in core 2019-07-26 09:14:06 +02:00
map_in_map.c bpf: Add map and need_defer parameters to .map_fd_put_ptr() 2024-02-23 08:12:46 +01:00
map_in_map.h bpf: Add map and need_defer parameters to .map_fd_put_ptr() 2024-02-23 08:12:46 +01:00
offload.c bpf, offload: Replace bitwise AND by logical AND in bpf_prog_offload_info_fill 2020-02-28 16:38:59 +01:00
percpu_freelist.c bpf: fix lockdep false positive in percpu_freelist 2019-03-13 14:02:36 -07:00
percpu_freelist.h bpf: fix lockdep false positive in percpu_freelist 2019-03-13 14:02:36 -07:00
reuseport_array.c bpf: Introduce BPF_MAP_TYPE_REUSEPORT_SOCKARRAY 2018-08-11 01:58:46 +02:00
sockmap.c bpf: sockmap, fix transition through disconnect without close 2018-09-22 02:46:41 +02:00
stackmap.c bpf: Fix stackmap overflow check on 32-bit arches 2024-03-26 18:22:36 -04:00
syscall.c bpf: Ensure correct locking around vulnerable function find_vpid() 2022-10-26 13:19:25 +02:00
tnum.c bpf: Fix incorrect verifier simulation of ARSH under ALU32 2020-01-23 08:21:32 +01:00
verifier.c bpf: use kvzmalloc to allocate BPF verifier environment 2024-11-17 14:58:08 +01:00
xskmap.c xsk: do not call synchronize_net() under RCU read lock 2018-10-11 10:19:01 +02:00