From 776e2d774faac35c4583b6186e6c3e659fa4551f Mon Sep 17 00:00:00 2001 From: Ville Juven Date: Mon, 13 Mar 2023 12:17:42 +0200 Subject: [PATCH] signal/sig_dispatch: Add signal action, if task is in system call The _unmasked_ signal action was never added if the task is in system call and waiting for (a different) signal. This fixes deliver especially for default signal actions / unmaskable signals, like SIGTERM. --- sched/signal/sig_dispatch.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/sched/signal/sig_dispatch.c b/sched/signal/sig_dispatch.c index 77d0c5ef71..8407251336 100644 --- a/sched/signal/sig_dispatch.c +++ b/sched/signal/sig_dispatch.c @@ -321,8 +321,8 @@ int nxsig_tcbdispatch(FAR struct tcb_s *stcb, siginfo_t *info) int masked; int ret = OK; - sinfo("TCB=%p signo=%d code=%d value=%d mask=%08" PRIx32 "\n", - stcb, info->si_signo, info->si_code, + sinfo("TCB=%p pid=%d signo=%d code=%d value=%d mask=%08" PRIx32 "\n", + stcb, stcb->pid, info->si_signo, info->si_code, info->si_value.sival_int, stcb->sigprocmask); DEBUGASSERT(stcb != NULL && info != NULL); @@ -404,6 +404,15 @@ int nxsig_tcbdispatch(FAR struct tcb_s *stcb, siginfo_t *info) } leave_critical_section(flags); + +#ifdef CONFIG_LIB_SYSCALL + /* Must also add signal action if in system call */ + + if (masked == 0) + { + nxsig_add_pendingsignal(stcb, info); + } +#endif } /* Its not one we are waiting for... Add it to the list of pending