Module: xenomai-head
Branch: master
Commit: 4de7606ff498370b9359b58fd82a794f2fdc2c46
URL:    
http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=4de7606ff498370b9359b58fd82a794f2fdc2c46

Author: Jan Kiszka <jan.kis...@siemens.com>
Date:   Mon Jul 18 18:57:12 2011 +0200

nucleus: Restore u_mode after failed hardening

When we abort xnshadow_harden due to a pending signal, restore u_mode in
case XNRELAX was already cleared. This will deliver the right state to
user space while it runs the signal handler.

Signed-off-by: Jan Kiszka <jan.kis...@siemens.com>

---

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

diff --git a/ksrc/nucleus/shadow.c b/ksrc/nucleus/shadow.c
index fe7e504..fc0af8e 100644
--- a/ksrc/nucleus/shadow.c
+++ b/ksrc/nucleus/shadow.c
@@ -940,7 +940,7 @@ int xnshadow_harden(void)
        struct task_struct *this_task = current;
        struct xnthread *thread;
        struct xnsched *sched;
-       int cpu;
+       int cpu, err;
 
 redo:
        thread = xnshadow_thread(this_task);
@@ -951,8 +951,10 @@ redo:
        sched = xnpod_sched_slot(cpu);
 
        /* Grab the request token. */
-       if (down_interruptible(&sched->gksync))
-               return -ERESTARTSYS;
+       if (down_interruptible(&sched->gksync)) {
+               err = -ERESTARTSYS;
+               goto failed;
+       }
 
        if (thread->u_mode)
                *(thread->u_mode) = thread->state & ~XNRELAX;
@@ -1065,6 +1067,11 @@ redo:
        xnsched_resched_after_unlocked_switch();
 
        return 0;
+
+      failed:
+       if (thread->u_mode)
+               *(thread->u_mode) = thread->state;
+       return err;
 }
 EXPORT_SYMBOL_GPL(xnshadow_harden);
 


_______________________________________________
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git

Reply via email to