Re: [PATCH 2/2] kthread, cgroup: close race window where new kthreads can be migrated to non-root cgroups

From: Tejun Heo
Date: Thu Mar 16 2017 - 13:10:47 EST


Hello,

On Thu, Mar 16, 2017 at 05:17:57PM +0100, Oleg Nesterov wrote:
> But this also means that __cgroup_procs_write() will always fail if
> this task is a kernel thread which was not created by kthread_create().
>
> Currently you can use kernel_thread() (although you shouldn't) and it
> can be migrated, this won't work after your patch.

I see what you mean now. The only users seem to be init/main.c and
kernel/kmod.c. I'll see if there's a way we can do this only for
kthread_create() users.

Thanks.

--
tejun