linux/arch/arm/net
Johan Almbladh 79e3445b38 bpf, arm: Fix register clobbering in div/mod implementation
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>
2021-09-29 16:04:50 +02:00
..
bpf_jit_32.c bpf, arm: Fix register clobbering in div/mod implementation 2021-09-29 16:04:50 +02:00
bpf_jit_32.h bpf, arm: Optimize ALU ARSH K using asr immediate instruction 2020-05-04 17:04:42 +02:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00