Commit 20272c8994cf1e1f8ed745a2ea161dd9ad3889f2

Authored by Linus Torvalds

Merge branch 'proc' of git://git.kernel.org/pub/scm/linux/kernel/git/adobriyan/proc

* 'proc' of git://git.kernel.org/pub/scm/linux/kernel/git/adobriyan/proc:
  proc: remove kernel.maps_protect
  proc: remove now unneeded ADDBUF macro
  [PATCH] proc: show personality via /proc/pid/personality
  [PATCH] signal, procfs: some lock_task_sighand() users do not need rcu_read_lock()
  proc: move PROC_PAGE_MONITOR to fs/proc/Kconfig
  proc: make grab_header() static
  proc: remove unused get_dma_list()
  proc: remove dummy vmcore_open()
  proc: proc_sys_root tweak
  proc: fix return value of proc_reg_open() in "too late" case

Fixed up trivial conflict in removed file arch/sparc/include/asm/dma_32.h

Showing 15 changed files Side-by-side Diff

Documentation/filesystems/proc.txt
... ... @@ -1331,13 +1331,6 @@
1331 1331 Because the NMI watchdog shares registers with oprofile, by disabling the NMI
1332 1332 watchdog, oprofile may have more registers to utilize.
1333 1333  
1334   -maps_protect
1335   -------------
1336   -
1337   -Enables/Disables the protection of the per-process proc entries "maps" and
1338   -"smaps". When enabled, the contents of these files are visible only to
1339   -readers that are allowed to ptrace() the given process.
1340   -
1341 1334 msgmni
1342 1335 ------
1343 1336  
arch/arm/kernel/dma.c
... ... @@ -26,23 +26,6 @@
26 26 static dma_t dma_chan[MAX_DMA_CHANNELS];
27 27  
28 28 /*
29   - * Get dma list for /proc/dma
30   - */
31   -int get_dma_list(char *buf)
32   -{
33   - dma_t *dma;
34   - char *p = buf;
35   - int i;
36   -
37   - for (i = 0, dma = dma_chan; i < MAX_DMA_CHANNELS; i++, dma++)
38   - if (dma->lock)
39   - p += sprintf(p, "%2d: %14s %s\n", i,
40   - dma->d_ops->type, dma->device_id);
41   -
42   - return p - buf;
43   -}
44   -
45   -/*
46 29 * Request DMA channel
47 30 *
48 31 * On certain platforms, we have to allocate an interrupt as well...
... ... @@ -57,4 +57,14 @@
57 57 As it is generally a good thing, you should say Y here unless
58 58 building a kernel for install/rescue disks or your system is very
59 59 limited in memory.
  60 +
  61 +config PROC_PAGE_MONITOR
  62 + default y
  63 + depends on PROC_FS && MMU
  64 + bool "Enable /proc page monitoring" if EMBEDDED
  65 + help
  66 + Various /proc files exist to monitor process memory utilization:
  67 + /proc/pid/smaps, /proc/pid/clear_refs, /proc/pid/pagemap,
  68 + /proc/kpagecount, and /proc/kpageflags. Disabling these
  69 + interfaces will reduce the size of the kernel by approximately 4kb.
... ... @@ -86,11 +86,6 @@
86 86 #include <asm/processor.h>
87 87 #include "internal.h"
88 88  
89   -/* Gcc optimizes away "strlen(x)" for constant x */
90   -#define ADDBUF(buffer, string) \
91   -do { memcpy(buffer, string, strlen(string)); \
92   - buffer += strlen(string); } while (0)
93   -
94 89 static inline void task_name(struct seq_file *m, struct task_struct *p)
95 90 {
96 91 int i;
... ... @@ -261,7 +256,6 @@
261 256 sigemptyset(&ignored);
262 257 sigemptyset(&caught);
263 258  
264   - rcu_read_lock();
265 259 if (lock_task_sighand(p, &flags)) {
266 260 pending = p->pending.signal;
267 261 shpending = p->signal->shared_pending.signal;
... ... @@ -272,7 +266,6 @@
272 266 qlim = p->signal->rlim[RLIMIT_SIGPENDING].rlim_cur;
273 267 unlock_task_sighand(p, &flags);
274 268 }
275   - rcu_read_unlock();
276 269  
277 270 seq_printf(m, "Threads:\t%d\n", num_threads);
278 271 seq_printf(m, "SigQ:\t%lu/%lu\n", qsize, qlim);
... ... @@ -148,9 +148,6 @@
148 148 return count;
149 149 }
150 150  
151   -int maps_protect;
152   -EXPORT_SYMBOL(maps_protect);
153   -
154 151 static struct fs_struct *get_fs_struct(struct task_struct *task)
155 152 {
156 153 struct fs_struct *fs;
... ... @@ -164,7 +161,6 @@
164 161  
165 162 static int get_nr_threads(struct task_struct *tsk)
166 163 {
167   - /* Must be called with the rcu_read_lock held */
168 164 unsigned long flags;
169 165 int count = 0;
170 166  
171 167  
172 168  
... ... @@ -471,14 +467,10 @@
471 467  
472 468 struct rlimit rlim[RLIM_NLIMITS];
473 469  
474   - rcu_read_lock();
475   - if (!lock_task_sighand(task,&flags)) {
476   - rcu_read_unlock();
  470 + if (!lock_task_sighand(task, &flags))
477 471 return 0;
478   - }
479 472 memcpy(rlim, task->signal->rlim, sizeof(struct rlimit) * RLIM_NLIMITS);
480 473 unlock_task_sighand(task, &flags);
481   - rcu_read_unlock();
482 474  
483 475 /*
484 476 * print the file header
... ... @@ -2443,6 +2435,13 @@
2443 2435 }
2444 2436 #endif /* CONFIG_TASK_IO_ACCOUNTING */
2445 2437  
  2438 +static int proc_pid_personality(struct seq_file *m, struct pid_namespace *ns,
  2439 + struct pid *pid, struct task_struct *task)
  2440 +{
  2441 + seq_printf(m, "%08x\n", task->personality);
  2442 + return 0;
  2443 +}
  2444 +
2446 2445 /*
2447 2446 * Thread groups
2448 2447 */
... ... @@ -2459,6 +2458,7 @@
2459 2458 REG("environ", S_IRUSR, environ),
2460 2459 INF("auxv", S_IRUSR, pid_auxv),
2461 2460 ONE("status", S_IRUGO, pid_status),
  2461 + ONE("personality", S_IRUSR, pid_personality),
2462 2462 INF("limits", S_IRUSR, pid_limits),
2463 2463 #ifdef CONFIG_SCHED_DEBUG
2464 2464 REG("sched", S_IRUGO|S_IWUSR, pid_sched),
... ... @@ -2794,6 +2794,7 @@
2794 2794 REG("environ", S_IRUSR, environ),
2795 2795 INF("auxv", S_IRUSR, pid_auxv),
2796 2796 ONE("status", S_IRUGO, pid_status),
  2797 + ONE("personality", S_IRUSR, pid_personality),
2797 2798 INF("limits", S_IRUSR, pid_limits),
2798 2799 #ifdef CONFIG_SCHED_DEBUG
2799 2800 REG("sched", S_IRUGO|S_IWUSR, pid_sched),
2800 2801  
... ... @@ -3088,9 +3089,7 @@
3088 3089 generic_fillattr(inode, stat);
3089 3090  
3090 3091 if (p) {
3091   - rcu_read_lock();
3092 3092 stat->nlink += get_nr_threads(p);
3093   - rcu_read_unlock();
3094 3093 put_task_struct(p);
3095 3094 }
3096 3095  
... ... @@ -342,7 +342,7 @@
342 342 if (!pde->proc_fops) {
343 343 spin_unlock(&pde->pde_unload_lock);
344 344 kfree(pdeo);
345   - return rv;
  345 + return -EINVAL;
346 346 }
347 347 pde->pde_users++;
348 348 open = pde->proc_fops->open;
... ... @@ -45,8 +45,6 @@
45 45 extern int nommu_vma_show(struct seq_file *, struct vm_area_struct *);
46 46 #endif
47 47  
48   -extern int maps_protect;
49   -
50 48 extern int proc_tid_stat(struct seq_file *m, struct pid_namespace *ns,
51 49 struct pid *pid, struct task_struct *task);
52 50 extern int proc_tgid_stat(struct seq_file *m, struct pid_namespace *ns,
... ... @@ -68,7 +68,6 @@
68 68 extern int get_hardware_list(char *);
69 69 extern int get_stram_list(char *);
70 70 extern int get_exec_domain_list(char *);
71   -extern int get_dma_list(char *);
72 71  
73 72 static int proc_calc_metrics(char *page, char **start, off_t off,
74 73 int count, int *eof, int len)
fs/proc/proc_sysctl.c
... ... @@ -66,7 +66,7 @@
66 66 return NULL;
67 67 }
68 68  
69   -struct ctl_table_header *grab_header(struct inode *inode)
  69 +static struct ctl_table_header *grab_header(struct inode *inode)
70 70 {
71 71 if (PROC_I(inode)->sysctl)
72 72 return sysctl_head_grab(PROC_I(inode)->sysctl);
73 73  
... ... @@ -395,10 +395,10 @@
395 395 .d_compare = proc_sys_compare,
396 396 };
397 397  
398   -static struct proc_dir_entry *proc_sys_root;
399   -
400 398 int proc_sys_init(void)
401 399 {
  400 + struct proc_dir_entry *proc_sys_root;
  401 +
402 402 proc_sys_root = proc_mkdir("sys", NULL);
403 403 proc_sys_root->proc_iops = &proc_sys_dir_operations;
404 404 proc_sys_root->proc_fops = &proc_sys_dir_file_operations;
... ... @@ -210,9 +210,6 @@
210 210 dev_t dev = 0;
211 211 int len;
212 212  
213   - if (maps_protect && !ptrace_may_access(task, PTRACE_MODE_READ))
214   - return -EACCES;
215   -
216 213 if (file) {
217 214 struct inode *inode = vma->vm_file->f_path.dentry->d_inode;
218 215 dev = inode->i_sb->s_dev;
219 216  
... ... @@ -742,22 +739,11 @@
742 739 #ifdef CONFIG_NUMA
743 740 extern int show_numa_map(struct seq_file *m, void *v);
744 741  
745   -static int show_numa_map_checked(struct seq_file *m, void *v)
746   -{
747   - struct proc_maps_private *priv = m->private;
748   - struct task_struct *task = priv->task;
749   -
750   - if (maps_protect && !ptrace_may_access(task, PTRACE_MODE_READ))
751   - return -EACCES;
752   -
753   - return show_numa_map(m, v);
754   -}
755   -
756 742 static const struct seq_operations proc_pid_numa_maps_op = {
757 743 .start = m_start,
758 744 .next = m_next,
759 745 .stop = m_stop,
760   - .show = show_numa_map_checked
  746 + .show = show_numa_map,
761 747 };
762 748  
763 749 static int numa_maps_open(struct inode *inode, struct file *file)
fs/proc/task_nommu.c
... ... @@ -110,11 +110,6 @@
110 110 static int show_map(struct seq_file *m, void *_vml)
111 111 {
112 112 struct vm_list_struct *vml = _vml;
113   - struct proc_maps_private *priv = m->private;
114   - struct task_struct *task = priv->task;
115   -
116   - if (maps_protect && !ptrace_may_access(task, PTRACE_MODE_READ))
117   - return -EACCES;
118 113  
119 114 return nommu_vma_show(m, vml->vma);
120 115 }
... ... @@ -165,14 +165,8 @@
165 165 return acc;
166 166 }
167 167  
168   -static int open_vmcore(struct inode *inode, struct file *filp)
169   -{
170   - return 0;
171   -}
172   -
173 168 const struct file_operations proc_vmcore_operations = {
174 169 .read = read_vmcore,
175   - .open = open_vmcore,
176 170 };
177 171  
178 172 static struct vmcore* __init get_new_element(void)
... ... @@ -779,16 +779,6 @@
779 779  
780 780 source "arch/Kconfig"
781 781  
782   -config PROC_PAGE_MONITOR
783   - default y
784   - depends on PROC_FS && MMU
785   - bool "Enable /proc page monitoring" if EMBEDDED
786   - help
787   - Various /proc files exist to monitor process memory utilization:
788   - /proc/pid/smaps, /proc/pid/clear_refs, /proc/pid/pagemap,
789   - /proc/kpagecount, and /proc/kpageflags. Disabling these
790   - interfaces will reduce the size of the kernel by approximately 4kb.
791   -
792 782 endmenu # General setup
793 783  
794 784 config HAVE_GENERIC_DMA_COHERENT
kernel/sched_debug.c
... ... @@ -333,12 +333,10 @@
333 333 unsigned long flags;
334 334 int num_threads = 1;
335 335  
336   - rcu_read_lock();
337 336 if (lock_task_sighand(p, &flags)) {
338 337 num_threads = atomic_read(&p->signal->count);
339 338 unlock_task_sighand(p, &flags);
340 339 }
341   - rcu_read_unlock();
342 340  
343 341 SEQ_printf(m, "%s (%d, #threads: %d)\n", p->comm, p->pid, num_threads);
344 342 SEQ_printf(m,
... ... @@ -80,7 +80,6 @@
80 80 extern int sysctl_drop_caches;
81 81 extern int percpu_pagelist_fraction;
82 82 extern int compat_log;
83   -extern int maps_protect;
84 83 extern int latencytop_enabled;
85 84 extern int sysctl_nr_open_min, sysctl_nr_open_max;
86 85 #ifdef CONFIG_RCU_TORTURE_TEST
... ... @@ -806,16 +805,6 @@
806 805 .maxlen = sizeof(int),
807 806 .mode = 0644,
808 807 .proc_handler = &proc_dointvec,
809   - },
810   -#endif
811   -#ifdef CONFIG_PROC_FS
812   - {
813   - .ctl_name = CTL_UNNUMBERED,
814   - .procname = "maps_protect",
815   - .data = &maps_protect,
816   - .maxlen = sizeof(int),
817   - .mode = 0644,
818   - .proc_handler = &proc_dointvec,
819 808 },
820 809 #endif
821 810 {