Module: xenomai-jki Branch: for-upstream Commit: a1a2d8bc70a3b12521dab08d3423fc354bede39a URL: http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=a1a2d8bc70a3b12521dab08d3423fc354bede39a
Author: Jan Kiszka <[email protected]> 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 <[email protected]> --- 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 [email protected] https://mail.gna.org/listinfo/xenomai-git
