]> git.baikalelectronics.ru Git - kernel.git/commit
bpf, arm64: fix getting subprog addr from aux for calls
authorDaniel Borkmann <daniel@iogearbox.net>
Mon, 26 Nov 2018 13:05:39 +0000 (14:05 +0100)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 27 Nov 2018 01:34:24 +0000 (17:34 -0800)
commitac882ba6e60bfe10eb6a1c4105d70613275168da
treeeaa5f5849390692a575aa95280313f41b5475ebe
parent620d05afb19f67c34721d25e59d4c0d26bf62700
bpf, arm64: fix getting subprog addr from aux for calls

The arm64 JIT has the same issue as ppc64 JIT in that the relative BPF
to BPF call offset can be too far away from core kernel in that relative
encoding into imm is not sufficient and could potentially be truncated,
see also 1b67fe5b3712 ("arm64: add support for module PLTs") which adds
spill-over space for module_alloc() and therefore bpf_jit_binary_alloc().
Therefore, use the recently added bpf_jit_get_func_addr() helper for
properly fetching the address through prog->aux->func[off]->bpf_func
instead. This also has the benefit to optimize normal helper calls since
their address can use the optimized emission. Tested on Cavium ThunderX
CN8890.

Fixes: 8e41f049c42c ("bpf: arm64: add JIT support for multi-function programs")
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
arch/arm64/net/bpf_jit_comp.c