Skip to content
  • Daniel Borkmann's avatar
    bpf, arm64: fix getting subprog addr from aux for calls · 8c11ea5c
    Daniel Borkmann authored
    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 fd045f6c ("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: db496944
    
     ("bpf: arm64: add JIT support for multi-function programs")
    Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
    Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
    8c11ea5c