Skip to content

Commit 314f6c2

Browse files
committed
powerpc/64s: Mask NIP before checking against SRR0
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: 59dc5bf ("powerpc/64s: avoid reloading (H)SRR registers if they are still valid") Reported-by: Sachin Sant <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Tested-by: Sachin Sant <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 5b09250 commit 314f6c2

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

arch/powerpc/kernel/interrupt_64.S

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ COMPAT_SYS_CALL_TABLE:
3030
.ifc \srr,srr
3131
mfspr r11,SPRN_SRR0
3232
ld r12,_NIP(r1)
33+
clrrdi r12,r12,2
3334
100: tdne r11,r12
3435
EMIT_BUG_ENTRY 100b,__FILE__,__LINE__,(BUGFLAG_WARNING | BUGFLAG_ONCE)
3536
mfspr r11,SPRN_SRR1
@@ -39,6 +40,7 @@ COMPAT_SYS_CALL_TABLE:
3940
.else
4041
mfspr r11,SPRN_HSRR0
4142
ld r12,_NIP(r1)
43+
clrrdi r12,r12,2
4244
100: tdne r11,r12
4345
EMIT_BUG_ENTRY 100b,__FILE__,__LINE__,(BUGFLAG_WARNING | BUGFLAG_ONCE)
4446
mfspr r11,SPRN_HSRR1

0 commit comments

Comments
 (0)