BACKPORT: arm64/bpf: Remove 128MB limit for BPF JIT programs
(Backport: resolve conflicts due to missing f4693c27 and present d3578ba7, and also drop in_bpf_jit from fixup_exception the same way 5.15 backport 9c82ce59 does it.) Commit 91fc957c ("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: 91fc957c ("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 (cherry picked from commit b89ddf4c) Bug: 252919296 Bug: 269045366 Change-Id: Iec7d0b2bba001df94c2e21fcd5883ff002111cd5 Signed-off-by:
Andrey Konovalov <andreyknvl@google.com> (cherry picked from commit b901e6de)
Loading
Please sign in to comment