Re: [PATCH v4 3/7] powerpc/64: Sanitise common exit code for interrupts
From: "Nicholas Piggin" <npiggin@gmail.com>
Date: 2022-11-29 09:47:37
On Tue Nov 29, 2022 at 2:43 PM AEST, Rohan McLure wrote:
quoted hunk ↗ jump to hunk
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 <redacted> --- 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@gmail.com> Thanks, Nick