lkml.org 
[lkml]   [2012]   [Apr]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: [patch] cgroups: disallow attaching kthreadd
    From
    Date
    On Tue, 2012-04-03 at 11:49 -0700, Tejun Heo wrote: 
    > On Tue, Apr 03, 2012 at 07:58:26PM +0200, Mike Galbraith wrote:
    > > @@ -1894,6 +1895,14 @@ int cgroup_attach_task(struct cgroup *cg
    > > if (tsk->flags & PF_EXITING)
    > > return -ESRCH;
    > >
    > > + /*
    > > + * Workqueue threads may acquire PF_THREAD_BOUND and become
    > > + * trapped in a cpuset, or RT worker may be born in a cgroup
    > > + * with no rt_runtime allocated. Just say no.
    > > + */
    > > + if (tsk == kthreadd_task)
    > > + return -EINVAL;
    > > +
    > > /* Nothing to do if the task is already in that cgroup */
    > > oldcgrp = task_cgroup_from_root(tsk, root);
    > > if (cgrp == oldcgrp)
    > > @@ -2172,6 +2181,17 @@ static int attach_task_by_pid(struct cgr
    > >
    > > if (threadgroup)
    > > tsk = tsk->group_leader;
    > > +
    > > + /*
    > > + * Workqueue threads may acquire PF_THREAD_BOUND and become
    > > + * trapped in a cpuset, or RT worker may be born in a cgroup
    > > + * with no rt_runtime allocated. Just say no.
    > > + */
    > > + if (tsk == kthreadd_task) {
    > > + ret = -EINVAL;
    > > + goto out_unlock_cgroup;
    > > + }
    >
    > If we have this test here, do we need the same check in
    > cgroup_attach_task()/

    It looked to me like yes, because cgroup_attach_task() can be called
    directly. For the problem at hand, user script doing bad things, no,
    it's not needed.

    -Mike



    \
     
     \ /
      Last update: 2012-04-04 04:37    [W:0.022 / U:88.752 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site