Skip to contentSkip to conversation

cgroups: fix a css_set not found bug in cgroup_attach_proc

PATCH Applied Mandeep Singh Baines 5 participants 7 messages Dec 15, 2011 – Dec 19, 2011 3 messages not in the archive cgroup

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cgroups: fix a css_set not found bug in cgroup_attach_proc

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.

Downstream-Bug-Report: http://crosbug.com/23953
Cc: Tejun Heo <[email protected]>
Cc: Li Zefan <[email protected]>
Cc: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
Cc: [email protected]
Cc: [email protected]
Cc: KAMEZAWA Hiroyuki <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Cc: Oleg Nesterov <[email protected]>
Cc: Andrew Morton <akpm-de/[email protected]>
Cc: Paul Menage <[email protected]>
Cc: Olof Johansson <[email protected]>

---
 kernel/cgroup.c |    5 -----
 1 files changed, 0 insertions(+), 5 deletions(-)
kernel/cgroup.c +0 -5
index d9d5648..a184470 100644
@@ -2098,11 +2098,6 @@ int cgroup_attach_proc(struct cgroup *cgrp, struct task_struct *leader)
 			continue;
 		/* get old css_set pointer */
 		task_lock(tsk);
-		if (tsk->flags & PF_EXITING) {
-			/* ignore this task if it's going away */
-			task_unlock(tsk);
-			continue;
-		}
 		oldcg = tsk->cgroups;
 		get_css_set(oldcg);
 		task_unlock(tsk);
Signature · 6 lines
1.7.3.1

--
To unsubscribe from this list: send the line "unsubscribe cgroups" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
maintainer
#1 lore raw
Quoted 20 lines · Mandeep Singh Baines

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.

Quoted 7 lines

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.

Looks safe to me. Li?

Thanks.

Signature · 5 lines
tejun
--
To unsubscribe from this list: send the line "unsubscribe cgroups" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#9 lore raw
In reply to a message not in the archive
Quoted 20 lines · Mandeep Singh Baines

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.

Quoted 7 lines

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.

Looks safe to me. Li?

Thanks.

Signature · 1 line
tejun
Reviewed-by
#2 lore raw
In reply to Tejun Heo
Quoted 24 lines · Tejun Heo
Quoted 23 lines · Mandeep Singh Baines

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:

Quoted 7 lines
Quoted 4 lines

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.

Looks safe to me. Li?

It should be fine.

Reviewed-by
#7 lore raw
In reply to a message not in the archive
Quoted 24 lines · Tejun Heo
Quoted 23 lines · Mandeep Singh Baines

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:

Quoted 7 lines
Quoted 4 lines

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.

Looks safe to me. Li?

It should be fine.

maintainer Applied
#3 lore raw
In reply to Li Zefan
Quoted 30 lines · Li Zefan
Quoted 29 lines · Tejun Heo
Quoted 27 lines · Mandeep Singh Baines

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.

Quoted 6 lines
Quoted 2 lines

Looks safe to me. Li?

It should be fine.

Applied to cgroup/for-fixes-3.2. Will push to Linus in a couple of days. It's already rc6 and a bit late tho.

Thank you.

Signature · 1 line
tejun
Applied
#5 lore raw
In reply to a message not in the archive
Quoted 30 lines · Li Zefan
Quoted 29 lines · Tejun Heo
Quoted 27 lines · Mandeep Singh Baines

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.

Quoted 6 lines
Quoted 2 lines

Looks safe to me. Li?

It should be fine.

Applied to cgroup/for-fixes-3.2. Will push to Linus in a couple of days. It's already rc6 and a bit late tho.

Thank you.

Signature · 1 line
tejun