[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <200705110043.15694.rjw@sisk.pl>
Date: Fri, 11 May 2007 00:43:14 +0200
From: "Rafael J. Wysocki" <rjw@...k.pl>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Gautham R Shenoy <ego@...ibm.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
LKML <linux-kernel@...r.kernel.org>,
Oleg Nesterov <oleg@...sign.ru>, Pavel Machek <pavel@....cz>,
"Eric W. Biederman" <ebiederm@...ssion.com>
Subject: [PATCH 6/7] Freezer: Fix PF_NOFREEZE vs freezeable race
From: Gautham R Shenoy <ego@...ibm.com>
This patch fixes the race pointed out by Oleg Nesterov.
* Freezer marks a thread as freezeable.
* The thread now marks itself PF_NOFREEZE, but it will be frozen on
on calling try_to_freeze(). Thus the task is frozen, even though it doesn't
want to.
* Subsequent thaw_processes() will also fail to thaw the task since it is
marked PF_NOFREEZE.
Avoid this problem by checking the task's PF_NOFREEZE status in
frozen_processes() before marking the task as frozen.
Signed-off-by: Gautham R Shenoy <ego@...ibm.com>
Signed-off-by: Rafael J. Wysocki <rjw@...k.pl>
---
include/linux/freezer.h | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
Index: linux-2.6/include/linux/freezer.h
===================================================================
--- linux-2.6.orig/include/linux/freezer.h 2007-05-10 21:44:36.000000000 +0200
+++ linux-2.6/include/linux/freezer.h 2007-05-10 21:44:47.000000000 +0200
@@ -63,8 +63,10 @@ static inline int thaw_process(struct ta
*/
static inline void frozen_process(struct task_struct *p)
{
- p->flags |= PF_FROZEN;
- wmb();
+ if (!unlikely(p->flags & PF_NOFREEZE)) {
+ p->flags |= PF_FROZEN;
+ wmb();
+ }
clear_tsk_thread_flag(p, TIF_FREEZE);
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists