diff options
author | Mandeep Singh Baines <msb@chromium.org> | 2011-12-15 14:36:43 -0500 |
---|---|---|
committer | Brad Figg <brad.figg@canonical.com> | 2012-01-23 18:35:57 -0500 |
commit | 908697d3b59131428017560d2acc780be4dd1f6c (patch) | |
tree | 8f2ad41f43e53a74d09e088ce01e6bbd8034dd38 /kernel | |
parent | c87258cc681170edf7878546b4e06b188552dada (diff) |
cgroups: fix a css_set not found bug in cgroup_attach_proc
BugLink: http://bugs.launchpad.net/bugs/913373
commit e0197aae59e55c06db172bfbe1a1cdb8c0e1cab3 upstream.
There is a BUG when migrating a PF_EXITING proc. Since css_set_prefetch()
is not called for the PF_EXITING case, find_existing_css_set() will return
NULL inside cgroup_task_migrate() causing a BUG.
This bug is easy to reproduce. Create a zombie and echo its pid to
cgroup.procs.
$ cat zombie.c
\#include <unistd.h>
int main()
{
if (fork())
pause();
return 0;
}
$
We are hitting this bug pretty regularly on ChromeOS.
This bug is already fixed by Tejun Heo's cgroup patchset which is
targetted for the next merge window:
https://lkml.org/lkml/2011/11/1/356
I've create a smaller patch here which just fixes this bug so that a
fix can be merged into the current release and stable.
Signed-off-by: Mandeep Singh Baines <msb@chromium.org>
Downstream-Bug-Report: http://crosbug.com/23953
Reviewed-by: Li Zefan <lizf@cn.fujitsu.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: containers@lists.linux-foundation.org
Cc: cgroups@vger.kernel.org
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Paul Menage <paul@paulmenage.org>
Cc: Olof Johansson <olofj@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Brad Figg <brad.figg@canonical.com>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/cgroup.c | 5 |
1 files changed, 0 insertions, 5 deletions
diff --git a/kernel/cgroup.c b/kernel/cgroup.c index 2731d115d72..575a5e78263 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c | |||
@@ -2095,11 +2095,6 @@ int cgroup_attach_proc(struct cgroup *cgrp, struct task_struct *leader) | |||
2095 | continue; | 2095 | continue; |
2096 | /* get old css_set pointer */ | 2096 | /* get old css_set pointer */ |
2097 | task_lock(tsk); | 2097 | task_lock(tsk); |
2098 | if (tsk->flags & PF_EXITING) { | ||
2099 | /* ignore this task if it's going away */ | ||
2100 | task_unlock(tsk); | ||
2101 | continue; | ||
2102 | } | ||
2103 | oldcg = tsk->cgroups; | 2098 | oldcg = tsk->cgroups; |
2104 | get_css_set(oldcg); | 2099 | get_css_set(oldcg); |
2105 | task_unlock(tsk); | 2100 | task_unlock(tsk); |