* [PATCH 1/3] fix kthread_create() vs freezer theoretical race
@ 2007-04-13 13:01 Oleg Nesterov
2007-04-13 23:13 ` Eric W. Biederman
0 siblings, 1 reply; 2+ messages in thread
From: Oleg Nesterov @ 2007-04-13 13:01 UTC (permalink / raw)
To: Andrew Morton
Cc: Davide Libenzi, Eric W. Biederman, Ingo Molnar, Linus Torvalds,
Rafael J. Wysocki, Roland McGrath, Rusty Russell, linux-kernel
kthread() sleeps in TASK_INTERRUPTIBLE state waiting for the first wakeup.
In theory, this wakeup may come from freeze_process()->signal_wake_up(),
so the task can disappear even before kthread_create() sets its ->comm.
Change kthread() to use TASK_UNINTERRUPTIBLE.
Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
--- 2.6.21-rc5/kernel/kthread.c~0_FREEZER 2007-04-13 14:52:44.000000000 +0400
+++ 2.6.21-rc5/kernel/kthread.c 2007-04-13 15:36:43.000000000 +0400
@@ -70,7 +70,7 @@ static int kthread(void *_create)
data = create->data;
/* OK, tell user we're spawned, wait for stop or wakeup */
- __set_current_state(TASK_INTERRUPTIBLE);
+ __set_current_state(TASK_UNINTERRUPTIBLE);
complete(&create->started);
schedule();
@@ -174,7 +174,7 @@ EXPORT_SYMBOL(kthread_create);
*/
void kthread_bind(struct task_struct *k, unsigned int cpu)
{
- BUG_ON(k->state != TASK_INTERRUPTIBLE);
+ BUG_ON(k->state != TASK_UNINTERRUPTIBLE);
/* Must have done schedule() in kthread() before we set_task_cpu */
wait_task_inactive(k);
set_task_cpu(k, cpu);
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH 1/3] fix kthread_create() vs freezer theoretical race
2007-04-13 13:01 [PATCH 1/3] fix kthread_create() vs freezer theoretical race Oleg Nesterov
@ 2007-04-13 23:13 ` Eric W. Biederman
0 siblings, 0 replies; 2+ messages in thread
From: Eric W. Biederman @ 2007-04-13 23:13 UTC (permalink / raw)
To: Oleg Nesterov
Cc: Andrew Morton, Davide Libenzi, Ingo Molnar, Linus Torvalds,
Rafael J. Wysocki, Roland McGrath, Rusty Russell, linux-kernel
Oleg Nesterov <oleg@tv-sign.ru> writes:
> kthread() sleeps in TASK_INTERRUPTIBLE state waiting for the first wakeup.
> In theory, this wakeup may come from freeze_process()->signal_wake_up(),
> so the task can disappear even before kthread_create() sets its ->comm.
>
> Change kthread() to use TASK_UNINTERRUPTIBLE.
Yep. That makes sense.
Acked-by: "Eric W. Biederman" <ebiederm@xmission.com>
>
> Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
>
> --- 2.6.21-rc5/kernel/kthread.c~0_FREEZER 2007-04-13 14:52:44.000000000 +0400
> +++ 2.6.21-rc5/kernel/kthread.c 2007-04-13 15:36:43.000000000 +0400
> @@ -70,7 +70,7 @@ static int kthread(void *_create)
> data = create->data;
>
> /* OK, tell user we're spawned, wait for stop or wakeup */
> - __set_current_state(TASK_INTERRUPTIBLE);
> + __set_current_state(TASK_UNINTERRUPTIBLE);
> complete(&create->started);
> schedule();
>
> @@ -174,7 +174,7 @@ EXPORT_SYMBOL(kthread_create);
> */
> void kthread_bind(struct task_struct *k, unsigned int cpu)
> {
> - BUG_ON(k->state != TASK_INTERRUPTIBLE);
> + BUG_ON(k->state != TASK_UNINTERRUPTIBLE);
> /* Must have done schedule() in kthread() before we set_task_cpu */
> wait_task_inactive(k);
> set_task_cpu(k, cpu);
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-04-13 23:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-13 13:01 [PATCH 1/3] fix kthread_create() vs freezer theoretical race Oleg Nesterov
2007-04-13 23:13 ` Eric W. Biederman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome