]> 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)
commit080d9ed36053fe4f320ebde00b4364799b737b9c
treeeaa5f5849390692a575aa95280313f41b5475ebe
parent931b2d5aa4204b207a8ba5fabf7518d990589800
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 15d9bb42246c ("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: ff79e1613098 ("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