linux/arch/arm64
Mark Rutland 50f813e576 arm64: probes: Fix simulate_ldr*_literal()
The simulate_ldr_literal() code always loads a 64-bit quantity, and when
simulating a 32-bit load into a 'W' register, it discards the most
significant 32 bits. For big-endian kernels this means that the relevant
bits are discarded, and the value returned is the the subsequent 32 bits
in memory (i.e. the value at addr + 4).

Additionally, simulate_ldr_literal() and simulate_ldrsw_literal() use a
plain C load, which the compiler may tear or elide (e.g. if the target
is the zero register). Today this doesn't happen to matter, but it may
matter in future if trampoline code uses a LDR (literal) or LDRSW
(literal).

Update simulate_ldr_literal() and simulate_ldrsw_literal() to use an
appropriately-sized READ_ONCE() to perform the access, which avoids
these problems.

Fixes: 39a67d49ba ("arm64: kprobes instruction simulation support")
Cc: stable@vger.kernel.org
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Link: https://lore.kernel.org/r/20241008155851.801546-3-mark.rutland@arm.com
Signed-off-by: Will Deacon <will@kernel.org>
2024-10-09 16:56:53 +01:00
..
boot Char/Misc and other driver changes for 6.12-rc1 2024-09-26 10:13:08 -07:00
configs i2c-for-6.12-rc1 2024-09-23 14:34:19 -07:00
crypto crypto: arm64/poly1305 - move data to rodata section 2024-08-17 13:55:49 +08:00
hyperv
include arm64: cputype: Add Neoverse-N3 definitions 2024-10-01 12:46:54 +01:00
kernel arm64: probes: Fix simulate_ldr*_literal() 2024-10-09 16:56:53 +01:00
kvm x86: 2024-09-28 09:20:14 -07:00
lib
mm dma-mapping updates for linux 6.12 2024-09-19 11:12:49 +02:00
net bpf, arm64: Jit BPF_CALL to direct call when possible 2024-09-04 11:51:06 -07:00
tools Merge branch 'for-next/poe' into for-next/core 2024-09-12 13:43:41 +01:00
xen
Kbuild
Kconfig arm64: fix selection of HAVE_DYNAMIC_FTRACE_WITH_ARGS 2024-10-01 12:47:19 +01:00
Kconfig.debug
Kconfig.platforms Updates for the interrupt subsystem: 2024-07-22 13:52:05 -07:00
Makefile arm64: Force position-independent veneers 2024-10-01 12:46:27 +01:00