Commit 73507f335f406ff31ceb97b39fa76eaee00f4f26

Authored by Pavel Emelyanov
Committed by Linus Torvalds
1 parent b450129554

Handle pid namespaces in cgroups code

There's one place that works with task pids - its the "tasks" file in cgroups.
 The read/write handlers assume, that the pid values go to/come from the user
space and thus it is a virtual pid, i.e.  the pid as it is seen from inside a
namespace.

Tune the code accordingly.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Acked-by: Paul Menage <menage@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 1 changed file with 2 additions and 2 deletions Side-by-side Diff

... ... @@ -1269,7 +1269,7 @@
1269 1269  
1270 1270 if (pid) {
1271 1271 rcu_read_lock();
1272   - tsk = find_task_by_pid(pid);
  1272 + tsk = find_task_by_vpid(pid);
1273 1273 if (!tsk || tsk->flags & PF_EXITING) {
1274 1274 rcu_read_unlock();
1275 1275 return -ESRCH;
... ... @@ -1955,7 +1955,7 @@
1955 1955 while ((tsk = cgroup_iter_next(cgrp, &it))) {
1956 1956 if (unlikely(n == npids))
1957 1957 break;
1958   - pidarray[n++] = task_pid_nr(tsk);
  1958 + pidarray[n++] = task_pid_vnr(tsk);
1959 1959 }
1960 1960 cgroup_iter_end(cgrp, &it);
1961 1961 return n;