From: Ilya Leoshkevich <iii@linux.ibm.com>
To: Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>
Cc: bpf@vger.kernel.org, Heiko Carstens <hca@linux.ibm.com>,
Vasily Gorbik <gor@linux.ibm.com>,
Alexander Gordeev <agordeev@linux.ibm.com>,
Ilya Leoshkevich <iii@linux.ibm.com>
Subject: [PATCH bpf-next v3 2/8] s390/bpf: Add expoline to tail calls
Date: Sun, 29 Jan 2023 20:04:55 +0100 [thread overview]
Message-ID: <20230129190501.1624747-3-iii@linux.ibm.com> (raw)
In-Reply-To: <20230129190501.1624747-1-iii@linux.ibm.com>
All the indirect jumps in the eBPF JIT already use expolines, except
for the tail call one.
Fixes: de5cb6eb514e ("s390: use expoline thunks in the BPF JIT")
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
---
arch/s390/net/bpf_jit_comp.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/arch/s390/net/bpf_jit_comp.c b/arch/s390/net/bpf_jit_comp.c
index eb1a78c0e6a8..8400a06c926e 100644
--- a/arch/s390/net/bpf_jit_comp.c
+++ b/arch/s390/net/bpf_jit_comp.c
@@ -1393,8 +1393,16 @@ static noinline int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp,
/* lg %r1,bpf_func(%r1) */
EMIT6_DISP_LH(0xe3000000, 0x0004, REG_1, REG_1, REG_0,
offsetof(struct bpf_prog, bpf_func));
- /* bc 0xf,tail_call_start(%r1) */
- _EMIT4(0x47f01000 + jit->tail_call_start);
+ if (nospec_uses_trampoline()) {
+ jit->seen |= SEEN_FUNC;
+ /* aghi %r1,tail_call_start */
+ EMIT4_IMM(0xa70b0000, REG_1, jit->tail_call_start);
+ /* brcl 0xf,__s390_indirect_jump_r1 */
+ EMIT6_PCREL_RILC(0xc0040000, 0xf, jit->r1_thunk_ip);
+ } else {
+ /* bc 0xf,tail_call_start(%r1) */
+ _EMIT4(0x47f01000 + jit->tail_call_start);
+ }
/* out: */
if (jit->prg_buf) {
*(u16 *)(jit->prg_buf + patch_1_clrj + 2) =
--
2.39.1
next prev parent reply other threads:[~2023-01-29 19:05 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-29 19:04 [PATCH bpf-next v3 0/8] Support bpf trampoline for s390x Ilya Leoshkevich
2023-01-29 19:04 ` [PATCH bpf-next v3 1/8] selftests/bpf: Fix sk_assign on s390x Ilya Leoshkevich
2023-01-29 19:04 ` Ilya Leoshkevich [this message]
2023-01-29 19:04 ` [PATCH bpf-next v3 3/8] s390/bpf: Implement bpf_arch_text_poke() Ilya Leoshkevich
2023-01-29 19:04 ` [PATCH bpf-next v3 4/8] s390/bpf: Implement arch_prepare_bpf_trampoline() Ilya Leoshkevich
2023-01-29 19:04 ` [PATCH bpf-next v3 5/8] s390/bpf: Implement bpf_jit_supports_subprog_tailcalls() Ilya Leoshkevich
2023-01-29 19:04 ` [PATCH bpf-next v3 6/8] s390/bpf: Implement bpf_jit_supports_kfunc_call() Ilya Leoshkevich
2023-01-29 19:05 ` [PATCH bpf-next v3 7/8] selftests/bpf: Fix s390x vmlinux path Ilya Leoshkevich
2023-01-29 19:05 ` [PATCH bpf-next v3 8/8] selftests/bpf: Trim DENYLIST.s390x Ilya Leoshkevich
2023-01-30 3:28 ` [PATCH bpf-next v3 0/8] Support bpf trampoline for s390x Alexei Starovoitov
2023-01-30 18:56 ` [PATCH bpf-next v3 0/8] Support bpf trampoline for s390x - CI issue Ilya Leoshkevich
2023-01-31 3:13 ` Alexei Starovoitov
2023-01-31 13:36 ` Ilya Leoshkevich
2023-02-02 18:29 ` Joanne Koong
2023-01-30 3:30 ` [PATCH bpf-next v3 0/8] Support bpf trampoline for s390x patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230129190501.1624747-3-iii@linux.ibm.com \
--to=iii@linux.ibm.com \
--cc=agordeev@linux.ibm.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox