arch/*/*_sigdeliver.c: Fix a race condition is signal delivery for SMP

This fixes the same issue for other targets, which was already fixed for
xtensa in commit 50d94863.

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

Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
This commit is contained in:
Jukka Laitinen
2025-08-04 09:20:33 +03:00
committed by Xiang Xiao
parent ddf74ae059
commit 9cda3ce216
9 changed files with 9 additions and 27 deletions
+1 -3
View File
@@ -160,9 +160,7 @@ retry:
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
/* We need to keep the IRQ lock until task switching */ /* We need to keep the IRQ lock until task switching */
rtcb->irqcount++; leave_critical_section(up_irq_save());
leave_critical_section((uint16_t)regs[REG_PRIMASK]);
rtcb->irqcount--;
#endif #endif
g_running_tasks[this_cpu()] = NULL; g_running_tasks[this_cpu()] = NULL;
+1 -3
View File
@@ -158,9 +158,7 @@ retry:
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
/* We need to keep the IRQ lock until task switching */ /* We need to keep the IRQ lock until task switching */
rtcb->irqcount++; leave_critical_section(up_irq_save());
leave_critical_section(regs[REG_CPSR]);
rtcb->irqcount--;
#endif #endif
rtcb->xcp.regs = rtcb->xcp.saved_regs; rtcb->xcp.regs = rtcb->xcp.saved_regs;
+1 -3
View File
@@ -160,9 +160,7 @@ retry:
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
/* We need to keep the IRQ lock until task switching */ /* We need to keep the IRQ lock until task switching */
rtcb->irqcount++; leave_critical_section(up_irq_save());
leave_critical_section((uint8_t)regs[REG_BASEPRI]);
rtcb->irqcount--;
#endif #endif
rtcb->xcp.regs = rtcb->xcp.saved_regs; rtcb->xcp.regs = rtcb->xcp.saved_regs;
+1 -3
View File
@@ -155,9 +155,7 @@ retry:
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
/* We need to keep the IRQ lock until task switching */ /* We need to keep the IRQ lock until task switching */
rtcb->irqcount++; leave_critical_section(up_irq_save());
leave_critical_section(regs[REG_CPSR]);
rtcb->irqcount--;
#endif #endif
rtcb->xcp.regs = rtcb->xcp.saved_regs; rtcb->xcp.regs = rtcb->xcp.saved_regs;
+1 -3
View File
@@ -160,9 +160,7 @@ retry:
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
/* We need to keep the IRQ lock until task switching */ /* We need to keep the IRQ lock until task switching */
rtcb->irqcount++; leave_critical_section(up_irq_save());
leave_critical_section((uint8_t)regs[REG_BASEPRI]);
rtcb->irqcount--;
#endif #endif
rtcb->xcp.regs = rtcb->xcp.saved_regs; rtcb->xcp.regs = rtcb->xcp.saved_regs;
+1 -3
View File
@@ -153,9 +153,7 @@ retry:
board_autoled_off(LED_SIGNAL); board_autoled_off(LED_SIGNAL);
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
rtcb->irqcount++; leave_critical_section(up_irq_save());
leave_critical_section(regs[REG_CPSR]);
rtcb->irqcount--;
#endif #endif
rtcb->xcp.regs = rtcb->xcp.saved_regs; rtcb->xcp.regs = rtcb->xcp.saved_regs;
+1 -3
View File
@@ -158,9 +158,7 @@ retry:
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
/* We need to keep the IRQ lock until task switching */ /* We need to keep the IRQ lock until task switching */
rtcb->irqcount++; leave_critical_section(up_irq_save());
leave_critical_section(flags);
rtcb->irqcount--;
#endif #endif
arm64_fullcontextrestore(); arm64_fullcontextrestore();
+1 -3
View File
@@ -159,9 +159,7 @@ retry:
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
/* We need to keep the IRQ lock until task switching */ /* We need to keep the IRQ lock until task switching */
rtcb->irqcount++; leave_critical_section(up_irq_save());
leave_critical_section(regs[REG_INT_CTX]);
rtcb->irqcount--;
#endif #endif
rtcb->xcp.regs = regs; rtcb->xcp.regs = regs;
@@ -209,9 +209,7 @@ retry:
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
/* We need to keep the IRQ lock until task switching */ /* We need to keep the IRQ lock until task switching */
rtcb->irqcount++; leave_critical_section(up_irq_save());
leave_critical_section((regs[REG_PSR]));
rtcb->irqcount--;
#endif #endif
sparc_fullcontextrestore(regs); sparc_fullcontextrestore(regs);
} }