[Xenomai-git] Jan Kiszka : nucleus: Restore u_mode after failed hardening

2011-07-31 Thread GIT version control
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


[Xenomai-git] Jan Kiszka : nucleus: Restore u_mode after failed hardening

2011-07-28 Thread GIT version control
Module: xenomai-jki
Branch: for-upstream
Commit: 4de7606ff498370b9359b58fd82a794f2fdc2c46
URL:
http://git.xenomai.org/?p=xenomai-jki.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


[Xenomai-git] Jan Kiszka : nucleus: Restore u_mode after failed hardening

2011-07-19 Thread GIT version control
Module: xenomai-jki
Branch: for-upstream
Commit: a1a2d8bc70a3b12521dab08d3423fc354bede39a
URL:
http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=a1a2d8bc70a3b12521dab08d3423fc354bede39a

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 |   16 
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/ksrc/nucleus/shadow.c b/ksrc/nucleus/shadow.c
index 9d69af6..7e87d7c 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;
spl_t s;
 
 redo:
@@ -952,8 +952,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;
@@ -1004,7 +1006,8 @@ redo:
preempt_enable();
up(sched-gksync);
 
-   return -ERESTARTSYS;
+   err = -ERESTARTSYS;
+   goto failed;
}
 
sched-gktarget = thread;
@@ -1068,6 +1071,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