arch/xtensa: Fix a race condition in xtensa_sig_deliver for SMP

After the signals have been delivered, the local irqs need to be
disabled until the context switch. But just calling
leave_critical_section(regs[REG_PS]) will enable them if they were
enabled in the context.

Any interrupt on this cpu before xtensa_context_restore() would set
the rtcb->xcp.regs to NULL, causing a crash in context restore.

Fix this by calling leave_critical_section(up_irq_save()) instead.

Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
This commit is contained in:
Jukka Laitinen 2025-07-31 18:15:29 +03:00 committed by Tiago Medicci Serrano
parent 73cf02d63a
commit 50d94863f2

View file

@ -154,12 +154,11 @@ retry:
*/
board_autoled_off(LED_SIGNAL);
#ifdef CONFIG_SMP
/* We need to keep the IRQ lock until task switching */
rtcb->irqcount++;
leave_critical_section((regs[REG_PS]));
rtcb->irqcount--;
leave_critical_section(up_irq_save());
#endif
rtcb->xcp.regs = rtcb->xcp.saved_regs;