Skip to content
Commit 1c8f9b91 authored by Yauheni Kaliuta's avatar Yauheni Kaliuta Committed by Daniel Borkmann
Browse files

bpf: s390: add JIT support for multi-function programs

This adds support for bpf-to-bpf function calls in the s390 JIT
compiler. The JIT compiler converts the bpf call instructions to
native branch instructions. After a round of the usual passes, the
start addresses of the JITed images for the callee functions are
known. Finally, to fixup the branch target addresses, we need to
perform an extra pass.

Because of the address range in which JITed images are allocated on
s390, the offsets of the start addresses of these images from
__bpf_call_base are as large as 64 bits. So, for a function call,
the imm field of the instruction cannot be used to determine the
callee's address. Use bpf_jit_get_func_addr() helper instead.

The patch borrows a lot from:

commit 8c11ea5c ("bpf, arm64: fix getting subprog addr from aux
for calls")

commit e2c95a61 ("bpf, ppc64: generalize fetching subprog into
bpf_jit_get_func_addr")

commit 8484ce83

 ("bpf: powerpc64: add JIT support for
multi-function programs")

(including the commit message).

test_verifier (5.3-rc6 with CONFIG_BPF_JIT_ALWAYS_ON=y):

without patch:
Summary: 1501 PASSED, 0 SKIPPED, 47 FAILED

with patch:
Summary: 1540 PASSED, 0 SKIPPED, 8 FAILED

Signed-off-by: default avatarYauheni Kaliuta <yauheni.kaliuta@redhat.com>
Acked-by: default avatarIlya Leoshkevich <iii@linux.ibm.com>
Tested-by: default avatarIlya Leoshkevich <iii@linux.ibm.com>
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
parent 47ee6e86
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment