aboutsummaryrefslogtreecommitdiffstats
path: root/fs/proc/array.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/proc/array.c')
-rw-r--r--fs/proc/array.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/fs/proc/array.c b/fs/proc/array.c
index 24f7f9f6684d..04b689f3288f 100644
--- a/fs/proc/array.c
+++ b/fs/proc/array.c
@@ -77,6 +77,7 @@
77#include <linux/cpuset.h> 77#include <linux/cpuset.h>
78#include <linux/rcupdate.h> 78#include <linux/rcupdate.h>
79#include <linux/delayacct.h> 79#include <linux/delayacct.h>
80#include <linux/pid_namespace.h>
80 81
81#include <asm/pgtable.h> 82#include <asm/pgtable.h>
82#include <asm/processor.h> 83#include <asm/processor.h>
@@ -161,8 +162,15 @@ static inline char *task_state(struct task_struct *p, char *buffer)
161 struct group_info *group_info; 162 struct group_info *group_info;
162 int g; 163 int g;
163 struct fdtable *fdt = NULL; 164 struct fdtable *fdt = NULL;
165 struct pid_namespace *ns;
166 pid_t ppid, tpid;
164 167
168 ns = current->nsproxy->pid_ns;
165 rcu_read_lock(); 169 rcu_read_lock();
170 ppid = pid_alive(p) ?
171 task_tgid_nr_ns(rcu_dereference(p->real_parent), ns) : 0;
172 tpid = pid_alive(p) && p->ptrace ?
173 task_ppid_nr_ns(rcu_dereference(p->parent), ns) : 0;
166 buffer += sprintf(buffer, 174 buffer += sprintf(buffer,
167 "State:\t%s\n" 175 "State:\t%s\n"
168 "Tgid:\t%d\n" 176 "Tgid:\t%d\n"
@@ -172,9 +180,9 @@ static inline char *task_state(struct task_struct *p, char *buffer)
172 "Uid:\t%d\t%d\t%d\t%d\n" 180 "Uid:\t%d\t%d\t%d\t%d\n"
173 "Gid:\t%d\t%d\t%d\t%d\n", 181 "Gid:\t%d\t%d\t%d\t%d\n",
174 get_task_state(p), 182 get_task_state(p),
175 p->tgid, p->pid, 183 task_tgid_nr_ns(p, ns),
176 pid_alive(p) ? rcu_dereference(p->real_parent)->tgid : 0, 184 task_pid_nr_ns(p, ns),
177 pid_alive(p) && p->ptrace ? rcu_dereference(p->parent)->pid : 0, 185 ppid, tpid,
178 p->uid, p->euid, p->suid, p->fsuid, 186 p->uid, p->euid, p->suid, p->fsuid,
179 p->gid, p->egid, p->sgid, p->fsgid); 187 p->gid, p->egid, p->sgid, p->fsgid);
180 188
@@ -394,6 +402,9 @@ static int do_task_stat(struct task_struct *task, char *buffer, int whole)
394 unsigned long rsslim = 0; 402 unsigned long rsslim = 0;
395 char tcomm[sizeof(task->comm)]; 403 char tcomm[sizeof(task->comm)];
396 unsigned long flags; 404 unsigned long flags;
405 struct pid_namespace *ns;
406
407 ns = current->nsproxy->pid_ns;
397 408
398 state = *get_task_state(task); 409 state = *get_task_state(task);
399 vsize = eip = esp = 0; 410 vsize = eip = esp = 0;
@@ -416,7 +427,7 @@ static int do_task_stat(struct task_struct *task, char *buffer, int whole)
416 struct signal_struct *sig = task->signal; 427 struct signal_struct *sig = task->signal;
417 428
418 if (sig->tty) { 429 if (sig->tty) {
419 tty_pgrp = pid_nr(sig->tty->pgrp); 430 tty_pgrp = pid_nr_ns(sig->tty->pgrp, ns);
420 tty_nr = new_encode_dev(tty_devnum(sig->tty)); 431 tty_nr = new_encode_dev(tty_devnum(sig->tty));
421 } 432 }
422 433
@@ -449,9 +460,9 @@ static int do_task_stat(struct task_struct *task, char *buffer, int whole)
449 gtime += cputime_add(gtime, sig->gtime); 460 gtime += cputime_add(gtime, sig->gtime);
450 } 461 }
451 462
452 sid = task_session_nr(task); 463 sid = task_session_nr_ns(task, ns);
453 pgid = task_pgrp_nr(task); 464 pgid = task_pgrp_nr_ns(task, ns);
454 ppid = rcu_dereference(task->real_parent)->tgid; 465 ppid = task_ppid_nr_ns(task, ns);
455 466
456 unlock_task_sighand(task, &flags); 467 unlock_task_sighand(task, &flags);
457 } 468 }
@@ -483,7 +494,7 @@ static int do_task_stat(struct task_struct *task, char *buffer, int whole)
483 res = sprintf(buffer, "%d (%s) %c %d %d %d %d %d %u %lu \ 494 res = sprintf(buffer, "%d (%s) %c %d %d %d %d %d %u %lu \
484%lu %lu %lu %lu %lu %ld %ld %ld %ld %d 0 %llu %lu %ld %lu %lu %lu %lu %lu \ 495%lu %lu %lu %lu %lu %ld %ld %ld %ld %d 0 %llu %lu %ld %lu %lu %lu %lu %lu \
485%lu %lu %lu %lu %lu %lu %lu %lu %d %d %u %u %llu %lu %ld\n", 496%lu %lu %lu %lu %lu %lu %lu %lu %d %d %u %u %llu %lu %ld\n",
486 task->pid, 497 task_pid_nr_ns(task, ns),
487 tcomm, 498 tcomm,
488 state, 499 state,
489 ppid, 500 ppid,