linux/arch/powerpc
Nicholas Piggin 498e6604a3 powerpc/64s: Mask SRR0 before checking against the masked NIP
[ Upstream commit aee101d7b9 ]

Commit 314f6c23dd ("powerpc/64s: Mask NIP before checking against
SRR0") masked off the low 2 bits of the NIP value in the interrupt
stack frame in case they are non-zero and mis-compare against a SRR0
register value of a CPU which always reads back 0 from the 2 low bits
which are reserved.

This now causes the opposite problem that an implementation which does
implement those bits in SRR0 will mis-compare against the masked NIP
value in which they have been cleared. QEMU is one such implementation,
and this is allowed by the architecture.

This can be triggered by sigfuz by setting low bits of PT_NIP in the
signal context.

Fix this for now by masking the SRR0 bits as well. Cleaner is probably
to sanitise these values before putting them in registers or stack, but
this is the quick and backportable fix.

Fixes: 314f6c23dd ("powerpc/64s: Mask NIP before checking against SRR0")
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20220117134403.2995059-1-npiggin@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-02-01 17:27:09 +01:00
..
boot powerpc/fsl/dts: Enable WA for erratum A-009885 on fman3l MDIO buses 2022-01-27 11:05:24 +01:00
configs Documentation, arch: Remove leftovers from CIFS_WEAK_PW_HASH 2022-01-27 11:05:21 +01:00
crypto crypto: powepc/sha1 - remove unneeded semicolon 2021-03-07 15:13:14 +11:00
include powerpc64/bpf: Limit 'ldbrx' to processors compliant with ISA v2.06 2022-02-01 17:27:09 +01:00
kernel powerpc/64s: Mask SRR0 before checking against the masked NIP 2022-02-01 17:27:09 +01:00
kexec powerpc updates for 5.15 2021-09-03 11:22:50 -07:00
kvm KVM: PPC: Book3S HV Nested: Fix nested HFSCR being clobbered with multiple vCPUs 2022-02-01 17:27:03 +01:00
lib powerpc/32: Fix boot failure with GCC latent entropy plugin 2022-02-01 17:27:06 +01:00
math-emu powerpc/64s: avoid reloading (H)SRR registers if they are still valid 2021-06-25 00:06:55 +10:00
mm powerpc/32s: Fix kasan_init_region() for KASAN 2022-02-01 17:27:06 +01:00
net powerpc64/bpf: Limit 'ldbrx' to processors compliant with ISA v2.06 2022-02-01 17:27:09 +01:00
perf powerpc/perf: Fix PMU callbacks to clear pending PMI before resetting an overflown PMC 2022-01-27 11:04:07 +01:00
platforms powerpc/cell: Fix clang -Wimplicit-fallthrough warning 2022-01-27 11:05:24 +01:00
purgatory powerpc/kexec: Don't use .machine ppc64 in trampoline_64.S 2021-04-08 21:17:43 +10:00
sysdev powerpc/xive: Add missing null check after calling kmalloc 2022-01-27 11:04:18 +01:00
tools powerpc/head_check: Fix shellcheck errors 2021-08-17 22:52:02 +10:00
xmon powerpc/xmon: fix task state output 2021-11-18 19:16:57 +01:00
Kbuild
Kconfig powerpc/booke: Disable STRICT_KERNEL_RWX, DEBUG_PAGEALLOC and KFENCE 2021-11-18 19:16:54 +01:00
Kconfig.debug powerpc/ptdump: Convert powerpc to GENERIC_PTDUMP 2021-08-25 13:35:48 +10:00
Makefile powerpc: Add "-z notext" flag to disable diagnostic 2021-08-15 13:49:39 +10:00
Makefile.postlink