From 4aa39f9c18a09e88c79d3e818b31417bae9fa7ef Mon Sep 17 00:00:00 2001 From: Leon Hwang Date: Mon, 28 Oct 2024 21:45:59 +0800 Subject: [PATCH] bpf, x64: Propagate tailcall info only for subprogs In x64 JIT, propagate tailcall info only for subprogs, not for helpers or kfuncs. Signed-off-by: Leon Hwang --- arch/x86/net/bpf_jit_comp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c index 06b080b61aa57..eb08cc6d66401 100644 --- a/arch/x86/net/bpf_jit_comp.c +++ b/arch/x86/net/bpf_jit_comp.c @@ -2124,10 +2124,11 @@ st: if (is_imm8(insn->off)) /* call */ case BPF_JMP | BPF_CALL: { + bool pseudo_call = src_reg == BPF_PSEUDO_CALL; u8 *ip = image + addrs[i - 1]; func = (u8 *) __bpf_call_base + imm32; - if (tail_call_reachable) { + if (pseudo_call && tail_call_reachable) { LOAD_TAIL_CALL_CNT_PTR(bpf_prog->aux->stack_depth); ip += 7; }