linux-stable/arch
Hengqi Chen f296248daf LoongArch, bpf: Use 4 instructions for function address in JIT
[ Upstream commit 64f50f6575 ]

This patch fixes the following issue of function calls in JIT, like:

  [   29.346981] multi-func JIT bug 105 != 103

The issus can be reproduced by running the "inline simple bpf_loop call"
verifier test.

This is because we are emiting 2-4 instructions for 64-bit immediate moves.
During the first pass of JIT, the placeholder address is zero, emiting two
instructions for it. In the extra pass, the function address is in XKVRANGE,
emiting four instructions for it. This change the instruction index in
JIT context. Let's always use 4 instructions for function address in JIT.
So that the instruction sequences don't change between the first pass and
the extra pass for function calls.

Fixes: 5dc615520c ("LoongArch: Add BPF JIT support")
Signed-off-by: Hengqi Chen <hengqi.chen@gmail.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Tested-by: Tiezhu Yang <yangtiezhu@loongson.cn>
Link: https://lore.kernel.org/bpf/20230214152633.2265699-1-hengqi.chen@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-03-10 09:28:23 +01:00
..
alpha
arc
arm ARM: dts: stm32: Update part number NVMEM description on stm32mp131 2023-03-10 09:27:54 +01:00
arm64 arm64/sysreg: Fix errors in 32 bit enumeration values 2023-03-10 09:28:06 +01:00
csky
hexagon
ia64 ia64: fix build error due to switch case label appearing next to declaration 2023-01-31 16:44:08 -08:00
loongarch LoongArch, bpf: Use 4 instructions for function address in JIT 2023-03-10 09:28:23 +01:00
m68k m68k: /proc/hardware should depend on PROC_FS 2023-03-10 09:28:18 +01:00
microblaze
mips of/fdt: run soc memory setup when early_init_dt_scan_memory fails 2023-01-03 18:41:01 -06:00
nios2
openrisc
parisc parisc: Wire up PTRACE_GETREGS/PTRACE_SETREGS for compat case 2023-02-01 21:42:37 +01:00
powerpc powerpc/mm: Rearrange if-else block to avoid clang warning 2023-03-10 09:27:40 +01:00
riscv RISC-V: time: initialize hrtimer based broadcast clock event device 2023-03-10 09:28:18 +01:00
s390 s390/ap: fix status returned by ap_qact() 2023-03-10 09:28:18 +01:00
sh sh: define RUNTIME_DISCARD_EXIT 2023-01-31 16:44:09 -08:00
sparc
um
x86 x86/microcode: Adjust late loading result reporting message 2023-03-10 09:28:11 +01:00
xtensa xtensa: drop unused members of struct thread_struct 2023-01-06 23:33:11 -08:00
.gitignore
Kconfig