From be64b5060eb326e75b03a24dd7f36b8a24af4c7c Mon Sep 17 00:00:00 2001 From: Ville Juven Date: Wed, 8 Mar 2023 09:04:33 +0200 Subject: [PATCH 1/2] Revert "signal/sig_dispatch: Fix case where signal action is sent twice" This reverts commit be0cb4cbe3d50ea8d575766876a5f4194f1da5fe. --- sched/signal/sig_dispatch.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/sched/signal/sig_dispatch.c b/sched/signal/sig_dispatch.c index ce2842d513fa6..9b926667a67dd 100644 --- a/sched/signal/sig_dispatch.c +++ b/sched/signal/sig_dispatch.c @@ -372,9 +372,14 @@ int nxsig_tcbdispatch(FAR struct tcb_s *stcb, siginfo_t *info) if (masked == 1) #endif { - /* Add signal to pending queue regardless. */ +#ifdef CONFIG_LIB_SYSCALL + /* If the thread is in syscall, schedule the sigaction here */ - nxsig_add_pendingsignal(stcb, info); + if ((stcb->flags & TCB_FLAG_SYSCALL) != 0) + { + nxsig_add_pendingsignal(stcb, info); + } +#endif /* Check if the task is waiting for this pending signal. If so, then * unblock it. This must be performed in a critical section because @@ -406,9 +411,19 @@ int nxsig_tcbdispatch(FAR struct tcb_s *stcb, siginfo_t *info) { up_switch_context(stcb, rtcb); } + + leave_critical_section(flags); } - leave_critical_section(flags); + /* Its not one we are waiting for... Add it to the list of pending + * signals. + */ + + else + { + leave_critical_section(flags); + nxsig_add_pendingsignal(stcb, info); + } } /************************* UNMASKED SIGNAL ACTIONS ************************/ From 14f31e10edb7ba13d5a6524254de26b2957b4e9e Mon Sep 17 00:00:00 2001 From: Ville Juven Date: Wed, 8 Mar 2023 09:04:37 +0200 Subject: [PATCH 2/2] Revert "signal/sig_dispatch: Signal action was not performed if TCB_FLAG_SYSCALL is set" This reverts commit 0e4466682888cf32ca661aa04c649a836860a22f. --- sched/signal/sig_dispatch.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/sched/signal/sig_dispatch.c b/sched/signal/sig_dispatch.c index 9b926667a67dd..77d0c5ef7181c 100644 --- a/sched/signal/sig_dispatch.c +++ b/sched/signal/sig_dispatch.c @@ -372,15 +372,6 @@ int nxsig_tcbdispatch(FAR struct tcb_s *stcb, siginfo_t *info) if (masked == 1) #endif { -#ifdef CONFIG_LIB_SYSCALL - /* If the thread is in syscall, schedule the sigaction here */ - - if ((stcb->flags & TCB_FLAG_SYSCALL) != 0) - { - nxsig_add_pendingsignal(stcb, info); - } -#endif - /* Check if the task is waiting for this pending signal. If so, then * unblock it. This must be performed in a critical section because * signals can be queued from the interrupt level.