diff options
author | Nicholas Piggin <npiggin@gmail.com> | 2022-10-14 13:07:29 +1000 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2022-10-18 22:46:19 +1100 |
commit | a073672eb09670540e95a2a4aa1c46f5da74159f (patch) | |
tree | 411299c6b96893732dc0edacd16a00a19fb37d2f /arch/powerpc/kernel/exceptions-64e.S | |
parent | e59b3399fde5e173b026d4952b215043e77b4521 (diff) | |
download | linux-a073672eb09670540e95a2a4aa1c46f5da74159f.tar.gz linux-a073672eb09670540e95a2a4aa1c46f5da74159f.tar.bz2 linux-a073672eb09670540e95a2a4aa1c46f5da74159f.zip |
powerpc/64/interrupt: Prevent NMI PMI causing a dangerous warning
NMI PMIs really should not return using the normal interrupt_return
function. If such a PMI hits in code returning to user with the context
switched to user mode, this warning can fire. This was enough to cause
crashes when reproducing on 64s, because another perf interrupt would
hit while reporting bug, and that would cause another bug, and so on
until smashing the stack.
Work around that particular crash for now by just disabling that context
warning for PMIs. This is a hack and not a complete fix, there could be
other such problems lurking in corners. But it does fix the known crash.
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20221014030729.2077151-3-npiggin@gmail.com
Diffstat (limited to 'arch/powerpc/kernel/exceptions-64e.S')
-rw-r--r-- | arch/powerpc/kernel/exceptions-64e.S | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/arch/powerpc/kernel/exceptions-64e.S b/arch/powerpc/kernel/exceptions-64e.S index 930e36099015..2f68fb2ee4fc 100644 --- a/arch/powerpc/kernel/exceptions-64e.S +++ b/arch/powerpc/kernel/exceptions-64e.S @@ -813,6 +813,13 @@ kernel_dbg_exc: EXCEPTION_COMMON(0x260) CHECK_NAPPING() addi r3,r1,STACK_FRAME_OVERHEAD + /* + * XXX: Returning from performance_monitor_exception taken as a + * soft-NMI (Linux irqs disabled) may be risky to use interrupt_return + * and could cause bugs in return or elsewhere. That case should just + * restore registers and return. There is a workaround for one known + * problem in interrupt_exit_kernel_prepare(). + */ bl performance_monitor_exception b interrupt_return |