linux/arch
Aijun Sun 19f68ed6dc bpf, arm64: Allocate program buffer using kvcalloc instead of kcalloc
It is not necessary to allocate contiguous physical memory for BPF
program buffer using kcalloc. When the BPF program is large more than
memory page size, kcalloc allocates multiple memory pages from buddy
system. If the device can not provide sufficient memory, for example
in low-end android devices [0], memory allocation for BPF program is
likely to fail.

Test cases in lib/test_bpf.c all pass on ARM64 QEMU.

[0]
  AndroidTestSuit: page allocation failure: order:4,
  mode:0x40dc0(GFP_KERNEL|__GFP_COMP|__GFP_ZERO), nodemask=(null),cpuset=foreground,mems_allowed=0
  Call trace:
   dump_stack+0xa4/0x114
   warn_alloc+0xf8/0x14c
   __alloc_pages_slowpath+0xac8/0xb14
   __alloc_pages_nodemask+0x194/0x3d0
   kmalloc_order_trace+0x44/0x1e8
   __kmalloc+0x29c/0x66c
   bpf_int_jit_compile+0x17c/0x568
   bpf_prog_select_runtime+0x4c/0x1b0
   bpf_prepare_filter+0x5fc/0x6bc
   bpf_prog_create_from_user+0x118/0x1c0
   seccomp_set_mode_filter+0x1c4/0x7cc
   __do_sys_prctl+0x380/0x1424
   __arm64_sys_prctl+0x20/0x2c
   el0_svc_common+0xc8/0x22c
   el0_svc_handler+0x1c/0x28
   el0_svc+0x8/0x100

Signed-off-by: Aijun Sun <aijun.sun@unisoc.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20220804025442.22524-1-aijun.sun@unisoc.com
2022-08-08 16:42:43 +02:00
..
alpha genirq: Add and use an irq_data_update_affinity helper 2022-07-07 09:38:04 +01:00
arc jump_label: make initial NOP patching the special case 2022-06-24 09:48:55 +02:00
arm Networking changes for 6.0. 2022-08-03 16:29:08 -07:00
arm64 bpf, arm64: Allocate program buffer using kvcalloc instead of kcalloc 2022-08-08 16:42:43 +02:00
csky RCU pull request for v5.20 (or whatever) 2022-08-02 19:12:45 -07:00
hexagon
ia64 EFI efivars sysfs interface removal 2022-08-03 14:41:36 -07:00
loongarch EFI updates for v5.20 2022-08-03 14:38:02 -07:00
m68k flexible-array transformations in UAPI for 6.0-rc1 2022-08-02 19:50:47 -07:00
microblaze This set of changes updates init and user mode helper tasks to be 2022-06-03 16:03:05 -07:00
mips flexible-array transformations in UAPI for 6.0-rc1 2022-08-02 19:50:47 -07:00
nios2 This set of changes updates init and user mode helper tasks to be 2022-06-03 16:03:05 -07:00
openrisc openrisc: unwinder: Fix grammar issue in comment 2022-06-28 17:31:24 +09:00
parisc for-5.20-tag 2022-08-03 14:54:52 -07:00
powerpc iov_iter work, part 1 - isolated cleanups and optimizations. 2022-08-03 13:50:22 -07:00
riscv Networking changes for 6.0. 2022-08-03 16:29:08 -07:00
s390 iov_iter work, part 1 - isolated cleanups and optimizations. 2022-08-03 13:50:22 -07:00
sh ARM: SoC defconfig updates for 6.0 2022-08-02 08:21:58 -07:00
sparc RCU pull request for v5.20 (or whatever) 2022-08-02 19:12:45 -07:00
um Random number generator updates for Linux 6.0-rc1. 2022-08-02 17:31:35 -07:00
x86 Networking changes for 6.0. 2022-08-03 16:29:08 -07:00
xtensa RCU pull request for v5.20 (or whatever) 2022-08-02 19:12:45 -07:00
.gitignore
Kconfig RCU pull request for v5.20 (or whatever) 2022-08-02 19:12:45 -07:00