aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/filesystems/proc.txt7
-rw-r--r--arch/arm/kernel/dma.c17
-rw-r--r--fs/proc/Kconfig10
-rw-r--r--fs/proc/array.c7
-rw-r--r--fs/proc/base.c21
-rw-r--r--fs/proc/inode.c2
-rw-r--r--fs/proc/internal.h2
-rw-r--r--fs/proc/proc_misc.c1
-rw-r--r--fs/proc/proc_sysctl.c6
-rw-r--r--fs/proc/task_mmu.c16
-rw-r--r--fs/proc/task_nommu.c5
-rw-r--r--fs/proc/vmcore.c6
-rw-r--r--init/Kconfig10
-rw-r--r--kernel/sched_debug.c2
-rw-r--r--kernel/sysctl.c11
15 files changed, 25 insertions, 98 deletions
diff --git a/Documentation/filesystems/proc.txt b/Documentation/filesystems/proc.txt
index d831d24d2a6c..b488edad743c 100644
--- a/Documentation/filesystems/proc.txt
+++ b/Documentation/filesystems/proc.txt
@@ -1331,13 +1331,6 @@ determine whether or not they are still functioning properly.
1331Because the NMI watchdog shares registers with oprofile, by disabling the NMI 1331Because the NMI watchdog shares registers with oprofile, by disabling the NMI
1332watchdog, oprofile may have more registers to utilize. 1332watchdog, oprofile may have more registers to utilize.
1333 1333
1334maps_protect
1335------------
1336
1337Enables/Disables the protection of the per-process proc entries "maps" and
1338"smaps". When enabled, the contents of these files are visible only to
1339readers that are allowed to ptrace() the given process.
1340
1341msgmni 1334msgmni
1342------ 1335------
1343 1336
diff --git a/arch/arm/kernel/dma.c b/arch/arm/kernel/dma.c
index ba99a2035523..d006085ed7e7 100644
--- a/arch/arm/kernel/dma.c
+++ b/arch/arm/kernel/dma.c
@@ -26,23 +26,6 @@ EXPORT_SYMBOL(dma_spin_lock);
26static dma_t dma_chan[MAX_DMA_CHANNELS]; 26static dma_t dma_chan[MAX_DMA_CHANNELS];
27 27
28/* 28/*
29 * Get dma list for /proc/dma
30 */
31int 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 * Request DMA channel 29 * Request DMA channel
47 * 30 *
48 * On certain platforms, we have to allocate an interrupt as well... 31 * On certain platforms, we have to allocate an interrupt as well...
diff --git a/fs/proc/Kconfig b/fs/proc/Kconfig
index 73cd7a418f06..50f8f0600f06 100644
--- a/fs/proc/Kconfig
+++ b/fs/proc/Kconfig
@@ -57,3 +57,13 @@ config PROC_SYSCTL
57 As it is generally a good thing, you should say Y here unless 57 As it is generally a good thing, you should say Y here unless
58 building a kernel for install/rescue disks or your system is very 58 building a kernel for install/rescue disks or your system is very
59 limited in memory. 59 limited in memory.
60
61config 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.
diff --git a/fs/proc/array.c b/fs/proc/array.c
index 71c9be59c9c2..f4bc0e789539 100644
--- a/fs/proc/array.c
+++ b/fs/proc/array.c
@@ -86,11 +86,6 @@
86#include <asm/processor.h> 86#include <asm/processor.h>
87#include "internal.h" 87#include "internal.h"
88 88
89/* Gcc optimizes away "strlen(x)" for constant x */
90#define ADDBUF(buffer, string) \
91do { memcpy(buffer, string, strlen(string)); \
92 buffer += strlen(string); } while (0)
93
94static inline void task_name(struct seq_file *m, struct task_struct *p) 89static inline void task_name(struct seq_file *m, struct task_struct *p)
95{ 90{
96 int i; 91 int i;
@@ -261,7 +256,6 @@ static inline void task_sig(struct seq_file *m, struct task_struct *p)
261 sigemptyset(&ignored); 256 sigemptyset(&ignored);
262 sigemptyset(&caught); 257 sigemptyset(&caught);
263 258
264 rcu_read_lock();
265 if (lock_task_sighand(p, &flags)) { 259 if (lock_task_sighand(p, &flags)) {
266 pending = p->pending.signal; 260 pending = p->pending.signal;
267 shpending = p->signal->shared_pending.signal; 261 shpending = p->signal->shared_pending.signal;
@@ -272,7 +266,6 @@ static inline void task_sig(struct seq_file *m, struct task_struct *p)
272 qlim = p->signal->rlim[RLIMIT_SIGPENDING].rlim_cur; 266 qlim = p->signal->rlim[RLIMIT_SIGPENDING].rlim_cur;
273 unlock_task_sighand(p, &flags); 267 unlock_task_sighand(p, &flags);
274 } 268 }
275 rcu_read_unlock();
276 269
277 seq_printf(m, "Threads:\t%d\n", num_threads); 270 seq_printf(m, "Threads:\t%d\n", num_threads);
278 seq_printf(m, "SigQ:\t%lu/%lu\n", qsize, qlim); 271 seq_printf(m, "SigQ:\t%lu/%lu\n", qsize, qlim);
diff --git a/fs/proc/base.c b/fs/proc/base.c
index a28840b11b89..b5918ae8ca79 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -148,9 +148,6 @@ static unsigned int pid_entry_count_dirs(const struct pid_entry *entries,
148 return count; 148 return count;
149} 149}
150 150
151int maps_protect;
152EXPORT_SYMBOL(maps_protect);
153
154static struct fs_struct *get_fs_struct(struct task_struct *task) 151static struct fs_struct *get_fs_struct(struct task_struct *task)
155{ 152{
156 struct fs_struct *fs; 153 struct fs_struct *fs;
@@ -164,7 +161,6 @@ static struct fs_struct *get_fs_struct(struct task_struct *task)
164 161
165static int get_nr_threads(struct task_struct *tsk) 162static int get_nr_threads(struct task_struct *tsk)
166{ 163{
167 /* Must be called with the rcu_read_lock held */
168 unsigned long flags; 164 unsigned long flags;
169 int count = 0; 165 int count = 0;
170 166
@@ -471,14 +467,10 @@ static int proc_pid_limits(struct task_struct *task, char *buffer)
471 467
472 struct rlimit rlim[RLIM_NLIMITS]; 468 struct rlimit rlim[RLIM_NLIMITS];
473 469
474 rcu_read_lock(); 470 if (!lock_task_sighand(task, &flags))
475 if (!lock_task_sighand(task,&flags)) {
476 rcu_read_unlock();
477 return 0; 471 return 0;
478 }
479 memcpy(rlim, task->signal->rlim, sizeof(struct rlimit) * RLIM_NLIMITS); 472 memcpy(rlim, task->signal->rlim, sizeof(struct rlimit) * RLIM_NLIMITS);
480 unlock_task_sighand(task, &flags); 473 unlock_task_sighand(task, &flags);
481 rcu_read_unlock();
482 474
483 /* 475 /*
484 * print the file header 476 * print the file header
@@ -2443,6 +2435,13 @@ static int proc_tgid_io_accounting(struct task_struct *task, char *buffer)
2443} 2435}
2444#endif /* CONFIG_TASK_IO_ACCOUNTING */ 2436#endif /* CONFIG_TASK_IO_ACCOUNTING */
2445 2437
2438static 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 * Thread groups 2446 * Thread groups
2448 */ 2447 */
@@ -2459,6 +2458,7 @@ static const struct pid_entry tgid_base_stuff[] = {
2459 REG("environ", S_IRUSR, environ), 2458 REG("environ", S_IRUSR, environ),
2460 INF("auxv", S_IRUSR, pid_auxv), 2459 INF("auxv", S_IRUSR, pid_auxv),
2461 ONE("status", S_IRUGO, pid_status), 2460 ONE("status", S_IRUGO, pid_status),
2461 ONE("personality", S_IRUSR, pid_personality),
2462 INF("limits", S_IRUSR, pid_limits), 2462 INF("limits", S_IRUSR, pid_limits),
2463#ifdef CONFIG_SCHED_DEBUG 2463#ifdef CONFIG_SCHED_DEBUG
2464 REG("sched", S_IRUGO|S_IWUSR, pid_sched), 2464 REG("sched", S_IRUGO|S_IWUSR, pid_sched),
@@ -2794,6 +2794,7 @@ static const struct pid_entry tid_base_stuff[] = {
2794 REG("environ", S_IRUSR, environ), 2794 REG("environ", S_IRUSR, environ),
2795 INF("auxv", S_IRUSR, pid_auxv), 2795 INF("auxv", S_IRUSR, pid_auxv),
2796 ONE("status", S_IRUGO, pid_status), 2796 ONE("status", S_IRUGO, pid_status),
2797 ONE("personality", S_IRUSR, pid_personality),
2797 INF("limits", S_IRUSR, pid_limits), 2798 INF("limits", S_IRUSR, pid_limits),
2798#ifdef CONFIG_SCHED_DEBUG 2799#ifdef CONFIG_SCHED_DEBUG
2799 REG("sched", S_IRUGO|S_IWUSR, pid_sched), 2800 REG("sched", S_IRUGO|S_IWUSR, pid_sched),
@@ -3088,9 +3089,7 @@ static int proc_task_getattr(struct vfsmount *mnt, struct dentry *dentry, struct
3088 generic_fillattr(inode, stat); 3089 generic_fillattr(inode, stat);
3089 3090
3090 if (p) { 3091 if (p) {
3091 rcu_read_lock();
3092 stat->nlink += get_nr_threads(p); 3092 stat->nlink += get_nr_threads(p);
3093 rcu_read_unlock();
3094 put_task_struct(p); 3093 put_task_struct(p);
3095 } 3094 }
3096 3095
diff --git a/fs/proc/inode.c b/fs/proc/inode.c
index 8bb03f056c28..c6b4fa7e3b49 100644
--- a/fs/proc/inode.c
+++ b/fs/proc/inode.c
@@ -342,7 +342,7 @@ static int proc_reg_open(struct inode *inode, struct file *file)
342 if (!pde->proc_fops) { 342 if (!pde->proc_fops) {
343 spin_unlock(&pde->pde_unload_lock); 343 spin_unlock(&pde->pde_unload_lock);
344 kfree(pdeo); 344 kfree(pdeo);
345 return rv; 345 return -EINVAL;
346 } 346 }
347 pde->pde_users++; 347 pde->pde_users++;
348 open = pde->proc_fops->open; 348 open = pde->proc_fops->open;
diff --git a/fs/proc/internal.h b/fs/proc/internal.h
index 442202314d53..3bfb7b8747b3 100644
--- a/fs/proc/internal.h
+++ b/fs/proc/internal.h
@@ -45,8 +45,6 @@ do { \
45extern int nommu_vma_show(struct seq_file *, struct vm_area_struct *); 45extern int nommu_vma_show(struct seq_file *, struct vm_area_struct *);
46#endif 46#endif
47 47
48extern int maps_protect;
49
50extern int proc_tid_stat(struct seq_file *m, struct pid_namespace *ns, 48extern int proc_tid_stat(struct seq_file *m, struct pid_namespace *ns,
51 struct pid *pid, struct task_struct *task); 49 struct pid *pid, struct task_struct *task);
52extern int proc_tgid_stat(struct seq_file *m, struct pid_namespace *ns, 50extern int proc_tgid_stat(struct seq_file *m, struct pid_namespace *ns,
diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c
index 29e20c6b1f7f..66c1ab87656c 100644
--- a/fs/proc/proc_misc.c
+++ b/fs/proc/proc_misc.c
@@ -68,7 +68,6 @@
68extern int get_hardware_list(char *); 68extern int get_hardware_list(char *);
69extern int get_stram_list(char *); 69extern int get_stram_list(char *);
70extern int get_exec_domain_list(char *); 70extern int get_exec_domain_list(char *);
71extern int get_dma_list(char *);
72 71
73static int proc_calc_metrics(char *page, char **start, off_t off, 72static int proc_calc_metrics(char *page, char **start, off_t off,
74 int count, int *eof, int len) 73 int count, int *eof, int len)
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
index f9a8b892718f..945a81043ba2 100644
--- a/fs/proc/proc_sysctl.c
+++ b/fs/proc/proc_sysctl.c
@@ -66,7 +66,7 @@ static struct ctl_table *find_in_table(struct ctl_table *p, struct qstr *name)
66 return NULL; 66 return NULL;
67} 67}
68 68
69struct ctl_table_header *grab_header(struct inode *inode) 69static struct ctl_table_header *grab_header(struct inode *inode)
70{ 70{
71 if (PROC_I(inode)->sysctl) 71 if (PROC_I(inode)->sysctl)
72 return sysctl_head_grab(PROC_I(inode)->sysctl); 72 return sysctl_head_grab(PROC_I(inode)->sysctl);
@@ -395,10 +395,10 @@ static struct dentry_operations proc_sys_dentry_operations = {
395 .d_compare = proc_sys_compare, 395 .d_compare = proc_sys_compare,
396}; 396};
397 397
398static struct proc_dir_entry *proc_sys_root;
399
400int proc_sys_init(void) 398int proc_sys_init(void)
401{ 399{
400 struct proc_dir_entry *proc_sys_root;
401
402 proc_sys_root = proc_mkdir("sys", NULL); 402 proc_sys_root = proc_mkdir("sys", NULL);
403 proc_sys_root->proc_iops = &proc_sys_dir_operations; 403 proc_sys_root->proc_iops = &proc_sys_dir_operations;
404 proc_sys_root->proc_fops = &proc_sys_dir_file_operations; 404 proc_sys_root->proc_fops = &proc_sys_dir_file_operations;
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index 73d1891ee625..4806830ea2a1 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -210,9 +210,6 @@ static int show_map(struct seq_file *m, void *v)
210 dev_t dev = 0; 210 dev_t dev = 0;
211 int len; 211 int len;
212 212
213 if (maps_protect && !ptrace_may_access(task, PTRACE_MODE_READ))
214 return -EACCES;
215
216 if (file) { 213 if (file) {
217 struct inode *inode = vma->vm_file->f_path.dentry->d_inode; 214 struct inode *inode = vma->vm_file->f_path.dentry->d_inode;
218 dev = inode->i_sb->s_dev; 215 dev = inode->i_sb->s_dev;
@@ -742,22 +739,11 @@ const struct file_operations proc_pagemap_operations = {
742#ifdef CONFIG_NUMA 739#ifdef CONFIG_NUMA
743extern int show_numa_map(struct seq_file *m, void *v); 740extern int show_numa_map(struct seq_file *m, void *v);
744 741
745static 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
756static const struct seq_operations proc_pid_numa_maps_op = { 742static const struct seq_operations proc_pid_numa_maps_op = {
757 .start = m_start, 743 .start = m_start,
758 .next = m_next, 744 .next = m_next,
759 .stop = m_stop, 745 .stop = m_stop,
760 .show = show_numa_map_checked 746 .show = show_numa_map,
761}; 747};
762 748
763static int numa_maps_open(struct inode *inode, struct file *file) 749static int numa_maps_open(struct inode *inode, struct file *file)
diff --git a/fs/proc/task_nommu.c b/fs/proc/task_nommu.c
index 5d84e7121df8..219bd79ea894 100644
--- a/fs/proc/task_nommu.c
+++ b/fs/proc/task_nommu.c
@@ -110,11 +110,6 @@ int task_statm(struct mm_struct *mm, int *shared, int *text,
110static int show_map(struct seq_file *m, void *_vml) 110static int show_map(struct seq_file *m, void *_vml)
111{ 111{
112 struct vm_list_struct *vml = _vml; 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 return nommu_vma_show(m, vml->vma); 114 return nommu_vma_show(m, vml->vma);
120} 115}
diff --git a/fs/proc/vmcore.c b/fs/proc/vmcore.c
index 9ac0f5e064e0..841368b87a29 100644
--- a/fs/proc/vmcore.c
+++ b/fs/proc/vmcore.c
@@ -165,14 +165,8 @@ static ssize_t read_vmcore(struct file *file, char __user *buffer,
165 return acc; 165 return acc;
166} 166}
167 167
168static int open_vmcore(struct inode *inode, struct file *filp)
169{
170 return 0;
171}
172
173const struct file_operations proc_vmcore_operations = { 168const struct file_operations proc_vmcore_operations = {
174 .read = read_vmcore, 169 .read = read_vmcore,
175 .open = open_vmcore,
176}; 170};
177 171
178static struct vmcore* __init get_new_element(void) 172static struct vmcore* __init get_new_element(void)
diff --git a/init/Kconfig b/init/Kconfig
index c11da38837e5..8a8e2d00c40e 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -779,16 +779,6 @@ config MARKERS
779 779
780source "arch/Kconfig" 780source "arch/Kconfig"
781 781
782config 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
792endmenu # General setup 782endmenu # General setup
793 783
794config HAVE_GENERIC_DMA_COHERENT 784config HAVE_GENERIC_DMA_COHERENT
diff --git a/kernel/sched_debug.c b/kernel/sched_debug.c
index bbe6b31c3c56..ad958c1ec708 100644
--- a/kernel/sched_debug.c
+++ b/kernel/sched_debug.c
@@ -333,12 +333,10 @@ void proc_sched_show_task(struct task_struct *p, struct seq_file *m)
333 unsigned long flags; 333 unsigned long flags;
334 int num_threads = 1; 334 int num_threads = 1;
335 335
336 rcu_read_lock();
337 if (lock_task_sighand(p, &flags)) { 336 if (lock_task_sighand(p, &flags)) {
338 num_threads = atomic_read(&p->signal->count); 337 num_threads = atomic_read(&p->signal->count);
339 unlock_task_sighand(p, &flags); 338 unlock_task_sighand(p, &flags);
340 } 339 }
341 rcu_read_unlock();
342 340
343 SEQ_printf(m, "%s (%d, #threads: %d)\n", p->comm, p->pid, num_threads); 341 SEQ_printf(m, "%s (%d, #threads: %d)\n", p->comm, p->pid, num_threads);
344 SEQ_printf(m, 342 SEQ_printf(m,
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 1bf369bd4423..c468c3c6dfc5 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -80,7 +80,6 @@ extern int pid_max_min, pid_max_max;
80extern int sysctl_drop_caches; 80extern int sysctl_drop_caches;
81extern int percpu_pagelist_fraction; 81extern int percpu_pagelist_fraction;
82extern int compat_log; 82extern int compat_log;
83extern int maps_protect;
84extern int latencytop_enabled; 83extern int latencytop_enabled;
85extern int sysctl_nr_open_min, sysctl_nr_open_max; 84extern int sysctl_nr_open_min, sysctl_nr_open_max;
86#ifdef CONFIG_RCU_TORTURE_TEST 85#ifdef CONFIG_RCU_TORTURE_TEST
@@ -808,16 +807,6 @@ static struct ctl_table kern_table[] = {
808 .proc_handler = &proc_dointvec, 807 .proc_handler = &proc_dointvec,
809 }, 808 },
810#endif 809#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 },
820#endif
821 { 810 {
822 .ctl_name = CTL_UNNUMBERED, 811 .ctl_name = CTL_UNNUMBERED,
823 .procname = "poweroff_cmd", 812 .procname = "poweroff_cmd",