sst-linux/arch/loongarch
Hengqi Chen c498c117c4 LoongArch: BPF: Use move_addr() for BPF_PSEUDO_FUNC
commit 52266f1015a8b5aabec7d127f83d105f702b388e upstream.

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 the other for the
real address). Let's use move_addr() instead.

See commit 64f50f6575721ef0 ("LoongArch, bpf: Use 4 instructions for
function address in JIT") for a similar fix.

Cc: stable@vger.kernel.org
Fixes: 69c087ba62 ("bpf: Add bpf_for_each_map_elem() helper")
Fixes: bb035ef0cc91 ("LoongArch: BPF: Support mixing bpf2bpf and tailcalls")
Reported-by: Vincent Li <vincent.mc.li@gmail.com>
Tested-by: Vincent Li <vincent.mc.li@gmail.com>
Closes: https://lore.kernel.org/loongarch/CAK3+h2yfM9FTNiXvEQBkvtuoJrvzmN4c_NZsFXqEk4Cj1tsBNA@mail.gmail.com/T/#u
Signed-off-by: Hengqi Chen <hengqi.chen@gmail.com>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-04-10 14:33:41 +02:00
..
boot
configs mm: z3fold: deprecate CONFIG_Z3FOLD 2024-10-17 15:22:05 +02:00
include LoongArch: Increase ARCH_DMA_MINALIGN up to 16 2025-04-10 14:33:41 +02:00
kernel LoongArch: Convert unreachable() to BUG() 2025-03-13 12:53:11 +01:00
lib
mm LoongArch: Fix sleeping in atomic context for PREEMPT_RT 2024-12-14 19:54:48 +01:00
net LoongArch: BPF: Use move_addr() for BPF_PSEUDO_FUNC 2025-04-10 14:33:41 +02:00
pci LoongArch: Fix memleak in pci_acpi_scan_root() 2024-10-17 15:22:16 +02:00
vdso LoongArch: Fix build failure with GCC 15 (-std=gnu23) 2024-12-14 19:53:49 +01:00
Kbuild
Kconfig LoongArch: Fix help text of CMDLINE_EXTEND in Kconfig 2025-04-10 14:33:38 +02:00
Kconfig.debug
Makefile LoongArch: Tweak CFLAGS for Clang compatibility 2024-12-14 19:53:48 +01:00