kernel_samsung_a53x/arch/arm64
Mark Rutland f2ddadb749 arm64: probes: Fix simulate_ldr*_literal()
commit 50f813e57601c22b6f26ced3193b9b94d70a2640 upstream.

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: 39a67d49ba35 ("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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-11-23 23:21:54 +01:00
..
boot ARM64: boot: dts: Use always-y 2024-06-15 16:28:20 -03:00
configs Added KernelSU 2024-11-19 22:44:48 +01:00
crypto Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
include arm64: cputype: Add Neoverse-N3 definitions 2024-11-23 23:21:47 +01:00
kernel arm64: probes: Fix simulate_ldr*_literal() 2024-11-23 23:21:54 +01:00
kvm KVM: arm64: Make ICC_*SGI*_EL1 undef in the absence of a vGICv3 2024-11-23 23:20:50 +01:00
lib arm64: Align __arch_clear_user() to 16 bytes as per upstream 2024-11-19 17:54:00 +01:00
mm Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
net Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xen Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Kbuild Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Kconfig arm64: Restrict CPU_BIG_ENDIAN to GNU as or LLVM IAS 15.x or newer 2024-11-18 11:43:21 +01:00
Kconfig.debug Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Kconfig.platforms Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Makefile ARM64: boot: Select Image as default target 2024-06-15 16:21:19 -03:00
Makefile.postlink Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00