[PATCH v4 3/7] powerpc/64: Sanitise common exit code for interrupts
Nicholas Piggin
npiggin at gmail.com
Tue Nov 29 20:46:36 AEDT 2022
On Tue Nov 29, 2022 at 2:43 PM AEST, Rohan McLure wrote:
> 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.
>
> Signed-off-by: Rohan McLure <rmclure at linux.ibm.com>
> ---
> v4: New patch
> ---
> arch/powerpc/kernel/interrupt_64.S | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/arch/powerpc/kernel/interrupt_64.S b/arch/powerpc/kernel/interrupt_64.S
> index 978a173eb339..1ef4fdef74fb 100644
> --- a/arch/powerpc/kernel/interrupt_64.S
> +++ b/arch/powerpc/kernel/interrupt_64.S
> @@ -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_FRAME_OVERHEAD
> bl interrupt_exit_user_prepare
> +#ifndef CONFIG_INTERRUPT_SANITIZE_REGISTERS
> cmpdi r3,0
> bne- .Lrestore_nvgprs_\srr
> .Lrestore_nvgprs_\srr\()_cont:
> +#endif
Looks pretty good. You might add a comment here to say nvgprs are always
restored, in the sanitize case. Not that it's hard to grep for.
Reviewed-by: Nicholas Piggin <npiggin at gmail.com>
Thanks,
Nick
More information about the Linuxppc-dev
mailing list