diff options
author | Nicholas Piggin <npiggin@gmail.com> | 2017-07-29 08:50:27 -0400 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2017-07-31 06:22:37 -0400 |
commit | cc491f1d3583146eaee635c86b9c9227fa835c6c (patch) | |
tree | 5b2d43d7d4bf922f96f9eb5dd7485131360c4231 | |
parent | bb272221e9db79f13d454e1f3fb6b05013be985e (diff) |
powerpc/64s: Fix stack setup in watchdog soft_nmi_common()
The watchdog soft-NMI exception stack setup loads a stack pointer
twice, which is an obvious error. It ends up using the system reset
interrupt (true-NMI) stack, which is also a bug because the watchdog
could be preempted by a system reset interrupt that overwrites the
NMI stack.
Change the soft-NMI to use the "emergency stack". The current kernel
stack is not used, because of the longer-term goal to prevent
asynchronous stack access using soft-disable.
Fixes: 2104180a5369 ("powerpc/64s: implement arch-specific hardlockup watchdog")
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
-rw-r--r-- | arch/powerpc/kernel/exceptions-64s.S | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S index 9029afd1fa2a..f14f3c04ec7e 100644 --- a/arch/powerpc/kernel/exceptions-64s.S +++ b/arch/powerpc/kernel/exceptions-64s.S | |||
@@ -1325,10 +1325,18 @@ EXC_VIRT_NONE(0x5800, 0x100) | |||
1325 | std r10,PACA_EXGEN+EX_R13(r13); \ | 1325 | std r10,PACA_EXGEN+EX_R13(r13); \ |
1326 | EXCEPTION_PROLOG_PSERIES_1(soft_nmi_common, _H) | 1326 | EXCEPTION_PROLOG_PSERIES_1(soft_nmi_common, _H) |
1327 | 1327 | ||
1328 | /* | ||
1329 | * Branch to soft_nmi_interrupt using the emergency stack. The emergency | ||
1330 | * stack is one that is usable by maskable interrupts so long as MSR_EE | ||
1331 | * remains off. It is used for recovery when something has corrupted the | ||
1332 | * normal kernel stack, for example. The "soft NMI" must not use the process | ||
1333 | * stack because we want irq disabled sections to avoid touching the stack | ||
1334 | * at all (other than PMU interrupts), so use the emergency stack for this, | ||
1335 | * and run it entirely with interrupts hard disabled. | ||
1336 | */ | ||
1328 | EXC_COMMON_BEGIN(soft_nmi_common) | 1337 | EXC_COMMON_BEGIN(soft_nmi_common) |
1329 | mr r10,r1 | 1338 | mr r10,r1 |
1330 | ld r1,PACAEMERGSP(r13) | 1339 | ld r1,PACAEMERGSP(r13) |
1331 | ld r1,PACA_NMI_EMERG_SP(r13) | ||
1332 | subi r1,r1,INT_FRAME_SIZE | 1340 | subi r1,r1,INT_FRAME_SIZE |
1333 | EXCEPTION_COMMON_NORET_STACK(PACA_EXGEN, 0x900, | 1341 | EXCEPTION_COMMON_NORET_STACK(PACA_EXGEN, 0x900, |
1334 | system_reset, soft_nmi_interrupt, | 1342 | system_reset, soft_nmi_interrupt, |