powerpc/64s/kuap: Restore AMR in fast_interrupt_return

Interrupts that use fast_interrupt_return actually do lock AMR, but
they have been ones which tend to come from userspace (or kernel bugs)
in radix mode. With kuap on hash, segment interrupts are taken in
kernel often, which quickly breaks due to the missing restore.

Fixes: 890274c2dc ("powerpc/64s: Implement KUAP for Radix MMU")
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20200429065654.1677541-6-npiggin@gmail.com
This commit is contained in:
Nicholas Piggin 2020-04-29 16:56:53 +10:00 committed by Michael Ellerman
parent 53459dc970
commit c44dc6323c
1 changed files with 3 additions and 1 deletions

View File

@ -472,15 +472,17 @@ END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_207S)
#ifdef CONFIG_PPC_BOOK3S #ifdef CONFIG_PPC_BOOK3S
/* /*
* If MSR EE/RI was never enabled, IRQs not reconciled, NVGPRs not * If MSR EE/RI was never enabled, IRQs not reconciled, NVGPRs not
* touched, AMR not set, no exit work created, then this can be used. * touched, no exit work created, then this can be used.
*/ */
.balign IFETCH_ALIGN_BYTES .balign IFETCH_ALIGN_BYTES
.globl fast_interrupt_return .globl fast_interrupt_return
fast_interrupt_return: fast_interrupt_return:
_ASM_NOKPROBE_SYMBOL(fast_interrupt_return) _ASM_NOKPROBE_SYMBOL(fast_interrupt_return)
kuap_check_amr r3, r4
ld r4,_MSR(r1) ld r4,_MSR(r1)
andi. r0,r4,MSR_PR andi. r0,r4,MSR_PR
bne .Lfast_user_interrupt_return bne .Lfast_user_interrupt_return
kuap_restore_amr r3
andi. r0,r4,MSR_RI andi. r0,r4,MSR_RI
li r3,0 /* 0 return value, no EMULATE_STACK_STORE */ li r3,0 /* 0 return value, no EMULATE_STACK_STORE */
bne+ .Lfast_kernel_interrupt_return bne+ .Lfast_kernel_interrupt_return