aboutsummaryrefslogtreecommitdiffstats
path: root/fs/proc
diff options
context:
space:
mode:
Diffstat (limited to 'fs/proc')
-rw-r--r--fs/proc/array.c7
-rw-r--r--fs/proc/base.c26
-rw-r--r--fs/proc/generic.c15
-rw-r--r--fs/proc/inode.c4
-rw-r--r--fs/proc/kcore.c3
-rw-r--r--fs/proc/kmsg.c1
-rw-r--r--fs/proc/root.c1
-rw-r--r--fs/proc/task_mmu.c23
-rw-r--r--fs/proc/vmcore.c1
9 files changed, 24 insertions, 57 deletions
diff --git a/fs/proc/array.c b/fs/proc/array.c
index e51f2ec2c5e5..9b58d38bc911 100644
--- a/fs/proc/array.c
+++ b/fs/proc/array.c
@@ -81,7 +81,6 @@
81#include <linux/pid_namespace.h> 81#include <linux/pid_namespace.h>
82#include <linux/ptrace.h> 82#include <linux/ptrace.h>
83#include <linux/tracehook.h> 83#include <linux/tracehook.h>
84#include <linux/swapops.h>
85 84
86#include <asm/pgtable.h> 85#include <asm/pgtable.h>
87#include <asm/processor.h> 86#include <asm/processor.h>
@@ -268,7 +267,7 @@ static inline void task_sig(struct seq_file *m, struct task_struct *p)
268 shpending = p->signal->shared_pending.signal; 267 shpending = p->signal->shared_pending.signal;
269 blocked = p->blocked; 268 blocked = p->blocked;
270 collect_sigign_sigcatch(p, &ignored, &caught); 269 collect_sigign_sigcatch(p, &ignored, &caught);
271 num_threads = atomic_read(&p->signal->count); 270 num_threads = get_nr_threads(p);
272 rcu_read_lock(); /* FIXME: is this correct? */ 271 rcu_read_lock(); /* FIXME: is this correct? */
273 qsize = atomic_read(&__task_cred(p)->user->sigpending); 272 qsize = atomic_read(&__task_cred(p)->user->sigpending);
274 rcu_read_unlock(); 273 rcu_read_unlock();
@@ -411,7 +410,7 @@ static int do_task_stat(struct seq_file *m, struct pid_namespace *ns,
411 tty_nr = new_encode_dev(tty_devnum(sig->tty)); 410 tty_nr = new_encode_dev(tty_devnum(sig->tty));
412 } 411 }
413 412
414 num_threads = atomic_read(&sig->count); 413 num_threads = get_nr_threads(task);
415 collect_sigign_sigcatch(task, &sigign, &sigcatch); 414 collect_sigign_sigcatch(task, &sigign, &sigcatch);
416 415
417 cmin_flt = sig->cmin_flt; 416 cmin_flt = sig->cmin_flt;
@@ -495,7 +494,7 @@ static int do_task_stat(struct seq_file *m, struct pid_namespace *ns,
495 rsslim, 494 rsslim,
496 mm ? mm->start_code : 0, 495 mm ? mm->start_code : 0,
497 mm ? mm->end_code : 0, 496 mm ? mm->end_code : 0,
498 (permitted && mm) ? task->stack_start : 0, 497 (permitted && mm) ? mm->start_stack : 0,
499 esp, 498 esp,
500 eip, 499 eip,
501 /* The signal information here is obsolete. 500 /* The signal information here is obsolete.
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 8418fcc0a6ab..acb7ef80ea4f 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -166,18 +166,6 @@ static int get_fs_path(struct task_struct *task, struct path *path, bool root)
166 return result; 166 return result;
167} 167}
168 168
169static int get_nr_threads(struct task_struct *tsk)
170{
171 unsigned long flags;
172 int count = 0;
173
174 if (lock_task_sighand(tsk, &flags)) {
175 count = atomic_read(&tsk->signal->count);
176 unlock_task_sighand(tsk, &flags);
177 }
178 return count;
179}
180
181static int proc_cwd_link(struct inode *inode, struct path *path) 169static int proc_cwd_link(struct inode *inode, struct path *path)
182{ 170{
183 struct task_struct *task = get_proc_task(inode); 171 struct task_struct *task = get_proc_task(inode);
@@ -730,6 +718,7 @@ out_no_task:
730 718
731static const struct file_operations proc_info_file_operations = { 719static const struct file_operations proc_info_file_operations = {
732 .read = proc_info_read, 720 .read = proc_info_read,
721 .llseek = generic_file_llseek,
733}; 722};
734 723
735static int proc_single_show(struct seq_file *m, void *v) 724static int proc_single_show(struct seq_file *m, void *v)
@@ -987,6 +976,7 @@ out_no_task:
987 976
988static const struct file_operations proc_environ_operations = { 977static const struct file_operations proc_environ_operations = {
989 .read = environ_read, 978 .read = environ_read,
979 .llseek = generic_file_llseek,
990}; 980};
991 981
992static ssize_t oom_adjust_read(struct file *file, char __user *buf, 982static ssize_t oom_adjust_read(struct file *file, char __user *buf,
@@ -1060,6 +1050,7 @@ static ssize_t oom_adjust_write(struct file *file, const char __user *buf,
1060static const struct file_operations proc_oom_adjust_operations = { 1050static const struct file_operations proc_oom_adjust_operations = {
1061 .read = oom_adjust_read, 1051 .read = oom_adjust_read,
1062 .write = oom_adjust_write, 1052 .write = oom_adjust_write,
1053 .llseek = generic_file_llseek,
1063}; 1054};
1064 1055
1065#ifdef CONFIG_AUDITSYSCALL 1056#ifdef CONFIG_AUDITSYSCALL
@@ -1131,6 +1122,7 @@ out_free_page:
1131static const struct file_operations proc_loginuid_operations = { 1122static const struct file_operations proc_loginuid_operations = {
1132 .read = proc_loginuid_read, 1123 .read = proc_loginuid_read,
1133 .write = proc_loginuid_write, 1124 .write = proc_loginuid_write,
1125 .llseek = generic_file_llseek,
1134}; 1126};
1135 1127
1136static ssize_t proc_sessionid_read(struct file * file, char __user * buf, 1128static ssize_t proc_sessionid_read(struct file * file, char __user * buf,
@@ -1151,6 +1143,7 @@ static ssize_t proc_sessionid_read(struct file * file, char __user * buf,
1151 1143
1152static const struct file_operations proc_sessionid_operations = { 1144static const struct file_operations proc_sessionid_operations = {
1153 .read = proc_sessionid_read, 1145 .read = proc_sessionid_read,
1146 .llseek = generic_file_llseek,
1154}; 1147};
1155#endif 1148#endif
1156 1149
@@ -1202,6 +1195,7 @@ static ssize_t proc_fault_inject_write(struct file * file,
1202static const struct file_operations proc_fault_inject_operations = { 1195static const struct file_operations proc_fault_inject_operations = {
1203 .read = proc_fault_inject_read, 1196 .read = proc_fault_inject_read,
1204 .write = proc_fault_inject_write, 1197 .write = proc_fault_inject_write,
1198 .llseek = generic_file_llseek,
1205}; 1199};
1206#endif 1200#endif
1207 1201
@@ -1943,7 +1937,7 @@ static ssize_t proc_fdinfo_read(struct file *file, char __user *buf,
1943} 1937}
1944 1938
1945static const struct file_operations proc_fdinfo_file_operations = { 1939static const struct file_operations proc_fdinfo_file_operations = {
1946 .open = nonseekable_open, 1940 .open = nonseekable_open,
1947 .read = proc_fdinfo_read, 1941 .read = proc_fdinfo_read,
1948}; 1942};
1949 1943
@@ -2227,6 +2221,7 @@ out_no_task:
2227static const struct file_operations proc_pid_attr_operations = { 2221static const struct file_operations proc_pid_attr_operations = {
2228 .read = proc_pid_attr_read, 2222 .read = proc_pid_attr_read,
2229 .write = proc_pid_attr_write, 2223 .write = proc_pid_attr_write,
2224 .llseek = generic_file_llseek,
2230}; 2225};
2231 2226
2232static const struct pid_entry attr_dir_stuff[] = { 2227static const struct pid_entry attr_dir_stuff[] = {
@@ -2347,6 +2342,7 @@ static ssize_t proc_coredump_filter_write(struct file *file,
2347static const struct file_operations proc_coredump_filter_operations = { 2342static const struct file_operations proc_coredump_filter_operations = {
2348 .read = proc_coredump_filter_read, 2343 .read = proc_coredump_filter_read,
2349 .write = proc_coredump_filter_write, 2344 .write = proc_coredump_filter_write,
2345 .llseek = generic_file_llseek,
2350}; 2346};
2351#endif 2347#endif
2352 2348
@@ -2436,7 +2432,7 @@ static struct dentry *proc_base_instantiate(struct inode *dir,
2436 const struct pid_entry *p = ptr; 2432 const struct pid_entry *p = ptr;
2437 struct inode *inode; 2433 struct inode *inode;
2438 struct proc_inode *ei; 2434 struct proc_inode *ei;
2439 struct dentry *error = ERR_PTR(-EINVAL); 2435 struct dentry *error;
2440 2436
2441 /* Allocate the inode */ 2437 /* Allocate the inode */
2442 error = ERR_PTR(-ENOMEM); 2438 error = ERR_PTR(-ENOMEM);
@@ -2786,7 +2782,7 @@ out:
2786 2782
2787struct dentry *proc_pid_lookup(struct inode *dir, struct dentry * dentry, struct nameidata *nd) 2783struct dentry *proc_pid_lookup(struct inode *dir, struct dentry * dentry, struct nameidata *nd)
2788{ 2784{
2789 struct dentry *result = ERR_PTR(-ENOENT); 2785 struct dentry *result;
2790 struct task_struct *task; 2786 struct task_struct *task;
2791 unsigned tgid; 2787 unsigned tgid;
2792 struct pid_namespace *ns; 2788 struct pid_namespace *ns;
diff --git a/fs/proc/generic.c b/fs/proc/generic.c
index 43c127490606..2791907744ed 100644
--- a/fs/proc/generic.c
+++ b/fs/proc/generic.c
@@ -343,21 +343,6 @@ static DEFINE_SPINLOCK(proc_inum_lock); /* protects the above */
343/* 343/*
344 * Return an inode number between PROC_DYNAMIC_FIRST and 344 * Return an inode number between PROC_DYNAMIC_FIRST and
345 * 0xffffffff, or zero on failure. 345 * 0xffffffff, or zero on failure.
346 *
347 * Current inode allocations in the proc-fs (hex-numbers):
348 *
349 * 00000000 reserved
350 * 00000001-00000fff static entries (goners)
351 * 001 root-ino
352 *
353 * 00001000-00001fff unused
354 * 0001xxxx-7fffxxxx pid-dir entries for pid 1-7fff
355 * 80000000-efffffff unused
356 * f0000000-ffffffff dynamic entries
357 *
358 * Goal:
359 * Once we split the thing into several virtual filesystems,
360 * we will get rid of magical ranges (and this comment, BTW).
361 */ 346 */
362static unsigned int get_inode_number(void) 347static unsigned int get_inode_number(void)
363{ 348{
diff --git a/fs/proc/inode.c b/fs/proc/inode.c
index d35b23238fb1..aea8502e58a3 100644
--- a/fs/proc/inode.c
+++ b/fs/proc/inode.c
@@ -232,9 +232,9 @@ static long proc_reg_unlocked_ioctl(struct file *file, unsigned int cmd, unsigne
232 if (rv == -ENOIOCTLCMD) 232 if (rv == -ENOIOCTLCMD)
233 rv = -EINVAL; 233 rv = -EINVAL;
234 } else if (ioctl) { 234 } else if (ioctl) {
235 lock_kernel(); 235 WARN_ONCE(1, "Procfs ioctl handlers must use unlocked_ioctl, "
236 "%pf will be called without the Bkl held\n", ioctl);
236 rv = ioctl(file->f_path.dentry->d_inode, file, cmd, arg); 237 rv = ioctl(file->f_path.dentry->d_inode, file, cmd, arg);
237 unlock_kernel();
238 } 238 }
239 239
240 pde_users_dec(pde); 240 pde_users_dec(pde);
diff --git a/fs/proc/kcore.c b/fs/proc/kcore.c
index 19979a2ce272..6f37c391468d 100644
--- a/fs/proc/kcore.c
+++ b/fs/proc/kcore.c
@@ -558,6 +558,7 @@ static int open_kcore(struct inode *inode, struct file *filp)
558static const struct file_operations proc_kcore_operations = { 558static const struct file_operations proc_kcore_operations = {
559 .read = read_kcore, 559 .read = read_kcore,
560 .open = open_kcore, 560 .open = open_kcore,
561 .llseek = generic_file_llseek,
561}; 562};
562 563
563#ifdef CONFIG_MEMORY_HOTPLUG 564#ifdef CONFIG_MEMORY_HOTPLUG
@@ -587,7 +588,7 @@ static struct kcore_list kcore_text;
587 */ 588 */
588static void __init proc_kcore_text_init(void) 589static void __init proc_kcore_text_init(void)
589{ 590{
590 kclist_add(&kcore_text, _stext, _end - _stext, KCORE_TEXT); 591 kclist_add(&kcore_text, _text, _end - _text, KCORE_TEXT);
591} 592}
592#else 593#else
593static void __init proc_kcore_text_init(void) 594static void __init proc_kcore_text_init(void)
diff --git a/fs/proc/kmsg.c b/fs/proc/kmsg.c
index cfe90a48a6e8..bd4b5a740ff1 100644
--- a/fs/proc/kmsg.c
+++ b/fs/proc/kmsg.c
@@ -53,6 +53,7 @@ static const struct file_operations proc_kmsg_operations = {
53 .poll = kmsg_poll, 53 .poll = kmsg_poll,
54 .open = kmsg_open, 54 .open = kmsg_open,
55 .release = kmsg_release, 55 .release = kmsg_release,
56 .llseek = generic_file_llseek,
56}; 57};
57 58
58static int __init proc_kmsg_init(void) 59static int __init proc_kmsg_init(void)
diff --git a/fs/proc/root.c b/fs/proc/root.c
index 757c069f2a65..4258384ed22d 100644
--- a/fs/proc/root.c
+++ b/fs/proc/root.c
@@ -110,7 +110,6 @@ void __init proc_root_init(void)
110 if (err) 110 if (err)
111 return; 111 return;
112 proc_mnt = kern_mount_data(&proc_fs_type, &init_pid_ns); 112 proc_mnt = kern_mount_data(&proc_fs_type, &init_pid_ns);
113 err = PTR_ERR(proc_mnt);
114 if (IS_ERR(proc_mnt)) { 113 if (IS_ERR(proc_mnt)) {
115 unregister_filesystem(&proc_fs_type); 114 unregister_filesystem(&proc_fs_type);
116 return; 115 return;
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index 070553427dd5..aea1d3f1ffb5 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -247,25 +247,6 @@ static void show_map_vma(struct seq_file *m, struct vm_area_struct *vma)
247 } else if (vma->vm_start <= mm->start_stack && 247 } else if (vma->vm_start <= mm->start_stack &&
248 vma->vm_end >= mm->start_stack) { 248 vma->vm_end >= mm->start_stack) {
249 name = "[stack]"; 249 name = "[stack]";
250 } else {
251 unsigned long stack_start;
252 struct proc_maps_private *pmp;
253
254 pmp = m->private;
255 stack_start = pmp->task->stack_start;
256
257 if (vma->vm_start <= stack_start &&
258 vma->vm_end >= stack_start) {
259 pad_len_spaces(m, len);
260 seq_printf(m,
261 "[threadstack:%08lx]",
262#ifdef CONFIG_STACK_GROWSUP
263 vma->vm_end - stack_start
264#else
265 stack_start - vma->vm_start
266#endif
267 );
268 }
269 } 250 }
270 } else { 251 } else {
271 name = "[vdso]"; 252 name = "[vdso]";
@@ -653,6 +634,7 @@ static int pagemap_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end,
653 return err; 634 return err;
654} 635}
655 636
637#ifdef CONFIG_HUGETLB_PAGE
656static u64 huge_pte_to_pagemap_entry(pte_t pte, int offset) 638static u64 huge_pte_to_pagemap_entry(pte_t pte, int offset)
657{ 639{
658 u64 pme = 0; 640 u64 pme = 0;
@@ -683,6 +665,7 @@ static int pagemap_hugetlb_range(pte_t *pte, unsigned long hmask,
683 665
684 return err; 666 return err;
685} 667}
668#endif /* HUGETLB_PAGE */
686 669
687/* 670/*
688 * /proc/pid/pagemap - an array mapping virtual pages to pfns 671 * /proc/pid/pagemap - an array mapping virtual pages to pfns
@@ -752,7 +735,9 @@ static ssize_t pagemap_read(struct file *file, char __user *buf,
752 735
753 pagemap_walk.pmd_entry = pagemap_pte_range; 736 pagemap_walk.pmd_entry = pagemap_pte_range;
754 pagemap_walk.pte_hole = pagemap_pte_hole; 737 pagemap_walk.pte_hole = pagemap_pte_hole;
738#ifdef CONFIG_HUGETLB_PAGE
755 pagemap_walk.hugetlb_entry = pagemap_hugetlb_range; 739 pagemap_walk.hugetlb_entry = pagemap_hugetlb_range;
740#endif
756 pagemap_walk.mm = mm; 741 pagemap_walk.mm = mm;
757 pagemap_walk.private = &pm; 742 pagemap_walk.private = &pm;
758 743
diff --git a/fs/proc/vmcore.c b/fs/proc/vmcore.c
index 9fbc99ec799a..91c817ff02c3 100644
--- a/fs/proc/vmcore.c
+++ b/fs/proc/vmcore.c
@@ -163,6 +163,7 @@ static ssize_t read_vmcore(struct file *file, char __user *buffer,
163 163
164static const struct file_operations proc_vmcore_operations = { 164static const struct file_operations proc_vmcore_operations = {
165 .read = read_vmcore, 165 .read = read_vmcore,
166 .llseek = generic_file_llseek,
166}; 167};
167 168
168static struct vmcore* __init get_new_element(void) 169static struct vmcore* __init get_new_element(void)