Skip to content

Commit 814816d

Browse files
chleroympe
authored andcommitted
powerpc: Fix hard_irq_disable() with sanitizer
As reported by Zhouyi Zhou, WRITE_ONCE() is not atomic as expected when KASAN or KCSAN are compiled in. Fix it by re-implementing it using inline assembly. Fixes: 077fc62 ("powerpc/irq: remove inline assembly in hard_irq_disable macro") Reported-by: Zhouyi Zhou <zhouzhouyi@gmail.com> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/a8298991b3df049a54ee8e558838e34265812014.1661272586.git.christophe.leroy@csgroup.eu
1 parent 91926d8 commit 814816d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

arch/powerpc/include/asm/hw_irq.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,8 @@ static inline bool pmi_irq_pending(void)
282282
flags = irq_soft_mask_set_return(IRQS_ALL_DISABLED); \
283283
local_paca->irq_happened |= PACA_IRQ_HARD_DIS; \
284284
if (!arch_irqs_disabled_flags(flags)) { \
285-
WRITE_ONCE(local_paca->saved_r1, current_stack_pointer);\
285+
asm volatile("std%X0 %1,%0" : "=m" (local_paca->saved_r1) \
286+
: "r" (current_stack_pointer)); \
286287
trace_hardirqs_off(); \
287288
} \
288289
} while(0)

0 commit comments

Comments
 (0)