Skip to content

Commit d314e1f

Browse files
Chenghao Duanchenhuacai
authored andcommitted
LoongArch: BPF: Save return address register ra to t0 before trampoline
Modify the build_prologue() function to ensure the return address register ra is saved to t0 before entering trampoline operations. This change ensures the accurate return address handling when a BPF program calls another BPF program, preventing errors in the BPF-to-BPF call chain. Cc: stable@vger.kernel.org Fixes: 677e612 ("LoongArch: BPF: Disable trampoline for kernel module function trace") Signed-off-by: Chenghao Duan <duanchenghao@kylinos.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
1 parent eb71f5c commit d314e1f

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

arch/loongarch/net/bpf_jit.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ static void build_prologue(struct jit_ctx *ctx)
139139
stack_adjust = round_up(stack_adjust, 16);
140140
stack_adjust += bpf_stack_adjust;
141141

142+
move_reg(ctx, LOONGARCH_GPR_T0, LOONGARCH_GPR_RA);
142143
/* Reserve space for the move_imm + jirl instruction */
143144
for (i = 0; i < LOONGARCH_LONG_JUMP_NINSNS; i++)
144145
emit_insn(ctx, nop);

0 commit comments

Comments
 (0)