linux-stable/arch
Tiezhu Yang 772cbe948f LoongArch: BPF: Fix sign-extension mov instructions
We can see that "Short form of movsx, dst_reg = (s8,s16,s32)src_reg" in
include/linux/filter.h, additionally, for BPF_ALU64 the value of the
destination register is unchanged whereas for BPF_ALU the upper 32 bits
of the destination register are zeroed, so it should clear the upper 32
bits for BPF_ALU.

[root@linux fedora]# echo 1 > /proc/sys/net/core/bpf_jit_enable
[root@linux fedora]# modprobe test_bpf

Before:
test_bpf: #81 ALU_MOVSX | BPF_B jited:1 ret 2 != 1 (0x2 != 0x1)FAIL (1 times)
test_bpf: #82 ALU_MOVSX | BPF_H jited:1 ret 2 != 1 (0x2 != 0x1)FAIL (1 times)

After:
test_bpf: #81 ALU_MOVSX | BPF_B jited:1 6 PASS
test_bpf: #82 ALU_MOVSX | BPF_H jited:1 6 PASS

By the way, the bpf selftest case "./test_progs -t verifier_movsx" can
also be fixed with this patch.

Fixes: f48012f161 ("LoongArch: BPF: Support sign-extension mov instructions")
Acked-by: Hengqi Chen <hengqi.chen@gmail.com>
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
2023-12-09 15:49:16 +08:00
..
alpha TTY/Serial changes for 6.7-rc1 2023-11-03 15:44:25 -10:00
arc kprobes: unify kprobes_exceptions_nofify() prototypes 2023-11-10 19:59:05 +09:00
arm arm/xen: fix xen_vcpu_info allocation alignment 2023-11-23 09:32:41 +01:00
arm64 arm64: Avoid enabling KPTI unnecessarily 2023-11-30 19:07:33 +00:00
csky Kbuild updates for v6.7 2023-11-04 08:07:19 -10:00
hexagon TTY/Serial changes for 6.7-rc1 2023-11-03 15:44:25 -10:00
loongarch LoongArch: BPF: Fix sign-extension mov instructions 2023-12-09 15:49:16 +08:00
m68k Many singleton patches against the MM code. The patch series which are 2023-11-02 19:38:47 -10:00
microblaze asm-generic updates for v6.7 2023-11-01 15:28:33 -10:00
mips Probes fixes for v6.7-rc1: 2023-11-10 16:35:04 -08:00
nios2
openrisc
parisc parisc: Reduce size of the bug_table on 64-bit kernel by half 2023-11-25 09:43:18 +01:00
powerpc KVM: PPC: Book3S HV: Fix KVM_RUN clobbering FP/VEC user registers 2023-11-29 22:24:21 +11:00
riscv RISC-V Patches for the 6.7 Merge Window, Part 2 2023-11-10 09:23:17 -08:00
s390 s390: remove odd comment 2023-11-22 13:55:13 +01:00
sh kprobes: unify kprobes_exceptions_nofify() prototypes 2023-11-10 19:59:05 +09:00
sparc kprobes: unify kprobes_exceptions_nofify() prototypes 2023-11-10 19:59:05 +09:00
um
x86 xen: branch for v6.7-rc4 2023-12-03 08:31:53 +09:00
xtensa TTY/Serial changes for 6.7-rc1 2023-11-03 15:44:25 -10:00
.gitignore
Kconfig