Skip to content

Commit d0afd44

Browse files
npigginmpe
authored andcommitted
powerpc/traps: do not enable irqs in _exception
_exception can be called by machine check handlers when the MCE hits user code (e.g., pseries and powernv). This will enable local irqs because, which is a dicey thing to do in NMI or hard irq context. This seemed to worked out okay because a userspace MCE can basically be treated like a synchronous interrupt (after async / imprecise MCEs are filtered out). Since NMI and hard irq handlers have started growing nmi_enter / irq_enter, and more irq state sanity checks, this has started to cause problems (or at least trigger warnings). The Fixes tag to the commit which introduced this rather than try to work out exactly which commit was the first that could possibly cause a problem because that may be difficult to prove. Fixes: 9f2f79e ("powerpc: Disable interrupts in 64-bit kernel FP and vector faults") Signed-off-by: Nicholas Piggin <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 3e607dc commit d0afd44

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

arch/powerpc/kernel/traps.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -340,10 +340,16 @@ static bool exception_common(int signr, struct pt_regs *regs, int code,
340340
return false;
341341
}
342342

343-
show_signal_msg(signr, regs, code, addr);
343+
/*
344+
* Must not enable interrupts even for user-mode exception, because
345+
* this can be called from machine check, which may be a NMI or IRQ
346+
* which don't like interrupts being enabled. Could check for
347+
* in_hardirq || in_nmi perhaps, but there doesn't seem to be a good
348+
* reason why _exception() should enable irqs for an exception handler,
349+
* the handlers themselves do that directly.
350+
*/
344351

345-
if (arch_irqs_disabled())
346-
interrupt_cond_local_irq_enable(regs);
352+
show_signal_msg(signr, regs, code, addr);
347353

348354
current->thread.trap_nr = code;
349355

0 commit comments

Comments
 (0)