Skip to content

Commit 8a98633

Browse files
chenhengqiKernel Patches Daemon
authored and
Kernel Patches Daemon
committed
LoongArch: BPF: Use move_addr() for BPF_PSEUDO_FUNC
Vincent reported that running XDP synproxy program on LoongArch results in the following error: JIT doesn't support bpf-to-bpf calls With dmesg: multi-func JIT bug 1391 != 1390 The root cause is that verifier will refill the imm with the correct addresses of bpf_calls for BPF_PSEUDO_FUNC instructions and then run the last pass of JIT. So we generate different JIT code for the same instruction in two passes (one for placeholder and one for real address). Let's use move_addr() instead. See commit 64f50f6 ("LoongArch, bpf: Use 4 instructions for function address in JIT") for a similar fix. Fixes: 69c087b ("bpf: Add bpf_for_each_map_elem() helper") Fixes: bb035ef ("LoongArch: BPF: Support mixing bpf2bpf and tailcalls") Reported-by: Vincent Li <[email protected]> Closes: https://lore.kernel.org/loongarch/CAK3+h2yfM9FTNiXvEQBkvtuoJrvzmN4c_NZsFXqEk4Cj1tsBNA@mail.gmail.com/T/#u Signed-off-by: Hengqi Chen <[email protected]>
1 parent 014f72f commit 8a98633

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

arch/loongarch/net/bpf_jit.c

+4-1
Original file line numberDiff line numberDiff line change
@@ -930,7 +930,10 @@ static int build_insn(const struct bpf_insn *insn, struct jit_ctx *ctx, bool ext
930930
{
931931
const u64 imm64 = (u64)(insn + 1)->imm << 32 | (u32)insn->imm;
932932

933-
move_imm(ctx, dst, imm64, is32);
933+
if (bpf_pseudo_func(insn))
934+
move_addr(ctx, dst, imm64);
935+
else
936+
move_imm(ctx, dst, imm64, is32);
934937
return 1;
935938
}
936939

0 commit comments

Comments
 (0)