Re: [Patch 13/21] Freeze / Thaw threads

From: Oleg Nesterov
Date: Tue Dec 14 2010 - 11:24:42 EST


On 12/14, Suzuki K. Poulose wrote:
>
> @@ -148,6 +159,21 @@ static int open_gencore(struct inode *in
> list_add(&cp->list, &core_list);
> mutex_unlock(&core_mutex);
>
> + /* freeze the processes */
> + t = task;
> + read_lock(&tasklist_lock);
> + do {
> + if (frozen(t) || !freezeable(t) || freezing(t))
> + continue;
> +
> + if (freeze_task(t, true))
> + continue;
> +
> + if (task_is_stopped_or_traced(t))
> + continue;
> + } while ((t = next_thread(t)) != task);
> + read_unlock(&tasklist_lock);

Ooooh. Sorry, I dislike this approach very much.

Firstly, I can't understand why this can't race with the kernel
doing freeze/thaw.

But the main problem is: these series adds the new and nice way
to create the unkillable processes. This can't be good.

Say, until you close this file, even oom-killer can't kill it.
It is easy to DoS the system. Just fork the new processes which
use the memory and freeze them.

And, given that we have to handle task_is_stopped_or_traced()
tasks correctly anyway, I think gencore should rely on STOPPED/
TRACED and doesn't use freezer at all.

> + } while ((t = next_thread(t)) != task);

while_each_thread()

Oleg.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/