diff --git a/ChangeLog b/ChangeLog
index 3c427ff2926..5d454cda3cc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4410,4 +4410,9 @@
all system call inline functions with > 3 parameters (2013-03-20)
* arch/*/src/common/up_stackframe.c and include/nuttx/arch.h: Add
and new interface to set aside memory on the stack. This will be
- used at least in the kernel build to hold task arguments 2013-03-21).
+ used at least in the kernel build to hold task arguments (2013-03-21).
+ * sched/sig_deliver.c: When dispatching signals to user threads,
+ copy the siginfo_t from the sigq to the stack. The signal queue
+ is allocated from kernel memory; however, the current stack is
+ the user's stack and the user code will be able to access the
+ signinfo_t data from the stack copy (2013-03-21).
diff --git a/Documentation/NuttxPortingGuide.html b/Documentation/NuttxPortingGuide.html
index 2fa0b2a71f8..a7082a0ec5b 100644
--- a/Documentation/NuttxPortingGuide.html
+++ b/Documentation/NuttxPortingGuide.html
@@ -1713,7 +1713,7 @@ The system can be re-made subsequently by just typing make.
This function may be called anytime after up_create_stack() or up_use_stack() have been called but before the task has been started.
- Thread data may be kept in the stack (instead of in the TCB) if it is accessed by the user code directory.
+ Thread data may be kept in the stack (instead of in the TCB) if it is accessed by the user code directly.
This includes such things as argv[].
The stack memory is guaranteed to be in the same protection domain as the thread.
diff --git a/arch/arm/src/common/up_stackframe.c b/arch/arm/src/common/up_stackframe.c
index 3720d334ac8..f509556aff9 100644
--- a/arch/arm/src/common/up_stackframe.c
+++ b/arch/arm/src/common/up_stackframe.c
@@ -96,7 +96,7 @@
* up_use_stack() have been called but before the task has been started.
*
* Thread data may be kept in the stack (instead of in the TCB) if it is
- * accessed by the user code directory. This includes such things as
+ * accessed by the user code directly. This includes such things as
* argv[]. The stack memory is guaranteed to be in the same protection
* domain as the thread.
*
diff --git a/arch/avr/src/avr/up_stackframe.c b/arch/avr/src/avr/up_stackframe.c
index 39253e2b563..f9748f2e7f8 100644
--- a/arch/avr/src/avr/up_stackframe.c
+++ b/arch/avr/src/avr/up_stackframe.c
@@ -73,7 +73,7 @@
* up_use_stack() have been called but before the task has been started.
*
* Thread data may be kept in the stack (instead of in the TCB) if it is
- * accessed by the user code directory. This includes such things as
+ * accessed by the user code directly. This includes such things as
* argv[]. The stack memory is guaranteed to be in the same protection
* domain as the thread.
*
diff --git a/arch/avr/src/avr32/up_stackframe.c b/arch/avr/src/avr32/up_stackframe.c
index 08c4cf51e69..d7c0a0fc349 100644
--- a/arch/avr/src/avr32/up_stackframe.c
+++ b/arch/avr/src/avr32/up_stackframe.c
@@ -85,7 +85,7 @@
* up_use_stack() have been called but before the task has been started.
*
* Thread data may be kept in the stack (instead of in the TCB) if it is
- * accessed by the user code directory. This includes such things as
+ * accessed by the user code directly. This includes such things as
* argv[]. The stack memory is guaranteed to be in the same protection
* domain as the thread.
*
diff --git a/arch/hc/src/common/up_stackframe.c b/arch/hc/src/common/up_stackframe.c
index 0daa4f7daa6..266881ec56a 100644
--- a/arch/hc/src/common/up_stackframe.c
+++ b/arch/hc/src/common/up_stackframe.c
@@ -85,7 +85,7 @@
* up_use_stack() have been called but before the task has been started.
*
* Thread data may be kept in the stack (instead of in the TCB) if it is
- * accessed by the user code directory. This includes such things as
+ * accessed by the user code directly. This includes such things as
* argv[]. The stack memory is guaranteed to be in the same protection
* domain as the thread.
*
diff --git a/arch/mips/src/common/up_stackframe.c b/arch/mips/src/common/up_stackframe.c
index 9b473ecc60c..fd055d5e6fc 100644
--- a/arch/mips/src/common/up_stackframe.c
+++ b/arch/mips/src/common/up_stackframe.c
@@ -88,7 +88,7 @@
* up_use_stack() have been called but before the task has been started.
*
* Thread data may be kept in the stack (instead of in the TCB) if it is
- * accessed by the user code directory. This includes such things as
+ * accessed by the user code directly. This includes such things as
* argv[]. The stack memory is guaranteed to be in the same protection
* domain as the thread.
*
diff --git a/arch/sh/src/common/up_stackframe.c b/arch/sh/src/common/up_stackframe.c
index b1ef4c6b4f6..f3e7f294ab1 100644
--- a/arch/sh/src/common/up_stackframe.c
+++ b/arch/sh/src/common/up_stackframe.c
@@ -84,7 +84,7 @@
* up_use_stack() have been called but before the task has been started.
*
* Thread data may be kept in the stack (instead of in the TCB) if it is
- * accessed by the user code directory. This includes such things as
+ * accessed by the user code directly. This includes such things as
* argv[]. The stack memory is guaranteed to be in the same protection
* domain as the thread.
*
diff --git a/arch/sim/src/up_stackframe.c b/arch/sim/src/up_stackframe.c
index 4d62e6ec050..f634005cb85 100644
--- a/arch/sim/src/up_stackframe.c
+++ b/arch/sim/src/up_stackframe.c
@@ -85,7 +85,7 @@
* up_use_stack() have been called but before the task has been started.
*
* Thread data may be kept in the stack (instead of in the TCB) if it is
- * accessed by the user code directory. This includes such things as
+ * accessed by the user code directly. This includes such things as
* argv[]. The stack memory is guaranteed to be in the same protection
* domain as the thread.
*
diff --git a/arch/x86/src/i486/up_stackframe.c b/arch/x86/src/i486/up_stackframe.c
index ea4edc07a3b..f2ab91f9512 100644
--- a/arch/x86/src/i486/up_stackframe.c
+++ b/arch/x86/src/i486/up_stackframe.c
@@ -86,7 +86,7 @@
* up_use_stack() have been called but before the task has been started.
*
* Thread data may be kept in the stack (instead of in the TCB) if it is
- * accessed by the user code directory. This includes such things as
+ * accessed by the user code directly. This includes such things as
* argv[]. The stack memory is guaranteed to be in the same protection
* domain as the thread.
*
diff --git a/arch/z16/src/common/up_stackframe.c b/arch/z16/src/common/up_stackframe.c
index c11106542d6..11eec6c2e37 100644
--- a/arch/z16/src/common/up_stackframe.c
+++ b/arch/z16/src/common/up_stackframe.c
@@ -84,7 +84,7 @@
* up_use_stack() have been called but before the task has been started.
*
* Thread data may be kept in the stack (instead of in the TCB) if it is
- * accessed by the user code directory. This includes such things as
+ * accessed by the user code directly. This includes such things as
* argv[]. The stack memory is guaranteed to be in the same protection
* domain as the thread.
*
diff --git a/arch/z80/src/common/up_stackframe.c b/arch/z80/src/common/up_stackframe.c
index 01a7b0881ae..2283116330a 100644
--- a/arch/z80/src/common/up_stackframe.c
+++ b/arch/z80/src/common/up_stackframe.c
@@ -84,7 +84,7 @@
* up_use_stack() have been called but before the task has been started.
*
* Thread data may be kept in the stack (instead of in the TCB) if it is
- * accessed by the user code directory. This includes such things as
+ * accessed by the user code directly. This includes such things as
* argv[]. The stack memory is guaranteed to be in the same protection
* domain as the thread.
*
diff --git a/include/nuttx/arch.h b/include/nuttx/arch.h
index 6595b391107..b8e62e6c2d5 100644
--- a/include/nuttx/arch.h
+++ b/include/nuttx/arch.h
@@ -228,7 +228,7 @@ int up_use_stack(FAR struct tcb_s *tcb, FAR void *stack, size_t stack_size);
* up_use_stack() have been called but before the task has been started.
*
* Thread data may be kept in the stack (instead of in the TCB) if it is
- * accessed by the user code directory. This includes such things as
+ * accessed by the user code directly. This includes such things as
* argv[]. The stack memory is guaranteed to be in the same protection
* domain as the thread.
*
diff --git a/sched/sig_deliver.c b/sched/sig_deliver.c
index bb6ca71a450..9b1e8cebe37 100644
--- a/sched/sig_deliver.c
+++ b/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);
}