linux-stable/arch
Pu Lehui d32b2a85ef riscv, bpf: Emit fixed-length instructions for BPF_PSEUDO_FUNC
[ Upstream commit b54b600361 ]

For BPF_PSEUDO_FUNC instruction, verifier will refill imm with
correct addresses of bpf_calls and then run last pass of JIT.
Since the emit_imm of RV64 is variable-length, which will emit
appropriate length instructions accorroding to the imm, it may
broke ctx->offset, and lead to unpredictable problem, such as
inaccurate jump. So let's fix it with fixed-length instructions.

Fixes: 69c087ba62 ("bpf: Add bpf_for_each_map_elem() helper")
Suggested-by: Björn Töpel <bjorn@rivosinc.com>
Signed-off-by: Pu Lehui <pulehui@huawei.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Reviewed-by: Björn Töpel <bjorn@kernel.org>
Acked-by: Björn Töpel <bjorn@kernel.org>
Link: https://lore.kernel.org/bpf/20221206091410.1584784-1-pulehui@huaweicloud.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-12-31 13:26:09 +01:00
..
alpha alpha: fix syscall entry in !AUDUT_SYSCALL case 2022-12-31 13:25:42 +01:00
arc arc: iounmap() arg is volatile 2022-11-04 00:00:27 +09:00
arm ARM: mmp: fix timer_read delay 2022-12-31 13:25:40 +01:00
arm64 arch: arm64: apple: t8103: Use standard "iommu" node name 2022-12-31 13:25:40 +01:00
csky Merge 'irq/loongarch', 'pci/ctrl/loongson' and 'pci/header-cleanup-immutable' 2022-08-11 21:06:14 +08:00
hexagon provide arch_test_bit_acquire for architectures that define test_bit 2022-08-27 09:49:54 -07:00
ia64 ia64: export memory_add_physaddr_to_nid to fix cxl build error 2022-10-21 12:38:34 +02:00
loongarch LoongArch: Fix unsigned comparison with less than zero 2022-12-14 11:40:47 +01:00
m68k m68k: Rework BI_VIRT_RNG_SEED as BI_RNG_SEED 2022-11-16 10:03:48 +01:00
microblaze - The usual batches of cleanups from Baoquan He, Muchun Song, Miaohe 2022-08-05 16:32:45 -07:00
mips MIPS: OCTEON: warn only once if deprecated link status is being used 2022-12-31 13:25:47 +01:00
nios2 nios2: add FORCE for vmlinuz.gz 2022-12-02 17:43:11 +01:00
openrisc Updates to various subsystems which I help look after. lib, ocfs2, 2022-08-07 10:03:24 -07:00
parisc parisc: Avoid printing the hardware path twice 2022-11-10 18:17:36 +01:00
powerpc powerpc/bpf/32: Fix Oops on tail call tests 2022-12-08 11:30:22 +01:00
riscv riscv, bpf: Emit fixed-length instructions for BPF_PSEUDO_FUNC 2022-12-31 13:26:09 +01:00
s390 KVM: s390: vsie: Fix the initialization of the epoch extension (epdx) field 2022-12-14 11:40:53 +01:00
sh sh: machvec: Use char[] for section boundaries 2022-10-21 12:37:59 +02:00
sparc sparc: Unbreak the build 2022-10-12 09:39:04 +02:00
um UM: cpuinfo: Fix a warning for CONFIG_CPUMASK_OFFSTACK 2022-10-21 12:37:40 +02:00
x86 x86/boot: Skip realmode init code when running as Xen PV guest 2022-12-31 13:26:03 +01:00
xtensa Merge 'irq/loongarch', 'pci/ctrl/loongson' and 'pci/header-cleanup-immutable' 2022-08-11 21:06:14 +08:00
.gitignore
Kconfig asm-generic: Conditionally enable do_softirq_own_stack() via Kconfig. 2022-09-05 17:20:55 +02:00