Skip to content

Commit bb4ef8f

Browse files
iii-iAlexei Starovoitov
authored andcommitted
s390/bpf: Add expoline to tail calls
All the indirect jumps in the eBPF JIT already use expolines, except for the tail call one. Fixes: de5cb6e ("s390: use expoline thunks in the BPF JIT") Signed-off-by: Ilya Leoshkevich <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexei Starovoitov <[email protected]>
1 parent 7ce878c commit bb4ef8f

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

arch/s390/net/bpf_jit_comp.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1393,8 +1393,16 @@ static noinline int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp,
13931393
/* lg %r1,bpf_func(%r1) */
13941394
EMIT6_DISP_LH(0xe3000000, 0x0004, REG_1, REG_1, REG_0,
13951395
offsetof(struct bpf_prog, bpf_func));
1396-
/* bc 0xf,tail_call_start(%r1) */
1397-
_EMIT4(0x47f01000 + jit->tail_call_start);
1396+
if (nospec_uses_trampoline()) {
1397+
jit->seen |= SEEN_FUNC;
1398+
/* aghi %r1,tail_call_start */
1399+
EMIT4_IMM(0xa70b0000, REG_1, jit->tail_call_start);
1400+
/* brcl 0xf,__s390_indirect_jump_r1 */
1401+
EMIT6_PCREL_RILC(0xc0040000, 0xf, jit->r1_thunk_ip);
1402+
} else {
1403+
/* bc 0xf,tail_call_start(%r1) */
1404+
_EMIT4(0x47f01000 + jit->tail_call_start);
1405+
}
13981406
/* out: */
13991407
if (jit->prg_buf) {
14001408
*(u16 *)(jit->prg_buf + patch_1_clrj + 2) =

0 commit comments

Comments
 (0)