summaryrefslogtreecommitdiff
path: root/nuttx/sched
diff options
context:
space:
mode:
Diffstat (limited to 'nuttx/sched')
-rw-r--r--nuttx/sched/sig_deliver.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/nuttx/sched/sig_deliver.c b/nuttx/sched/sig_deliver.c
index bb6ca71a4..9b1e8cebe 100644
--- a/nuttx/sched/sig_deliver.c
+++ b/nuttx/sched/sig_deliver.c
@@ -136,12 +136,25 @@ void sig_deliver(FAR struct tcb_s *stcb)
#ifdef CONFIG_NUTTX_KERNEL
if ((stcb->flags & TCB_FLAG_TTYPE_MASK) != TCB_FLAG_TTYPE_KERNEL)
{
+ /* The sigq_t pointed to by sigq resides in kernel space. So we
+ * cannot pass a reference to sigq->info to the user space.
+ * Instead, we will copy the siginfo_t structure onto that stack.
+ * We are currently executing on the stack of the user thread
+ * (albeit temporarily in kernel mode), so the copy of the
+ * siginfo_t structure will be accessible by the user thread.
+ */
+
+ siginfo_t info;
+ memcpy(&info, sigq->info, sizeof(siginfo_t));
+
up_signal_handler(sigq->action.sighandler, sigq->info.si_signo,
- &sigq->info, NULL);
+ &info, NULL);
}
else
#endif
{
+ /* The kernel thread signal handler is much simpler. */
+
(*sigq->action.sighandler)(sigq->info.si_signo, &sigq->info,
NULL);
}