From 4f8e09106f6e457c6e9a4ce597fa9ae2bda032c3 Mon Sep 17 00:00:00 2001 From: Rohan McLure Date: Mon, 6 Feb 2023 13:18:00 +1100 Subject: [PATCH] powerpc/kcsan: Prevent recursive instrumentation with IRQ save/restores Instrumented memory accesses provided by KCSAN will access core-local memories (which will save and restore IRQs) as well as restoring IRQs directly. Avoid recursive instrumentation by applying __no_kcsan annotation to IRQ restore routines. Signed-off-by: Rohan McLure [mpe: Resolve merge conflict with IRQ replay recursion changes] Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20230206021801.105268-5-rmclure@linux.ibm.com --- arch/powerpc/kernel/irq_64.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/kernel/irq_64.c b/arch/powerpc/kernel/irq_64.c index 9dc0ad3..c788c55 100644 --- a/arch/powerpc/kernel/irq_64.c +++ b/arch/powerpc/kernel/irq_64.c @@ -94,7 +94,7 @@ static inline bool irq_happened_test_and_clear(u8 irq) return false; } -static void __replay_soft_interrupts(void) +static __no_kcsan void __replay_soft_interrupts(void) { struct pt_regs regs; @@ -171,7 +171,7 @@ static void __replay_soft_interrupts(void) local_paca->irq_happened &= ~PACA_IRQ_REPLAYING; } -void replay_soft_interrupts(void) +__no_kcsan void replay_soft_interrupts(void) { irq_enter(); /* See comment in arch_local_irq_restore */ __replay_soft_interrupts(); @@ -179,7 +179,7 @@ void replay_soft_interrupts(void) } #if defined(CONFIG_PPC_BOOK3S_64) && defined(CONFIG_PPC_KUAP) -static inline void replay_soft_interrupts_irqrestore(void) +static inline __no_kcsan void replay_soft_interrupts_irqrestore(void) { unsigned long kuap_state = get_kuap(); @@ -203,7 +203,7 @@ static inline void replay_soft_interrupts_irqrestore(void) #define replay_soft_interrupts_irqrestore() __replay_soft_interrupts() #endif -notrace void arch_local_irq_restore(unsigned long mask) +notrace __no_kcsan void arch_local_irq_restore(unsigned long mask) { unsigned char irq_happened; -- 2.7.4