kernel_optimize_test/arch
Johan Almbladh 1d8f4447e8 bpf, arm: Fix register clobbering in div/mod implementation
[ Upstream commit 79e3445b38e0cab94264a3894c0c3d57c930b97e ]

On ARM CPUs that lack div/mod instructions, ALU32 BPF_DIV and BPF_MOD are
implemented using a call to a helper function. Before, the emitted code
for those function calls failed to preserve caller-saved ARM registers.
Since some of those registers happen to be mapped to BPF registers, it
resulted in eBPF register values being overwritten.

This patch emits code to push and pop the remaining caller-saved ARM
registers r2-r3 into the stack during the div/mod function call. ARM
registers r0-r1 are used as arguments and return value, and those were
already saved and restored correctly.

Fixes: 39c13c204b ("arm: eBPF JIT compiler")
Signed-off-by: Johan Almbladh <johan.almbladh@anyfinetworks.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-10-13 10:04:26 +02:00
..
alpha alpha: Declare virt_to_phys and virt_to_bus parameter as pointer to volatile 2021-09-30 10:11:07 +02:00
arc ARC: export clear_user_page() for modules 2021-09-22 12:28:04 +02:00
arm bpf, arm: Fix register clobbering in div/mod implementation 2021-10-13 10:04:26 +02:00
arm64 arm64: dts: qcom: pm8150: use qcom,pm8998-pon binding 2021-10-13 10:04:25 +02:00
c6x
csky csky: syscache: Fixup duplicate cache flush 2021-07-14 16:56:52 +02:00
h8300
hexagon hexagon: use common DISCARDS macro 2021-07-20 16:05:53 +02:00
ia64 mm/page_alloc: fix memory map initialization for descending nodes 2021-07-25 14:36:18 +02:00
m68k m68k: Double cast io functions to unsigned long 2021-09-30 10:11:06 +02:00
microblaze
mips bpf, mips: Validate conditional branch offsets 2021-10-06 15:55:51 +02:00
nds32 nds32: fix up stack guard gap 2021-07-28 14:35:46 +02:00
nios2 nios2: fixed broken sys_clone syscall 2021-03-04 11:38:16 +01:00
openrisc openrisc: don't printk() unconditionally 2021-09-18 13:40:13 +02:00
parisc parisc: Use absolute_pointer() to define PAGE0 2021-09-30 10:11:07 +02:00
powerpc KVM: PPC: Book3S HV: Tolerate treclaim. in fake-suspend mode changing registers 2021-09-22 12:27:59 +02:00
riscv riscv: Flush current cpu icache before other cpus 2021-10-13 10:04:24 +02:00
s390 s390/pci_mmio: fully validate the VMA before calling follow_pte() 2021-09-26 14:08:55 +02:00
sh sched/core: Initialize the idle task with preemption disabled 2021-07-14 16:55:50 +02:00
sparc sparc64: fix pci_iounmap() when CONFIG_PCI is not set 2021-10-09 14:40:56 +02:00
um um: virtio_uml: fix memory leak on init failures 2021-09-26 14:08:57 +02:00
x86 perf/x86: Reset destroy callback on event init failure 2021-10-09 14:40:58 +02:00
xtensa xtensa: call irqchip_init only when CONFIG_USE_OF is selected 2021-10-13 10:04:26 +02:00
.gitignore
Kconfig