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.c32
1 files changed, 25 insertions, 7 deletions
diff --git a/fs/proc/array.c b/fs/proc/array.c
index c1c207c36cae..cbd0f1b324b9 100644
--- a/fs/proc/array.c
+++ b/fs/proc/array.c
@@ -143,6 +143,7 @@ static const char * const task_state_array[] = {
143 "x (dead)", /* 64 */ 143 "x (dead)", /* 64 */
144 "K (wakekill)", /* 128 */ 144 "K (wakekill)", /* 128 */
145 "W (waking)", /* 256 */ 145 "W (waking)", /* 256 */
146 "P (parked)", /* 512 */
146}; 147};
147 148
148static inline const char *get_task_state(struct task_struct *tsk) 149static inline const char *get_task_state(struct task_struct *tsk)
@@ -162,7 +163,7 @@ static inline const char *get_task_state(struct task_struct *tsk)
162static inline void task_state(struct seq_file *m, struct pid_namespace *ns, 163static inline void task_state(struct seq_file *m, struct pid_namespace *ns,
163 struct pid *pid, struct task_struct *p) 164 struct pid *pid, struct task_struct *p)
164{ 165{
165 struct user_namespace *user_ns = current_user_ns(); 166 struct user_namespace *user_ns = seq_user_ns(m);
166 struct group_info *group_info; 167 struct group_info *group_info;
167 int g; 168 int g;
168 struct fdtable *fdt = NULL; 169 struct fdtable *fdt = NULL;
@@ -212,7 +213,7 @@ static inline void task_state(struct seq_file *m, struct pid_namespace *ns,
212 group_info = cred->group_info; 213 group_info = cred->group_info;
213 task_unlock(p); 214 task_unlock(p);
214 215
215 for (g = 0; g < min(group_info->ngroups, NGROUPS_SMALL); g++) 216 for (g = 0; g < group_info->ngroups; g++)
216 seq_printf(m, "%d ", 217 seq_printf(m, "%d ",
217 from_kgid_munged(user_ns, GROUP_AT(group_info, g))); 218 from_kgid_munged(user_ns, GROUP_AT(group_info, g)));
218 put_cred(cred); 219 put_cred(cred);
@@ -220,7 +221,7 @@ static inline void task_state(struct seq_file *m, struct pid_namespace *ns,
220 seq_putc(m, '\n'); 221 seq_putc(m, '\n');
221} 222}
222 223
223static void render_sigset_t(struct seq_file *m, const char *header, 224void render_sigset_t(struct seq_file *m, const char *header,
224 sigset_t *set) 225 sigset_t *set)
225{ 226{
226 int i; 227 int i;
@@ -308,6 +309,10 @@ static void render_cap_t(struct seq_file *m, const char *header,
308 seq_putc(m, '\n'); 309 seq_putc(m, '\n');
309} 310}
310 311
312/* Remove non-existent capabilities */
313#define NORM_CAPS(v) (v.cap[CAP_TO_INDEX(CAP_LAST_CAP)] &= \
314 CAP_TO_MASK(CAP_LAST_CAP + 1) - 1)
315
311static inline void task_cap(struct seq_file *m, struct task_struct *p) 316static inline void task_cap(struct seq_file *m, struct task_struct *p)
312{ 317{
313 const struct cred *cred; 318 const struct cred *cred;
@@ -321,12 +326,24 @@ static inline void task_cap(struct seq_file *m, struct task_struct *p)
321 cap_bset = cred->cap_bset; 326 cap_bset = cred->cap_bset;
322 rcu_read_unlock(); 327 rcu_read_unlock();
323 328
329 NORM_CAPS(cap_inheritable);
330 NORM_CAPS(cap_permitted);
331 NORM_CAPS(cap_effective);
332 NORM_CAPS(cap_bset);
333
324 render_cap_t(m, "CapInh:\t", &cap_inheritable); 334 render_cap_t(m, "CapInh:\t", &cap_inheritable);
325 render_cap_t(m, "CapPrm:\t", &cap_permitted); 335 render_cap_t(m, "CapPrm:\t", &cap_permitted);
326 render_cap_t(m, "CapEff:\t", &cap_effective); 336 render_cap_t(m, "CapEff:\t", &cap_effective);
327 render_cap_t(m, "CapBnd:\t", &cap_bset); 337 render_cap_t(m, "CapBnd:\t", &cap_bset);
328} 338}
329 339
340static inline void task_seccomp(struct seq_file *m, struct task_struct *p)
341{
342#ifdef CONFIG_SECCOMP
343 seq_printf(m, "Seccomp:\t%d\n", p->seccomp.mode);
344#endif
345}
346
330static inline void task_context_switch_counts(struct seq_file *m, 347static inline void task_context_switch_counts(struct seq_file *m,
331 struct task_struct *p) 348 struct task_struct *p)
332{ 349{
@@ -360,6 +377,7 @@ int proc_pid_status(struct seq_file *m, struct pid_namespace *ns,
360 } 377 }
361 task_sig(m, task); 378 task_sig(m, task);
362 task_cap(m, task); 379 task_cap(m, task);
380 task_seccomp(m, task);
363 task_cpus_allowed(m, task); 381 task_cpus_allowed(m, task);
364 cpuset_task_status_allowed(m, task); 382 cpuset_task_status_allowed(m, task);
365 task_context_switch_counts(m, task); 383 task_context_switch_counts(m, task);
@@ -432,13 +450,13 @@ static int do_task_stat(struct seq_file *m, struct pid_namespace *ns,
432 do { 450 do {
433 min_flt += t->min_flt; 451 min_flt += t->min_flt;
434 maj_flt += t->maj_flt; 452 maj_flt += t->maj_flt;
435 gtime += t->gtime; 453 gtime += task_gtime(t);
436 t = next_thread(t); 454 t = next_thread(t);
437 } while (t != task); 455 } while (t != task);
438 456
439 min_flt += sig->min_flt; 457 min_flt += sig->min_flt;
440 maj_flt += sig->maj_flt; 458 maj_flt += sig->maj_flt;
441 thread_group_times(task, &utime, &stime); 459 thread_group_cputime_adjusted(task, &utime, &stime);
442 gtime += sig->gtime; 460 gtime += sig->gtime;
443 } 461 }
444 462
@@ -454,8 +472,8 @@ static int do_task_stat(struct seq_file *m, struct pid_namespace *ns,
454 if (!whole) { 472 if (!whole) {
455 min_flt = task->min_flt; 473 min_flt = task->min_flt;
456 maj_flt = task->maj_flt; 474 maj_flt = task->maj_flt;
457 task_times(task, &utime, &stime); 475 task_cputime_adjusted(task, &utime, &stime);
458 gtime = task->gtime; 476 gtime = task_gtime(task);
459 } 477 }
460 478
461 /* scale priority and nice values from timeslices to -20..20 */ 479 /* scale priority and nice values from timeslices to -20..20 */