Module: xenomai-head
Branch: master
Commit: 6e13053621b0ee107cf13ceafe492f1032e5b760

Author: Philippe Gerum <>
Date:   Fri Mar 25 10:37:45 2011 +0100

nucleus/shadow: require lostage for __xn_sys_sem_heap

We may get into a page fault due to ondemand mapping when copying the
heap descriptor back to userland in xnshadow_sys_sem_heap(), prior to
relaying faults to the nucleus, since the calling thread is not yet
mapped at this stage, therefore the CPU exceptions are not routed
through the nucleus yet for this thread.

In this case, leaving the exec bits for __xn_sys_sem_heap syscall as
__xn_exec_any would cause the Linux page fault handler to run over the
Xenomai domain, with no interception from the nucleus to downgrade the
stage to the Linux one.

We tag __xn_sys_sem_heap with the __xn_exec_lostage exec bits to
prevent this.


 ksrc/nucleus/shadow.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/ksrc/nucleus/shadow.c b/ksrc/nucleus/shadow.c
index 7647885..667195c 100644
--- a/ksrc/nucleus/shadow.c
+++ b/ksrc/nucleus/shadow.c
@@ -2164,7 +2164,7 @@ static xnsysent_t __systab[] = {
        [__xn_sys_completion] = {&xnshadow_sys_completion, __xn_exec_lostage},
        [__xn_sys_barrier] = {&xnshadow_sys_barrier, __xn_exec_lostage},
        [__xn_sys_trace] = {&xnshadow_sys_trace, __xn_exec_any},
-       [__xn_sys_sem_heap] = {&xnshadow_sys_sem_heap, __xn_exec_any},
+       [__xn_sys_sem_heap] = {&xnshadow_sys_sem_heap, __xn_exec_lostage},
        [__xn_sys_current] = {&xnshadow_sys_current, __xn_exec_any},
        [__xn_sys_current_info] =
                {&xnshadow_sys_current_info, __xn_exec_shadow},

Xenomai-git mailing list

Reply via email to