linux/arch
Brendan Jackman b29dd96b90 bpf, x86: Fix BPF_FETCH atomic and/or/xor with r0 as src
This code generates a CMPXCHG loop in order to implement atomic_fetch
bitwise operations. Because CMPXCHG is hard-coded to use rax (which
holds the BPF r0 value), it saves the _real_ r0 value into the
internal "ax" temporary register and restores it once the loop is
complete.

In the middle of the loop, the actual bitwise operation is performed
using src_reg. The bug occurs when src_reg is r0: as described above,
r0 has been clobbered and the real r0 value is in the ax register.

Therefore, perform this operation on the ax register instead, when
src_reg is r0.

Fixes: 981f94c3e9 ("bpf: Add bitwise atomic instructions")
Signed-off-by: Brendan Jackman <jackmanb@google.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: KP Singh <kpsingh@kernel.org>
Link: https://lore.kernel.org/bpf/20210216125307.1406237-1-jackmanb@google.com
2021-02-22 18:03:11 +01:00
..
alpha
arc
arm Updates for the irq subsystem: 2021-02-21 11:53:06 -08:00
arm64 Updates for the irq subsystem: 2021-02-21 11:53:06 -08:00
csky
h8300 h8300: fix PREEMPTION build, TI_PRE_COUNT undefined 2021-02-13 11:42:40 -08:00
hexagon
ia64 These changes fix MM (soft-)dirty bit management in the procfs code & clean up the API. 2021-02-21 12:19:56 -08:00
m68k for-5.12/block-2021-02-17 2021-02-21 11:02:48 -08:00
microblaze
mips Remove oprofile and dcookies support 2021-02-21 10:40:34 -08:00
nds32
nios2
openrisc
parisc Remove oprofile and dcookies support 2021-02-21 10:40:34 -08:00
powerpc The performance event updates for v5.12 are: 2021-02-21 12:49:32 -08:00
riscv Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next 2021-02-20 17:45:32 -08:00
s390 Remove oprofile and dcookies support 2021-02-21 10:40:34 -08:00
sh Remove oprofile and dcookies support 2021-02-21 10:40:34 -08:00
sparc These changes fix MM (soft-)dirty bit management in the procfs code & clean up the API. 2021-02-21 12:19:56 -08:00
um um: time: fix initialization in time-travel mode 2021-01-26 22:11:38 +01:00
x86 bpf, x86: Fix BPF_FETCH atomic and/or/xor with r0 as src 2021-02-22 18:03:11 +01:00
xtensa for-5.12/block-2021-02-17 2021-02-21 11:02:48 -08:00
.gitignore
Kconfig Scheduler updates for v5.12: 2021-02-21 12:35:04 -08:00