]> git.baikalelectronics.ru Git - kernel.git/commit
arm64/bpf: Remove 128MB limit for BPF JIT programs
authorRussell King <russell.king@oracle.com>
Fri, 5 Nov 2021 16:50:45 +0000 (16:50 +0000)
committerDaniel Borkmann <daniel@iogearbox.net>
Mon, 8 Nov 2021 21:16:26 +0000 (22:16 +0100)
commit2adc3f60050b59ef6be5b71989e70f1abaa30ed0
treed8f7c34876d83786477b7ae84adbc8b1d0b3eaa3
parent9b953b240ab01d630cd4ea2daac2939664ddf24d
arm64/bpf: Remove 128MB limit for BPF JIT programs

Commit 68f1d69d70cb ("arm64/bpf: don't allocate BPF JIT programs in module
memory") restricts BPF JIT program allocation to a 128MB region to ensure
BPF programs are still in branching range of each other. However this
restriction should not apply to the aarch64 JIT, since BPF_JMP | BPF_CALL
are implemented as a 64-bit move into a register and then a BLR instruction -
which has the effect of being able to call anything without proximity
limitation.

The practical reason to relax this restriction on JIT memory is that 128MB of
JIT memory can be quickly exhausted, especially where PAGE_SIZE is 64KB - one
page is needed per program. In cases where seccomp filters are applied to
multiple VMs on VM launch - such filters are classic BPF but converted to
BPF - this can severely limit the number of VMs that can be launched. In a
world where we support BPF JIT always on, turning off the JIT isn't always an
option either.

Fixes: 68f1d69d70cb ("arm64/bpf: don't allocate BPF JIT programs in module memory")
Suggested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Russell King <russell.king@oracle.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Tested-by: Alan Maguire <alan.maguire@oracle.com>
Link: https://lore.kernel.org/bpf/1636131046-5982-2-git-send-email-alan.maguire@oracle.com
arch/arm64/include/asm/extable.h
arch/arm64/include/asm/memory.h
arch/arm64/kernel/traps.c
arch/arm64/mm/ptdump.c
arch/arm64/net/bpf_jit_comp.c