Skip to content

Commit 9325d53

Browse files
author
Alexei Starovoitov
committed
Merge branch 's390-bpf-remove-the-orig_call-null-check'
Ilya Leoshkevich says: ==================== I've been looking at fixing the tailcall_bpf2bpf_hierarchy failures on s390. One of the challenges is that when a BPF trampoline calls a BPF prog A, the prologue of A sets the tail call count to 0. Therefore it would be useful to know whether the trampoline is attached to some other BPF prog B, in which case A should be called using an offset equal to tail_call_start, bypassing the tail call count initialization. The trampoline attachment point is passed to trampoline functions via the orig_call variable. Unfortunately in the case of calculating the size of a struct_ops trampoline it's NULL, and I could not think of a good reason to have it this way. This series makes it always non-NULL. ==================== Link: https://patch.msgid.link/[email protected] Signed-off-by: Alexei Starovoitov <[email protected]>
2 parents 5f55f21 + 8e57cf0 commit 9325d53

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

arch/s390/net/bpf_jit_comp.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2583,9 +2583,8 @@ static int __arch_prepare_bpf_trampoline(struct bpf_tramp_image *im,
25832583
if (nr_stack_args > MAX_NR_STACK_ARGS)
25842584
return -ENOTSUPP;
25852585

2586-
/* Return to %r14, since func_addr and %r0 are not available. */
2587-
if ((!func_addr && !(flags & BPF_TRAMP_F_ORIG_STACK)) ||
2588-
(flags & BPF_TRAMP_F_INDIRECT))
2586+
/* Return to %r14 in the struct_ops case. */
2587+
if (flags & BPF_TRAMP_F_INDIRECT)
25892588
flags |= BPF_TRAMP_F_SKIP_FRAME;
25902589

25912590
/*

kernel/bpf/bpf_struct_ops.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ int bpf_struct_ops_prepare_trampoline(struct bpf_tramp_links *tlinks,
601601
if (model->ret_size > 0)
602602
flags |= BPF_TRAMP_F_RET_FENTRY_RET;
603603

604-
size = arch_bpf_trampoline_size(model, flags, tlinks, NULL);
604+
size = arch_bpf_trampoline_size(model, flags, tlinks, stub_func);
605605
if (size <= 0)
606606
return size ? : -EFAULT;
607607

0 commit comments

Comments
 (0)