aboutsummaryrefslogtreecommitdiffstats
path: root/fs/proc
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-12-17 23:58:12 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-12-17 23:58:12 -0500
commit848b81415c42ff3dc9a4204749087b015c37ef66 (patch)
tree391da3a73aea48632248220d2d6b8d45a88f7eae /fs/proc
parent992956189de58cae9f2be40585bc25105cd7c5ad (diff)
parent6fd59a83b9261fa53eaf98fb5514abba504a3ea3 (diff)
Merge branch 'akpm' (Andrew's patch-bomb)
Merge misc patches from Andrew Morton: "Incoming: - lots of misc stuff - backlight tree updates - lib/ updates - Oleg's percpu-rwsem changes - checkpatch - rtc - aoe - more checkpoint/restart support I still have a pile of MM stuff pending - Pekka should be merging later today after which that is good to go. A number of other things are twiddling thumbs awaiting maintainer merges." * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (180 commits) scatterlist: don't BUG when we can trivially return a proper error. docs: update documentation about /proc/<pid>/fdinfo/<fd> fanotify output fs, fanotify: add @mflags field to fanotify output docs: add documentation about /proc/<pid>/fdinfo/<fd> output fs, notify: add procfs fdinfo helper fs, exportfs: add exportfs_encode_inode_fh() helper fs, exportfs: escape nil dereference if no s_export_op present fs, epoll: add procfs fdinfo helper fs, eventfd: add procfs fdinfo helper procfs: add ability to plug in auxiliary fdinfo providers tools/testing/selftests/kcmp/kcmp_test.c: print reason for failure in kcmp_test breakpoint selftests: print failure status instead of cause make error kcmp selftests: print fail status instead of cause make error kcmp selftests: make run_tests fix mem-hotplug selftests: print failure status instead of cause make error cpu-hotplug selftests: print failure status instead of cause make error mqueue selftests: print failure status instead of cause make error vm selftests: print failure status instead of cause make error ubifs: use prandom_bytes mtd: nandsim: use prandom_bytes ...
Diffstat (limited to 'fs/proc')
-rw-r--r--fs/proc/array.c21
-rw-r--r--fs/proc/fd.c2
-rw-r--r--fs/proc/proc_devtree.c6
-rw-r--r--fs/proc/task_mmu.c53
4 files changed, 75 insertions, 7 deletions
diff --git a/fs/proc/array.c b/fs/proc/array.c
index d66248a1919b..6a91e6ffbcbd 100644
--- a/fs/proc/array.c
+++ b/fs/proc/array.c
@@ -212,7 +212,7 @@ static inline void task_state(struct seq_file *m, struct pid_namespace *ns,
212 group_info = cred->group_info; 212 group_info = cred->group_info;
213 task_unlock(p); 213 task_unlock(p);
214 214
215 for (g = 0; g < min(group_info->ngroups, NGROUPS_SMALL); g++) 215 for (g = 0; g < group_info->ngroups; g++)
216 seq_printf(m, "%d ", 216 seq_printf(m, "%d ",
217 from_kgid_munged(user_ns, GROUP_AT(group_info, g))); 217 from_kgid_munged(user_ns, GROUP_AT(group_info, g)));
218 put_cred(cred); 218 put_cred(cred);
@@ -220,7 +220,7 @@ static inline void task_state(struct seq_file *m, struct pid_namespace *ns,
220 seq_putc(m, '\n'); 220 seq_putc(m, '\n');
221} 221}
222 222
223static void render_sigset_t(struct seq_file *m, const char *header, 223void render_sigset_t(struct seq_file *m, const char *header,
224 sigset_t *set) 224 sigset_t *set)
225{ 225{
226 int i; 226 int i;
@@ -308,6 +308,10 @@ static void render_cap_t(struct seq_file *m, const char *header,
308 seq_putc(m, '\n'); 308 seq_putc(m, '\n');
309} 309}
310 310
311/* Remove non-existent capabilities */
312#define NORM_CAPS(v) (v.cap[CAP_TO_INDEX(CAP_LAST_CAP)] &= \
313 CAP_TO_MASK(CAP_LAST_CAP + 1) - 1)
314
311static inline void task_cap(struct seq_file *m, struct task_struct *p) 315static inline void task_cap(struct seq_file *m, struct task_struct *p)
312{ 316{
313 const struct cred *cred; 317 const struct cred *cred;
@@ -321,12 +325,24 @@ static inline void task_cap(struct seq_file *m, struct task_struct *p)
321 cap_bset = cred->cap_bset; 325 cap_bset = cred->cap_bset;
322 rcu_read_unlock(); 326 rcu_read_unlock();
323 327
328 NORM_CAPS(cap_inheritable);
329 NORM_CAPS(cap_permitted);
330 NORM_CAPS(cap_effective);
331 NORM_CAPS(cap_bset);
332
324 render_cap_t(m, "CapInh:\t", &cap_inheritable); 333 render_cap_t(m, "CapInh:\t", &cap_inheritable);
325 render_cap_t(m, "CapPrm:\t", &cap_permitted); 334 render_cap_t(m, "CapPrm:\t", &cap_permitted);
326 render_cap_t(m, "CapEff:\t", &cap_effective); 335 render_cap_t(m, "CapEff:\t", &cap_effective);
327 render_cap_t(m, "CapBnd:\t", &cap_bset); 336 render_cap_t(m, "CapBnd:\t", &cap_bset);
328} 337}
329 338
339static inline void task_seccomp(struct seq_file *m, struct task_struct *p)
340{
341#ifdef CONFIG_SECCOMP
342 seq_printf(m, "Seccomp:\t%d\n", p->seccomp.mode);
343#endif
344}
345
330static inline void task_context_switch_counts(struct seq_file *m, 346static inline void task_context_switch_counts(struct seq_file *m,
331 struct task_struct *p) 347 struct task_struct *p)
332{ 348{
@@ -360,6 +376,7 @@ int proc_pid_status(struct seq_file *m, struct pid_namespace *ns,
360 } 376 }
361 task_sig(m, task); 377 task_sig(m, task);
362 task_cap(m, task); 378 task_cap(m, task);
379 task_seccomp(m, task);
363 task_cpus_allowed(m, task); 380 task_cpus_allowed(m, task);
364 cpuset_task_status_allowed(m, task); 381 cpuset_task_status_allowed(m, task);
365 task_context_switch_counts(m, task); 382 task_context_switch_counts(m, task);
diff --git a/fs/proc/fd.c b/fs/proc/fd.c
index f28a875f8779..d7a4a28ef630 100644
--- a/fs/proc/fd.c
+++ b/fs/proc/fd.c
@@ -50,6 +50,8 @@ static int seq_show(struct seq_file *m, void *v)
50 if (!ret) { 50 if (!ret) {
51 seq_printf(m, "pos:\t%lli\nflags:\t0%o\n", 51 seq_printf(m, "pos:\t%lli\nflags:\t0%o\n",
52 (long long)file->f_pos, f_flags); 52 (long long)file->f_pos, f_flags);
53 if (file->f_op->show_fdinfo)
54 ret = file->f_op->show_fdinfo(m, file);
53 fput(file); 55 fput(file);
54 } 56 }
55 57
diff --git a/fs/proc/proc_devtree.c b/fs/proc/proc_devtree.c
index df7dd08d4391..de20ec480fa0 100644
--- a/fs/proc/proc_devtree.c
+++ b/fs/proc/proc_devtree.c
@@ -195,11 +195,7 @@ void proc_device_tree_add_node(struct device_node *np,
195 set_node_proc_entry(np, de); 195 set_node_proc_entry(np, de);
196 for (child = NULL; (child = of_get_next_child(np, child));) { 196 for (child = NULL; (child = of_get_next_child(np, child));) {
197 /* Use everything after the last slash, or the full name */ 197 /* Use everything after the last slash, or the full name */
198 p = strrchr(child->full_name, '/'); 198 p = kbasename(child->full_name);
199 if (!p)
200 p = child->full_name;
201 else
202 ++p;
203 199
204 if (duplicate_name(de, p)) 200 if (duplicate_name(de, p))
205 p = fixup_name(np, de, p); 201 p = fixup_name(np, de, p);
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index 48775628abbf..448455b7fd91 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -526,6 +526,57 @@ static int smaps_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end,
526 return 0; 526 return 0;
527} 527}
528 528
529static void show_smap_vma_flags(struct seq_file *m, struct vm_area_struct *vma)
530{
531 /*
532 * Don't forget to update Documentation/ on changes.
533 */
534 static const char mnemonics[BITS_PER_LONG][2] = {
535 /*
536 * In case if we meet a flag we don't know about.
537 */
538 [0 ... (BITS_PER_LONG-1)] = "??",
539
540 [ilog2(VM_READ)] = "rd",
541 [ilog2(VM_WRITE)] = "wr",
542 [ilog2(VM_EXEC)] = "ex",
543 [ilog2(VM_SHARED)] = "sh",
544 [ilog2(VM_MAYREAD)] = "mr",
545 [ilog2(VM_MAYWRITE)] = "mw",
546 [ilog2(VM_MAYEXEC)] = "me",
547 [ilog2(VM_MAYSHARE)] = "ms",
548 [ilog2(VM_GROWSDOWN)] = "gd",
549 [ilog2(VM_PFNMAP)] = "pf",
550 [ilog2(VM_DENYWRITE)] = "dw",
551 [ilog2(VM_LOCKED)] = "lo",
552 [ilog2(VM_IO)] = "io",
553 [ilog2(VM_SEQ_READ)] = "sr",
554 [ilog2(VM_RAND_READ)] = "rr",
555 [ilog2(VM_DONTCOPY)] = "dc",
556 [ilog2(VM_DONTEXPAND)] = "de",
557 [ilog2(VM_ACCOUNT)] = "ac",
558 [ilog2(VM_NORESERVE)] = "nr",
559 [ilog2(VM_HUGETLB)] = "ht",
560 [ilog2(VM_NONLINEAR)] = "nl",
561 [ilog2(VM_ARCH_1)] = "ar",
562 [ilog2(VM_DONTDUMP)] = "dd",
563 [ilog2(VM_MIXEDMAP)] = "mm",
564 [ilog2(VM_HUGEPAGE)] = "hg",
565 [ilog2(VM_NOHUGEPAGE)] = "nh",
566 [ilog2(VM_MERGEABLE)] = "mg",
567 };
568 size_t i;
569
570 seq_puts(m, "VmFlags: ");
571 for (i = 0; i < BITS_PER_LONG; i++) {
572 if (vma->vm_flags & (1UL << i)) {
573 seq_printf(m, "%c%c ",
574 mnemonics[i][0], mnemonics[i][1]);
575 }
576 }
577 seq_putc(m, '\n');
578}
579
529static int show_smap(struct seq_file *m, void *v, int is_pid) 580static int show_smap(struct seq_file *m, void *v, int is_pid)
530{ 581{
531 struct proc_maps_private *priv = m->private; 582 struct proc_maps_private *priv = m->private;
@@ -581,6 +632,8 @@ static int show_smap(struct seq_file *m, void *v, int is_pid)
581 seq_printf(m, "Nonlinear: %8lu kB\n", 632 seq_printf(m, "Nonlinear: %8lu kB\n",
582 mss.nonlinear >> 10); 633 mss.nonlinear >> 10);
583 634
635 show_smap_vma_flags(m, vma);
636
584 if (m->count < m->size) /* vma is copied successfully */ 637 if (m->count < m->size) /* vma is copied successfully */
585 m->version = (vma != get_gate_vma(task->mm)) 638 m->version = (vma != get_gate_vma(task->mm))
586 ? vma->vm_start : 0; 639 ? vma->vm_start : 0;