powerpc/64s: Mask NIP before checking against SRR0
authorMichael Ellerman <mpe@ellerman.id.au>
Tue, 21 Dec 2021 13:50:59 +0000 (00:50 +1100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 27 Jan 2022 10:04:16 +0000 (11:04 +0100)
commit5bb2d955e81bcba9cfb3a4880c6c4f0e5f25b524
treed4944a9901f405d4cba0461c906ec0d4ff14b46a
parent38accfd85e41b7ca547c5a7d4866bbc1462950cb
powerpc/64s: Mask NIP before checking against SRR0

[ Upstream commit 314f6c23dd8d417281eb9e8a516dd98036f2e7b3 ]

When CONFIG_PPC_RFI_SRR_DEBUG=y we check that NIP and SRR0 match when
returning from interrupts. This can trigger falsely if NIP has either of
its two low bits set via sigreturn or ptrace, while SRR0 has its low two
bits masked in hardware.

As a quick fix make sure to mask the low bits before doing the check.

Fixes: 59dc5bfca0cb ("powerpc/64s: avoid reloading (H)SRR registers if they are still valid")
Reported-by: Sachin Sant <sachinp@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Tested-by: Sachin Sant <sachinp@linux.vnet.ibm.com>
Link: https://lore.kernel.org/r/20211221135101.2085547-1-mpe@ellerman.id.au
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/powerpc/kernel/interrupt_64.S