mirror of
https://github.com/torvalds/linux.git
synced 2026-05-29 17:43:52 +02:00
powerpc/64: Sanitise common exit code for interrupts
Interrupt code is shared between Book3E/S 64-bit systems for interrupt handlers. Ensure that exit code correctly restores non-volatile gprs on each system when CONFIG_INTERRUPT_SANITIZE_REGISTERS is enabled. Also introduce macros for clearing/restoring registers on interrupt entry for when this configuration option is either disabled or enabled. Reviewed-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Rohan McLure <rmclure@linux.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20221201071019.1953023-3-rmclure@linux.ibm.com
This commit is contained in:
parent
cbf892ba56
commit
75c5d6b1e1
|
|
@ -408,9 +408,11 @@ interrupt_return_\srr\()_user: /* make backtraces match the _kernel variant */
|
|||
_ASM_NOKPROBE_SYMBOL(interrupt_return_\srr\()_user)
|
||||
addi r3,r1,STACK_INT_FRAME_REGS
|
||||
bl interrupt_exit_user_prepare
|
||||
#ifndef CONFIG_INTERRUPT_SANITIZE_REGISTERS
|
||||
cmpdi r3,0
|
||||
bne- .Lrestore_nvgprs_\srr
|
||||
.Lrestore_nvgprs_\srr\()_cont:
|
||||
#endif
|
||||
std r1,PACA_EXIT_SAVE_R1(r13) /* save r1 for restart */
|
||||
#ifdef CONFIG_PPC_BOOK3S
|
||||
.Linterrupt_return_\srr\()_user_rst_start:
|
||||
|
|
@ -424,6 +426,7 @@ _ASM_NOKPROBE_SYMBOL(interrupt_return_\srr\()_user)
|
|||
stb r11,PACAIRQHAPPENED(r13) # clear out possible HARD_DIS
|
||||
|
||||
.Lfast_user_interrupt_return_\srr\():
|
||||
SANITIZE_RESTORE_NVGPRS()
|
||||
#ifdef CONFIG_PPC_BOOK3S
|
||||
.ifc \srr,srr
|
||||
lbz r4,PACASRR_VALID(r13)
|
||||
|
|
@ -493,9 +496,11 @@ ALT_FTR_SECTION_END_IFCLR(CPU_FTR_STCX_CHECKS_ADDRESS)
|
|||
b . /* prevent speculative execution */
|
||||
.Linterrupt_return_\srr\()_user_rst_end:
|
||||
|
||||
#ifndef CONFIG_INTERRUPT_SANITIZE_REGISTERS
|
||||
.Lrestore_nvgprs_\srr\():
|
||||
REST_NVGPRS(r1)
|
||||
b .Lrestore_nvgprs_\srr\()_cont
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PPC_BOOK3S
|
||||
interrupt_return_\srr\()_user_restart:
|
||||
|
|
@ -585,6 +590,7 @@ _ASM_NOKPROBE_SYMBOL(interrupt_return_\srr\()_kernel)
|
|||
stb r11,PACAIRQHAPPENED(r13) // clear the possible HARD_DIS
|
||||
|
||||
.Lfast_kernel_interrupt_return_\srr\():
|
||||
SANITIZE_RESTORE_NVGPRS()
|
||||
cmpdi cr1,r3,0
|
||||
#ifdef CONFIG_PPC_BOOK3S
|
||||
.ifc \srr,srr
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user