]> git.baikalelectronics.ru Git - kernel.git/commit
cgroups: fix pid namespace bug
authorLi Zefan <lizf@cn.fujitsu.com>
Wed, 29 Jul 2009 22:04:04 +0000 (15:04 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 30 Jul 2009 02:10:35 +0000 (19:10 -0700)
commit9013c93d12375e6d68a01064a51d12c0813a7c58
tree755709b6d3ff21a9e9640d6c19432b31c863ad34
parent856a863e9cbabde446691c4568fb54530fbbb5d9
cgroups: fix pid namespace bug

The bug was introduced by commit 95bc85a10b84ff5f8860534b11bf9cc60d97a4c8
("cgroups: convert tasks file to use a seq_file with shared pid array").

We cache a pid array for all threads that are opening the same "tasks"
file, but the pids in the array are always from the namespace of the
last process that opened the file, so all other threads will read pids
from that namespace instead of their own namespaces.

To fix it, we maintain a list of pid arrays, which is keyed by pid_ns.
The list will be of length 1 at most time.

Reported-by: Paul Menage <menage@google.com>
Idea-by: Paul Menage <menage@google.com>
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Reviewed-by: Serge Hallyn <serue@us.ibm.com>
Cc: Balbir Singh <balbir@in.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
include/linux/cgroup.h
kernel/cgroup.c