diff options
Diffstat (limited to 'fs/proc/array.c')
-rw-r--r-- | fs/proc/array.c | 42 |
1 files changed, 27 insertions, 15 deletions
diff --git a/fs/proc/array.c b/fs/proc/array.c index f4bc0e789539..7e4877d9dcb5 100644 --- a/fs/proc/array.c +++ b/fs/proc/array.c | |||
@@ -40,7 +40,7 @@ | |||
40 | * | 40 | * |
41 | * | 41 | * |
42 | * Alan Cox : security fixes. | 42 | * Alan Cox : security fixes. |
43 | * <Alan.Cox@linux.org> | 43 | * <alan@lxorguk.ukuu.org.uk> |
44 | * | 44 | * |
45 | * Al Viro : safe handling of mm_struct | 45 | * Al Viro : safe handling of mm_struct |
46 | * | 46 | * |
@@ -159,6 +159,7 @@ static inline void task_state(struct seq_file *m, struct pid_namespace *ns, | |||
159 | struct group_info *group_info; | 159 | struct group_info *group_info; |
160 | int g; | 160 | int g; |
161 | struct fdtable *fdt = NULL; | 161 | struct fdtable *fdt = NULL; |
162 | const struct cred *cred; | ||
162 | pid_t ppid, tpid; | 163 | pid_t ppid, tpid; |
163 | 164 | ||
164 | rcu_read_lock(); | 165 | rcu_read_lock(); |
@@ -170,6 +171,7 @@ static inline void task_state(struct seq_file *m, struct pid_namespace *ns, | |||
170 | if (tracer) | 171 | if (tracer) |
171 | tpid = task_pid_nr_ns(tracer, ns); | 172 | tpid = task_pid_nr_ns(tracer, ns); |
172 | } | 173 | } |
174 | cred = get_cred((struct cred *) __task_cred(p)); | ||
173 | seq_printf(m, | 175 | seq_printf(m, |
174 | "State:\t%s\n" | 176 | "State:\t%s\n" |
175 | "Tgid:\t%d\n" | 177 | "Tgid:\t%d\n" |
@@ -182,8 +184,8 @@ static inline void task_state(struct seq_file *m, struct pid_namespace *ns, | |||
182 | task_tgid_nr_ns(p, ns), | 184 | task_tgid_nr_ns(p, ns), |
183 | pid_nr_ns(pid, ns), | 185 | pid_nr_ns(pid, ns), |
184 | ppid, tpid, | 186 | ppid, tpid, |
185 | p->uid, p->euid, p->suid, p->fsuid, | 187 | cred->uid, cred->euid, cred->suid, cred->fsuid, |
186 | p->gid, p->egid, p->sgid, p->fsgid); | 188 | cred->gid, cred->egid, cred->sgid, cred->fsgid); |
187 | 189 | ||
188 | task_lock(p); | 190 | task_lock(p); |
189 | if (p->files) | 191 | if (p->files) |
@@ -194,13 +196,12 @@ static inline void task_state(struct seq_file *m, struct pid_namespace *ns, | |||
194 | fdt ? fdt->max_fds : 0); | 196 | fdt ? fdt->max_fds : 0); |
195 | rcu_read_unlock(); | 197 | rcu_read_unlock(); |
196 | 198 | ||
197 | group_info = p->group_info; | 199 | group_info = cred->group_info; |
198 | get_group_info(group_info); | ||
199 | task_unlock(p); | 200 | task_unlock(p); |
200 | 201 | ||
201 | for (g = 0; g < min(group_info->ngroups, NGROUPS_SMALL); g++) | 202 | for (g = 0; g < min(group_info->ngroups, NGROUPS_SMALL); g++) |
202 | seq_printf(m, "%d ", GROUP_AT(group_info, g)); | 203 | seq_printf(m, "%d ", GROUP_AT(group_info, g)); |
203 | put_group_info(group_info); | 204 | put_cred(cred); |
204 | 205 | ||
205 | seq_printf(m, "\n"); | 206 | seq_printf(m, "\n"); |
206 | } | 207 | } |
@@ -262,7 +263,7 @@ static inline void task_sig(struct seq_file *m, struct task_struct *p) | |||
262 | blocked = p->blocked; | 263 | blocked = p->blocked; |
263 | collect_sigign_sigcatch(p, &ignored, &caught); | 264 | collect_sigign_sigcatch(p, &ignored, &caught); |
264 | num_threads = atomic_read(&p->signal->count); | 265 | num_threads = atomic_read(&p->signal->count); |
265 | qsize = atomic_read(&p->user->sigpending); | 266 | qsize = atomic_read(&__task_cred(p)->user->sigpending); |
266 | qlim = p->signal->rlim[RLIMIT_SIGPENDING].rlim_cur; | 267 | qlim = p->signal->rlim[RLIMIT_SIGPENDING].rlim_cur; |
267 | unlock_task_sighand(p, &flags); | 268 | unlock_task_sighand(p, &flags); |
268 | } | 269 | } |
@@ -293,10 +294,21 @@ static void render_cap_t(struct seq_file *m, const char *header, | |||
293 | 294 | ||
294 | static inline void task_cap(struct seq_file *m, struct task_struct *p) | 295 | static inline void task_cap(struct seq_file *m, struct task_struct *p) |
295 | { | 296 | { |
296 | render_cap_t(m, "CapInh:\t", &p->cap_inheritable); | 297 | const struct cred *cred; |
297 | render_cap_t(m, "CapPrm:\t", &p->cap_permitted); | 298 | kernel_cap_t cap_inheritable, cap_permitted, cap_effective, cap_bset; |
298 | render_cap_t(m, "CapEff:\t", &p->cap_effective); | 299 | |
299 | render_cap_t(m, "CapBnd:\t", &p->cap_bset); | 300 | rcu_read_lock(); |
301 | cred = __task_cred(p); | ||
302 | cap_inheritable = cred->cap_inheritable; | ||
303 | cap_permitted = cred->cap_permitted; | ||
304 | cap_effective = cred->cap_effective; | ||
305 | cap_bset = cred->cap_bset; | ||
306 | rcu_read_unlock(); | ||
307 | |||
308 | render_cap_t(m, "CapInh:\t", &cap_inheritable); | ||
309 | render_cap_t(m, "CapPrm:\t", &cap_permitted); | ||
310 | render_cap_t(m, "CapEff:\t", &cap_effective); | ||
311 | render_cap_t(m, "CapBnd:\t", &cap_bset); | ||
300 | } | 312 | } |
301 | 313 | ||
302 | static inline void task_context_switch_counts(struct seq_file *m, | 314 | static inline void task_context_switch_counts(struct seq_file *m, |
@@ -388,20 +400,20 @@ static int do_task_stat(struct seq_file *m, struct pid_namespace *ns, | |||
388 | 400 | ||
389 | /* add up live thread stats at the group level */ | 401 | /* add up live thread stats at the group level */ |
390 | if (whole) { | 402 | if (whole) { |
403 | struct task_cputime cputime; | ||
391 | struct task_struct *t = task; | 404 | struct task_struct *t = task; |
392 | do { | 405 | do { |
393 | min_flt += t->min_flt; | 406 | min_flt += t->min_flt; |
394 | maj_flt += t->maj_flt; | 407 | maj_flt += t->maj_flt; |
395 | utime = cputime_add(utime, task_utime(t)); | ||
396 | stime = cputime_add(stime, task_stime(t)); | ||
397 | gtime = cputime_add(gtime, task_gtime(t)); | 408 | gtime = cputime_add(gtime, task_gtime(t)); |
398 | t = next_thread(t); | 409 | t = next_thread(t); |
399 | } while (t != task); | 410 | } while (t != task); |
400 | 411 | ||
401 | min_flt += sig->min_flt; | 412 | min_flt += sig->min_flt; |
402 | maj_flt += sig->maj_flt; | 413 | maj_flt += sig->maj_flt; |
403 | utime = cputime_add(utime, sig->utime); | 414 | thread_group_cputime(task, &cputime); |
404 | stime = cputime_add(stime, sig->stime); | 415 | utime = cputime.utime; |
416 | stime = cputime.stime; | ||
405 | gtime = cputime_add(gtime, sig->gtime); | 417 | gtime = cputime_add(gtime, sig->gtime); |
406 | } | 418 | } |
407 | 419 | ||