mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-25 00:52:45 -04:00
powerpc/64: Fix msr_check_and_set/clear MSR[EE] race
irq soft-masking means that when Linux irqs are disabled, the MSR[EE] value can change from 1 to 0 asynchronously: if a masked interrupt of the PACA_IRQ_MUST_HARD_MASK variety fires while irqs are disabled, the masked handler will return with MSR[EE]=0. This means a sequence like mtmsr(mfmsr() | MSR_FP) is racy if it can be called with local irqs disabled, unless a hard_irq_disable has been done. Reported-by: Sachin Sant <sachinp@linux.ibm.com> Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20221004051157.308999-2-npiggin@gmail.com
This commit is contained in:
committed by
Michael Ellerman
parent
8154850b28
commit
0fa6831811
@@ -127,7 +127,7 @@ unsigned long notrace msr_check_and_set(unsigned long bits)
|
||||
newmsr |= MSR_VSX;
|
||||
|
||||
if (oldmsr != newmsr)
|
||||
mtmsr_isync(newmsr);
|
||||
newmsr = mtmsr_isync_irqsafe(newmsr);
|
||||
|
||||
return newmsr;
|
||||
}
|
||||
@@ -145,7 +145,7 @@ void notrace __msr_check_and_clear(unsigned long bits)
|
||||
newmsr &= ~MSR_VSX;
|
||||
|
||||
if (oldmsr != newmsr)
|
||||
mtmsr_isync(newmsr);
|
||||
mtmsr_isync_irqsafe(newmsr);
|
||||
}
|
||||
EXPORT_SYMBOL(__msr_check_and_clear);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user