s390/bpf: Use kvcalloc for addrs array
authorIlya Leoshkevich <iii@linux.ibm.com>
Thu, 7 Nov 2019 14:18:38 +0000 (15:18 +0100)
committerDaniel Borkmann <daniel@iogearbox.net>
Thu, 7 Nov 2019 15:05:55 +0000 (16:05 +0100)
commit166f11d11f6f70439830d09bfa5552ec1b368494
tree1bcc6786b4e072ace1ec864d15fb1747cd822685
parent7e22077d0c73a68ff3fd8b3d2f6564fcbcf8cb23
s390/bpf: Use kvcalloc for addrs array

A BPF program may consist of 1m instructions, which means JIT
instruction-address mapping can be as large as 4m. s390 has
FORCE_MAX_ZONEORDER=9 (for memory hotplug reasons), which means maximum
kmalloc size is 1m. This makes it impossible to JIT programs with more
than 256k instructions.

Fix by using kvcalloc, which falls back to vmalloc for larger
allocations. An alternative would be to use a radix tree, but that is
not supported by bpf_prog_fill_jited_linfo.

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20191107141838.92202-1-iii@linux.ibm.com
arch/s390/net/bpf_jit_comp.c