Module: xenomai-jki Branch: for-upstream Commit: 7b37dfdaa2dd48bec0886113badb7e5195856277 URL: http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=7b37dfdaa2dd48bec0886113badb7e5195856277
Author: Jan Kiszka <jan.kis...@siemens.com> Date: Mon Jul 18 14:07:00 2011 +0200 nucleus: Fix racy Linux task state manipulation xnshadow_relax can race with do_sigwake_event on a different CPU /wrt manipulating the Linux task state. Fix this by taking nklock before calling clear_task_nowakeup. Signed-off-by: Jan Kiszka <jan.kis...@siemens.com> --- ksrc/nucleus/shadow.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/ksrc/nucleus/shadow.c b/ksrc/nucleus/shadow.c index fc0af8e..a228c91 100644 --- a/ksrc/nucleus/shadow.c +++ b/ksrc/nucleus/shadow.c @@ -1137,8 +1137,15 @@ void xnshadow_relax(int notify, int reason) splmax(); rpi_push(thread->sched, thread); schedule_linux_call(LO_WAKEUP_REQ, current, 0); + + /* + * Task nklock to synchronize the Linux task state manipulation with + * do_sigwake_event. nklock will be released by xnpod_suspend_thread. + */ + xnlock_get(&nklock); clear_task_nowakeup(current); xnpod_suspend_thread(thread, XNRELAX, XN_INFINITE, XN_RELATIVE, NULL); + splnone(); if (XENO_DEBUG(NUCLEUS) && rthal_current_domain != rthal_root_domain) xnpod_fatal("xnshadow_relax() failed for thread %s[%d]", _______________________________________________ Xenomai-git mailing list Xenomai-git@gna.org https://mail.gna.org/listinfo/xenomai-git