aboutsummaryrefslogtreecommitdiffstats
path: root/fs/proc
diff options
context:
space:
mode:
Diffstat (limited to 'fs/proc')
-rw-r--r--fs/proc/Makefile3
-rw-r--r--fs/proc/array.c18
-rw-r--r--fs/proc/base.c179
-rw-r--r--fs/proc/generic.c10
-rw-r--r--fs/proc/inode.c6
-rw-r--r--fs/proc/kcore.c16
-rw-r--r--fs/proc/nommu.c4
-rw-r--r--fs/proc/proc_misc.c19
-rw-r--r--fs/proc/root.c1
-rw-r--r--fs/proc/task_mmu.c8
-rw-r--r--fs/proc/task_nommu.c4
11 files changed, 185 insertions, 83 deletions
diff --git a/fs/proc/Makefile b/fs/proc/Makefile
index 7431d7ba2d..f6c7762725 100644
--- a/fs/proc/Makefile
+++ b/fs/proc/Makefile
@@ -8,8 +8,9 @@ proc-y := nommu.o task_nommu.o
8proc-$(CONFIG_MMU) := mmu.o task_mmu.o 8proc-$(CONFIG_MMU) := mmu.o task_mmu.o
9 9
10proc-y += inode.o root.o base.o generic.o array.o \ 10proc-y += inode.o root.o base.o generic.o array.o \
11 kmsg.o proc_tty.o proc_misc.o 11 proc_tty.o proc_misc.o
12 12
13proc-$(CONFIG_PROC_KCORE) += kcore.o 13proc-$(CONFIG_PROC_KCORE) += kcore.o
14proc-$(CONFIG_PROC_VMCORE) += vmcore.o 14proc-$(CONFIG_PROC_VMCORE) += vmcore.o
15proc-$(CONFIG_PROC_DEVICETREE) += proc_devtree.o 15proc-$(CONFIG_PROC_DEVICETREE) += proc_devtree.o
16proc-$(CONFIG_PRINTK) += kmsg.o
diff --git a/fs/proc/array.c b/fs/proc/array.c
index 25e917fb47..70e4fab117 100644
--- a/fs/proc/array.c
+++ b/fs/proc/array.c
@@ -346,20 +346,13 @@ static int do_task_stat(struct task_struct *task, char * buffer, int whole)
346 sigemptyset(&sigcatch); 346 sigemptyset(&sigcatch);
347 cutime = cstime = utime = stime = cputime_zero; 347 cutime = cstime = utime = stime = cputime_zero;
348 348
349 mutex_lock(&tty_mutex);
350 rcu_read_lock(); 349 rcu_read_lock();
351 if (lock_task_sighand(task, &flags)) { 350 if (lock_task_sighand(task, &flags)) {
352 struct signal_struct *sig = task->signal; 351 struct signal_struct *sig = task->signal;
353 struct tty_struct *tty = sig->tty; 352
354 353 if (sig->tty) {
355 if (tty) { 354 tty_pgrp = sig->tty->pgrp;
356 /* 355 tty_nr = new_encode_dev(tty_devnum(sig->tty));
357 * sig->tty is not stable, but tty_mutex
358 * protects us from release_dev(tty)
359 */
360 barrier();
361 tty_pgrp = tty->pgrp;
362 tty_nr = new_encode_dev(tty_devnum(tty));
363 } 356 }
364 357
365 num_threads = atomic_read(&sig->count); 358 num_threads = atomic_read(&sig->count);
@@ -388,14 +381,13 @@ static int do_task_stat(struct task_struct *task, char * buffer, int whole)
388 stime = cputime_add(stime, sig->stime); 381 stime = cputime_add(stime, sig->stime);
389 } 382 }
390 383
391 sid = sig->session; 384 sid = signal_session(sig);
392 pgid = process_group(task); 385 pgid = process_group(task);
393 ppid = rcu_dereference(task->real_parent)->tgid; 386 ppid = rcu_dereference(task->real_parent)->tgid;
394 387
395 unlock_task_sighand(task, &flags); 388 unlock_task_sighand(task, &flags);
396 } 389 }
397 rcu_read_unlock(); 390 rcu_read_unlock();
398 mutex_unlock(&tty_mutex);
399 391
400 if (!whole || num_threads<2) 392 if (!whole || num_threads<2)
401 wchan = get_wchan(task); 393 wchan = get_wchan(task);
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 82da55b5cf..77a57b5799 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -59,7 +59,7 @@
59#include <linux/string.h> 59#include <linux/string.h>
60#include <linux/seq_file.h> 60#include <linux/seq_file.h>
61#include <linux/namei.h> 61#include <linux/namei.h>
62#include <linux/namespace.h> 62#include <linux/mnt_namespace.h>
63#include <linux/mm.h> 63#include <linux/mm.h>
64#include <linux/smp_lock.h> 64#include <linux/smp_lock.h>
65#include <linux/rcupdate.h> 65#include <linux/rcupdate.h>
@@ -72,6 +72,7 @@
72#include <linux/audit.h> 72#include <linux/audit.h>
73#include <linux/poll.h> 73#include <linux/poll.h>
74#include <linux/nsproxy.h> 74#include <linux/nsproxy.h>
75#include <linux/oom.h>
75#include "internal.h" 76#include "internal.h"
76 77
77/* NOTE: 78/* NOTE:
@@ -86,7 +87,7 @@
86 87
87 88
88/* Worst case buffer size needed for holding an integer. */ 89/* Worst case buffer size needed for holding an integer. */
89#define PROC_NUMBUF 10 90#define PROC_NUMBUF 13
90 91
91struct pid_entry { 92struct pid_entry {
92 int len; 93 int len;
@@ -364,33 +365,33 @@ struct proc_mounts {
364static int mounts_open(struct inode *inode, struct file *file) 365static int mounts_open(struct inode *inode, struct file *file)
365{ 366{
366 struct task_struct *task = get_proc_task(inode); 367 struct task_struct *task = get_proc_task(inode);
367 struct namespace *namespace = NULL; 368 struct mnt_namespace *ns = NULL;
368 struct proc_mounts *p; 369 struct proc_mounts *p;
369 int ret = -EINVAL; 370 int ret = -EINVAL;
370 371
371 if (task) { 372 if (task) {
372 task_lock(task); 373 task_lock(task);
373 namespace = task->nsproxy->namespace; 374 ns = task->nsproxy->mnt_ns;
374 if (namespace) 375 if (ns)
375 get_namespace(namespace); 376 get_mnt_ns(ns);
376 task_unlock(task); 377 task_unlock(task);
377 put_task_struct(task); 378 put_task_struct(task);
378 } 379 }
379 380
380 if (namespace) { 381 if (ns) {
381 ret = -ENOMEM; 382 ret = -ENOMEM;
382 p = kmalloc(sizeof(struct proc_mounts), GFP_KERNEL); 383 p = kmalloc(sizeof(struct proc_mounts), GFP_KERNEL);
383 if (p) { 384 if (p) {
384 file->private_data = &p->m; 385 file->private_data = &p->m;
385 ret = seq_open(file, &mounts_op); 386 ret = seq_open(file, &mounts_op);
386 if (!ret) { 387 if (!ret) {
387 p->m.private = namespace; 388 p->m.private = ns;
388 p->event = namespace->event; 389 p->event = ns->event;
389 return 0; 390 return 0;
390 } 391 }
391 kfree(p); 392 kfree(p);
392 } 393 }
393 put_namespace(namespace); 394 put_mnt_ns(ns);
394 } 395 }
395 return ret; 396 return ret;
396} 397}
@@ -398,15 +399,15 @@ static int mounts_open(struct inode *inode, struct file *file)
398static int mounts_release(struct inode *inode, struct file *file) 399static int mounts_release(struct inode *inode, struct file *file)
399{ 400{
400 struct seq_file *m = file->private_data; 401 struct seq_file *m = file->private_data;
401 struct namespace *namespace = m->private; 402 struct mnt_namespace *ns = m->private;
402 put_namespace(namespace); 403 put_mnt_ns(ns);
403 return seq_release(inode, file); 404 return seq_release(inode, file);
404} 405}
405 406
406static unsigned mounts_poll(struct file *file, poll_table *wait) 407static unsigned mounts_poll(struct file *file, poll_table *wait)
407{ 408{
408 struct proc_mounts *p = file->private_data; 409 struct proc_mounts *p = file->private_data;
409 struct namespace *ns = p->m.private; 410 struct mnt_namespace *ns = p->m.private;
410 unsigned res = 0; 411 unsigned res = 0;
411 412
412 poll_wait(file, &ns->poll, wait); 413 poll_wait(file, &ns->poll, wait);
@@ -436,20 +437,21 @@ static int mountstats_open(struct inode *inode, struct file *file)
436 437
437 if (!ret) { 438 if (!ret) {
438 struct seq_file *m = file->private_data; 439 struct seq_file *m = file->private_data;
439 struct namespace *namespace = NULL; 440 struct mnt_namespace *mnt_ns = NULL;
440 struct task_struct *task = get_proc_task(inode); 441 struct task_struct *task = get_proc_task(inode);
441 442
442 if (task) { 443 if (task) {
443 task_lock(task); 444 task_lock(task);
444 namespace = task->nsproxy->namespace; 445 if (task->nsproxy)
445 if (namespace) 446 mnt_ns = task->nsproxy->mnt_ns;
446 get_namespace(namespace); 447 if (mnt_ns)
448 get_mnt_ns(mnt_ns);
447 task_unlock(task); 449 task_unlock(task);
448 put_task_struct(task); 450 put_task_struct(task);
449 } 451 }
450 452
451 if (namespace) 453 if (mnt_ns)
452 m->private = namespace; 454 m->private = mnt_ns;
453 else { 455 else {
454 seq_release(inode, file); 456 seq_release(inode, file);
455 ret = -EINVAL; 457 ret = -EINVAL;
@@ -470,7 +472,7 @@ static struct file_operations proc_mountstats_operations = {
470static ssize_t proc_info_read(struct file * file, char __user * buf, 472static ssize_t proc_info_read(struct file * file, char __user * buf,
471 size_t count, loff_t *ppos) 473 size_t count, loff_t *ppos)
472{ 474{
473 struct inode * inode = file->f_dentry->d_inode; 475 struct inode * inode = file->f_path.dentry->d_inode;
474 unsigned long page; 476 unsigned long page;
475 ssize_t length; 477 ssize_t length;
476 struct task_struct *task = get_proc_task(inode); 478 struct task_struct *task = get_proc_task(inode);
@@ -510,7 +512,7 @@ static int mem_open(struct inode* inode, struct file* file)
510static ssize_t mem_read(struct file * file, char __user * buf, 512static ssize_t mem_read(struct file * file, char __user * buf,
511 size_t count, loff_t *ppos) 513 size_t count, loff_t *ppos)
512{ 514{
513 struct task_struct *task = get_proc_task(file->f_dentry->d_inode); 515 struct task_struct *task = get_proc_task(file->f_path.dentry->d_inode);
514 char *page; 516 char *page;
515 unsigned long src = *ppos; 517 unsigned long src = *ppos;
516 int ret = -ESRCH; 518 int ret = -ESRCH;
@@ -582,7 +584,7 @@ static ssize_t mem_write(struct file * file, const char * buf,
582{ 584{
583 int copied; 585 int copied;
584 char *page; 586 char *page;
585 struct task_struct *task = get_proc_task(file->f_dentry->d_inode); 587 struct task_struct *task = get_proc_task(file->f_path.dentry->d_inode);
586 unsigned long dst = *ppos; 588 unsigned long dst = *ppos;
587 589
588 copied = -ESRCH; 590 copied = -ESRCH;
@@ -652,7 +654,7 @@ static struct file_operations proc_mem_operations = {
652static ssize_t oom_adjust_read(struct file *file, char __user *buf, 654static ssize_t oom_adjust_read(struct file *file, char __user *buf,
653 size_t count, loff_t *ppos) 655 size_t count, loff_t *ppos)
654{ 656{
655 struct task_struct *task = get_proc_task(file->f_dentry->d_inode); 657 struct task_struct *task = get_proc_task(file->f_path.dentry->d_inode);
656 char buffer[PROC_NUMBUF]; 658 char buffer[PROC_NUMBUF];
657 size_t len; 659 size_t len;
658 int oom_adjust; 660 int oom_adjust;
@@ -681,21 +683,24 @@ static ssize_t oom_adjust_write(struct file *file, const char __user *buf,
681 char buffer[PROC_NUMBUF], *end; 683 char buffer[PROC_NUMBUF], *end;
682 int oom_adjust; 684 int oom_adjust;
683 685
684 if (!capable(CAP_SYS_RESOURCE))
685 return -EPERM;
686 memset(buffer, 0, sizeof(buffer)); 686 memset(buffer, 0, sizeof(buffer));
687 if (count > sizeof(buffer) - 1) 687 if (count > sizeof(buffer) - 1)
688 count = sizeof(buffer) - 1; 688 count = sizeof(buffer) - 1;
689 if (copy_from_user(buffer, buf, count)) 689 if (copy_from_user(buffer, buf, count))
690 return -EFAULT; 690 return -EFAULT;
691 oom_adjust = simple_strtol(buffer, &end, 0); 691 oom_adjust = simple_strtol(buffer, &end, 0);
692 if ((oom_adjust < -16 || oom_adjust > 15) && oom_adjust != OOM_DISABLE) 692 if ((oom_adjust < OOM_ADJUST_MIN || oom_adjust > OOM_ADJUST_MAX) &&
693 oom_adjust != OOM_DISABLE)
693 return -EINVAL; 694 return -EINVAL;
694 if (*end == '\n') 695 if (*end == '\n')
695 end++; 696 end++;
696 task = get_proc_task(file->f_dentry->d_inode); 697 task = get_proc_task(file->f_path.dentry->d_inode);
697 if (!task) 698 if (!task)
698 return -ESRCH; 699 return -ESRCH;
700 if (oom_adjust < task->oomkilladj && !capable(CAP_SYS_RESOURCE)) {
701 put_task_struct(task);
702 return -EACCES;
703 }
699 task->oomkilladj = oom_adjust; 704 task->oomkilladj = oom_adjust;
700 put_task_struct(task); 705 put_task_struct(task);
701 if (end - buffer == 0) 706 if (end - buffer == 0)
@@ -713,7 +718,7 @@ static struct file_operations proc_oom_adjust_operations = {
713static ssize_t proc_loginuid_read(struct file * file, char __user * buf, 718static ssize_t proc_loginuid_read(struct file * file, char __user * buf,
714 size_t count, loff_t *ppos) 719 size_t count, loff_t *ppos)
715{ 720{
716 struct inode * inode = file->f_dentry->d_inode; 721 struct inode * inode = file->f_path.dentry->d_inode;
717 struct task_struct *task = get_proc_task(inode); 722 struct task_struct *task = get_proc_task(inode);
718 ssize_t length; 723 ssize_t length;
719 char tmpbuf[TMPBUFLEN]; 724 char tmpbuf[TMPBUFLEN];
@@ -729,7 +734,7 @@ static ssize_t proc_loginuid_read(struct file * file, char __user * buf,
729static ssize_t proc_loginuid_write(struct file * file, const char __user * buf, 734static ssize_t proc_loginuid_write(struct file * file, const char __user * buf,
730 size_t count, loff_t *ppos) 735 size_t count, loff_t *ppos)
731{ 736{
732 struct inode * inode = file->f_dentry->d_inode; 737 struct inode * inode = file->f_path.dentry->d_inode;
733 char *page, *tmp; 738 char *page, *tmp;
734 ssize_t length; 739 ssize_t length;
735 uid_t loginuid; 740 uid_t loginuid;
@@ -848,6 +853,65 @@ static struct file_operations proc_seccomp_operations = {
848}; 853};
849#endif /* CONFIG_SECCOMP */ 854#endif /* CONFIG_SECCOMP */
850 855
856#ifdef CONFIG_FAULT_INJECTION
857static ssize_t proc_fault_inject_read(struct file * file, char __user * buf,
858 size_t count, loff_t *ppos)
859{
860 struct task_struct *task = get_proc_task(file->f_dentry->d_inode);
861 char buffer[PROC_NUMBUF];
862 size_t len;
863 int make_it_fail;
864 loff_t __ppos = *ppos;
865
866 if (!task)
867 return -ESRCH;
868 make_it_fail = task->make_it_fail;
869 put_task_struct(task);
870
871 len = snprintf(buffer, sizeof(buffer), "%i\n", make_it_fail);
872 if (__ppos >= len)
873 return 0;
874 if (count > len-__ppos)
875 count = len-__ppos;
876 if (copy_to_user(buf, buffer + __ppos, count))
877 return -EFAULT;
878 *ppos = __ppos + count;
879 return count;
880}
881
882static ssize_t proc_fault_inject_write(struct file * file,
883 const char __user * buf, size_t count, loff_t *ppos)
884{
885 struct task_struct *task;
886 char buffer[PROC_NUMBUF], *end;
887 int make_it_fail;
888
889 if (!capable(CAP_SYS_RESOURCE))
890 return -EPERM;
891 memset(buffer, 0, sizeof(buffer));
892 if (count > sizeof(buffer) - 1)
893 count = sizeof(buffer) - 1;
894 if (copy_from_user(buffer, buf, count))
895 return -EFAULT;
896 make_it_fail = simple_strtol(buffer, &end, 0);
897 if (*end == '\n')
898 end++;
899 task = get_proc_task(file->f_dentry->d_inode);
900 if (!task)
901 return -ESRCH;
902 task->make_it_fail = make_it_fail;
903 put_task_struct(task);
904 if (end - buffer == 0)
905 return -EIO;
906 return end - buffer;
907}
908
909static struct file_operations proc_fault_inject_operations = {
910 .read = proc_fault_inject_read,
911 .write = proc_fault_inject_write,
912};
913#endif
914
851static void *proc_pid_follow_link(struct dentry *dentry, struct nameidata *nd) 915static void *proc_pid_follow_link(struct dentry *dentry, struct nameidata *nd)
852{ 916{
853 struct inode *inode = dentry->d_inode; 917 struct inode *inode = dentry->d_inode;
@@ -1073,7 +1137,7 @@ static int proc_fill_cache(struct file *filp, void *dirent, filldir_t filldir,
1073 char *name, int len, 1137 char *name, int len,
1074 instantiate_t instantiate, struct task_struct *task, void *ptr) 1138 instantiate_t instantiate, struct task_struct *task, void *ptr)
1075{ 1139{
1076 struct dentry *child, *dir = filp->f_dentry; 1140 struct dentry *child, *dir = filp->f_path.dentry;
1077 struct inode *inode; 1141 struct inode *inode;
1078 struct qstr qname; 1142 struct qstr qname;
1079 ino_t ino = 0; 1143 ino_t ino = 0;
@@ -1152,8 +1216,8 @@ static int proc_fd_link(struct inode *inode, struct dentry **dentry, struct vfsm
1152 spin_lock(&files->file_lock); 1216 spin_lock(&files->file_lock);
1153 file = fcheck_files(files, fd); 1217 file = fcheck_files(files, fd);
1154 if (file) { 1218 if (file) {
1155 *mnt = mntget(file->f_vfsmnt); 1219 *mnt = mntget(file->f_path.mnt);
1156 *dentry = dget(file->f_dentry); 1220 *dentry = dget(file->f_path.dentry);
1157 spin_unlock(&files->file_lock); 1221 spin_unlock(&files->file_lock);
1158 put_files_struct(files); 1222 put_files_struct(files);
1159 return 0; 1223 return 0;
@@ -1288,7 +1352,7 @@ static int proc_fd_fill_cache(struct file *filp, void *dirent, filldir_t filldir
1288 1352
1289static int proc_readfd(struct file * filp, void * dirent, filldir_t filldir) 1353static int proc_readfd(struct file * filp, void * dirent, filldir_t filldir)
1290{ 1354{
1291 struct dentry *dentry = filp->f_dentry; 1355 struct dentry *dentry = filp->f_path.dentry;
1292 struct inode *inode = dentry->d_inode; 1356 struct inode *inode = dentry->d_inode;
1293 struct task_struct *p = get_proc_task(inode); 1357 struct task_struct *p = get_proc_task(inode);
1294 unsigned int fd, tid, ino; 1358 unsigned int fd, tid, ino;
@@ -1435,7 +1499,7 @@ static int proc_pident_readdir(struct file *filp,
1435{ 1499{
1436 int i; 1500 int i;
1437 int pid; 1501 int pid;
1438 struct dentry *dentry = filp->f_dentry; 1502 struct dentry *dentry = filp->f_path.dentry;
1439 struct inode *inode = dentry->d_inode; 1503 struct inode *inode = dentry->d_inode;
1440 struct task_struct *task = get_proc_task(inode); 1504 struct task_struct *task = get_proc_task(inode);
1441 struct pid_entry *p, *last; 1505 struct pid_entry *p, *last;
@@ -1491,7 +1555,7 @@ out_no_task:
1491static ssize_t proc_pid_attr_read(struct file * file, char __user * buf, 1555static ssize_t proc_pid_attr_read(struct file * file, char __user * buf,
1492 size_t count, loff_t *ppos) 1556 size_t count, loff_t *ppos)
1493{ 1557{
1494 struct inode * inode = file->f_dentry->d_inode; 1558 struct inode * inode = file->f_path.dentry->d_inode;
1495 unsigned long page; 1559 unsigned long page;
1496 ssize_t length; 1560 ssize_t length;
1497 struct task_struct *task = get_proc_task(inode); 1561 struct task_struct *task = get_proc_task(inode);
@@ -1507,7 +1571,7 @@ static ssize_t proc_pid_attr_read(struct file * file, char __user * buf,
1507 goto out; 1571 goto out;
1508 1572
1509 length = security_getprocattr(task, 1573 length = security_getprocattr(task,
1510 (char*)file->f_dentry->d_name.name, 1574 (char*)file->f_path.dentry->d_name.name,
1511 (void*)page, count); 1575 (void*)page, count);
1512 if (length >= 0) 1576 if (length >= 0)
1513 length = simple_read_from_buffer(buf, count, ppos, (char *)page, length); 1577 length = simple_read_from_buffer(buf, count, ppos, (char *)page, length);
@@ -1521,7 +1585,7 @@ out_no_task:
1521static ssize_t proc_pid_attr_write(struct file * file, const char __user * buf, 1585static ssize_t proc_pid_attr_write(struct file * file, const char __user * buf,
1522 size_t count, loff_t *ppos) 1586 size_t count, loff_t *ppos)
1523{ 1587{
1524 struct inode * inode = file->f_dentry->d_inode; 1588 struct inode * inode = file->f_path.dentry->d_inode;
1525 char *page; 1589 char *page;
1526 ssize_t length; 1590 ssize_t length;
1527 struct task_struct *task = get_proc_task(inode); 1591 struct task_struct *task = get_proc_task(inode);
@@ -1547,7 +1611,7 @@ static ssize_t proc_pid_attr_write(struct file * file, const char __user * buf,
1547 goto out_free; 1611 goto out_free;
1548 1612
1549 length = security_setprocattr(task, 1613 length = security_setprocattr(task,
1550 (char*)file->f_dentry->d_name.name, 1614 (char*)file->f_path.dentry->d_name.name,
1551 (void*)page, count); 1615 (void*)page, count);
1552out_free: 1616out_free:
1553 free_page((unsigned long) page); 1617 free_page((unsigned long) page);
@@ -1740,6 +1804,27 @@ static int proc_base_fill_cache(struct file *filp, void *dirent, filldir_t filld
1740 proc_base_instantiate, task, p); 1804 proc_base_instantiate, task, p);
1741} 1805}
1742 1806
1807#ifdef CONFIG_TASK_IO_ACCOUNTING
1808static int proc_pid_io_accounting(struct task_struct *task, char *buffer)
1809{
1810 return sprintf(buffer,
1811 "rchar: %llu\n"
1812 "wchar: %llu\n"
1813 "syscr: %llu\n"
1814 "syscw: %llu\n"
1815 "read_bytes: %llu\n"
1816 "write_bytes: %llu\n"
1817 "cancelled_write_bytes: %llu\n",
1818 (unsigned long long)task->rchar,
1819 (unsigned long long)task->wchar,
1820 (unsigned long long)task->syscr,
1821 (unsigned long long)task->syscw,
1822 (unsigned long long)task->ioac.read_bytes,
1823 (unsigned long long)task->ioac.write_bytes,
1824 (unsigned long long)task->ioac.cancelled_write_bytes);
1825}
1826#endif
1827
1743/* 1828/*
1744 * Thread groups 1829 * Thread groups
1745 */ 1830 */
@@ -1788,6 +1873,12 @@ static struct pid_entry tgid_base_stuff[] = {
1788#ifdef CONFIG_AUDITSYSCALL 1873#ifdef CONFIG_AUDITSYSCALL
1789 REG("loginuid", S_IWUSR|S_IRUGO, loginuid), 1874 REG("loginuid", S_IWUSR|S_IRUGO, loginuid),
1790#endif 1875#endif
1876#ifdef CONFIG_FAULT_INJECTION
1877 REG("make-it-fail", S_IRUGO|S_IWUSR, fault_inject),
1878#endif
1879#ifdef CONFIG_TASK_IO_ACCOUNTING
1880 INF("io", S_IRUGO, pid_io_accounting),
1881#endif
1791}; 1882};
1792 1883
1793static int proc_tgid_base_readdir(struct file * filp, 1884static int proc_tgid_base_readdir(struct file * filp,
@@ -1880,8 +1971,9 @@ out:
1880 return; 1971 return;
1881} 1972}
1882 1973
1883struct dentry *proc_pid_instantiate(struct inode *dir, 1974static struct dentry *proc_pid_instantiate(struct inode *dir,
1884 struct dentry * dentry, struct task_struct *task, void *ptr) 1975 struct dentry * dentry,
1976 struct task_struct *task, void *ptr)
1885{ 1977{
1886 struct dentry *error = ERR_PTR(-ENOENT); 1978 struct dentry *error = ERR_PTR(-ENOENT);
1887 struct inode *inode; 1979 struct inode *inode;
@@ -1988,7 +2080,7 @@ static int proc_pid_fill_cache(struct file *filp, void *dirent, filldir_t filldi
1988int proc_pid_readdir(struct file * filp, void * dirent, filldir_t filldir) 2080int proc_pid_readdir(struct file * filp, void * dirent, filldir_t filldir)
1989{ 2081{
1990 unsigned int nr = filp->f_pos - FIRST_PROCESS_ENTRY; 2082 unsigned int nr = filp->f_pos - FIRST_PROCESS_ENTRY;
1991 struct task_struct *reaper = get_proc_task(filp->f_dentry->d_inode); 2083 struct task_struct *reaper = get_proc_task(filp->f_path.dentry->d_inode);
1992 struct task_struct *task; 2084 struct task_struct *task;
1993 int tgid; 2085 int tgid;
1994 2086
@@ -2062,6 +2154,9 @@ static struct pid_entry tid_base_stuff[] = {
2062#ifdef CONFIG_AUDITSYSCALL 2154#ifdef CONFIG_AUDITSYSCALL
2063 REG("loginuid", S_IWUSR|S_IRUGO, loginuid), 2155 REG("loginuid", S_IWUSR|S_IRUGO, loginuid),
2064#endif 2156#endif
2157#ifdef CONFIG_FAULT_INJECTION
2158 REG("make-it-fail", S_IRUGO|S_IWUSR, fault_inject),
2159#endif
2065}; 2160};
2066 2161
2067static int proc_tid_base_readdir(struct file * filp, 2162static int proc_tid_base_readdir(struct file * filp,
@@ -2229,7 +2324,7 @@ static int proc_task_fill_cache(struct file *filp, void *dirent, filldir_t filld
2229/* for the /proc/TGID/task/ directories */ 2324/* for the /proc/TGID/task/ directories */
2230static int proc_task_readdir(struct file * filp, void * dirent, filldir_t filldir) 2325static int proc_task_readdir(struct file * filp, void * dirent, filldir_t filldir)
2231{ 2326{
2232 struct dentry *dentry = filp->f_dentry; 2327 struct dentry *dentry = filp->f_path.dentry;
2233 struct inode *inode = dentry->d_inode; 2328 struct inode *inode = dentry->d_inode;
2234 struct task_struct *leader = get_proc_task(inode); 2329 struct task_struct *leader = get_proc_task(inode);
2235 struct task_struct *task; 2330 struct task_struct *task;
diff --git a/fs/proc/generic.c b/fs/proc/generic.c
index 4ba03009cf..853cb877d5 100644
--- a/fs/proc/generic.c
+++ b/fs/proc/generic.c
@@ -52,7 +52,7 @@ static ssize_t
52proc_file_read(struct file *file, char __user *buf, size_t nbytes, 52proc_file_read(struct file *file, char __user *buf, size_t nbytes,
53 loff_t *ppos) 53 loff_t *ppos)
54{ 54{
55 struct inode * inode = file->f_dentry->d_inode; 55 struct inode * inode = file->f_path.dentry->d_inode;
56 char *page; 56 char *page;
57 ssize_t retval=0; 57 ssize_t retval=0;
58 int eof=0; 58 int eof=0;
@@ -203,7 +203,7 @@ static ssize_t
203proc_file_write(struct file *file, const char __user *buffer, 203proc_file_write(struct file *file, const char __user *buffer,
204 size_t count, loff_t *ppos) 204 size_t count, loff_t *ppos)
205{ 205{
206 struct inode *inode = file->f_dentry->d_inode; 206 struct inode *inode = file->f_path.dentry->d_inode;
207 struct proc_dir_entry * dp; 207 struct proc_dir_entry * dp;
208 208
209 dp = PDE(inode); 209 dp = PDE(inode);
@@ -432,7 +432,7 @@ int proc_readdir(struct file * filp,
432 struct proc_dir_entry * de; 432 struct proc_dir_entry * de;
433 unsigned int ino; 433 unsigned int ino;
434 int i; 434 int i;
435 struct inode *inode = filp->f_dentry->d_inode; 435 struct inode *inode = filp->f_path.dentry->d_inode;
436 int ret = 0; 436 int ret = 0;
437 437
438 lock_kernel(); 438 lock_kernel();
@@ -453,7 +453,7 @@ int proc_readdir(struct file * filp,
453 /* fall through */ 453 /* fall through */
454 case 1: 454 case 1:
455 if (filldir(dirent, "..", 2, i, 455 if (filldir(dirent, "..", 2, i,
456 parent_ino(filp->f_dentry), 456 parent_ino(filp->f_path.dentry),
457 DT_DIR) < 0) 457 DT_DIR) < 0)
458 goto out; 458 goto out;
459 i++; 459 i++;
@@ -558,7 +558,7 @@ static void proc_kill_inodes(struct proc_dir_entry *de)
558 file_list_lock(); 558 file_list_lock();
559 list_for_each(p, &sb->s_files) { 559 list_for_each(p, &sb->s_files) {
560 struct file * filp = list_entry(p, struct file, f_u.fu_list); 560 struct file * filp = list_entry(p, struct file, f_u.fu_list);
561 struct dentry * dentry = filp->f_dentry; 561 struct dentry * dentry = filp->f_path.dentry;
562 struct inode * inode; 562 struct inode * inode;
563 const struct file_operations *fops; 563 const struct file_operations *fops;
564 564
diff --git a/fs/proc/inode.c b/fs/proc/inode.c
index 49dfb2ab78..e26945ba68 100644
--- a/fs/proc/inode.c
+++ b/fs/proc/inode.c
@@ -81,14 +81,14 @@ static void proc_read_inode(struct inode * inode)
81 inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; 81 inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
82} 82}
83 83
84static kmem_cache_t * proc_inode_cachep; 84static struct kmem_cache * proc_inode_cachep;
85 85
86static struct inode *proc_alloc_inode(struct super_block *sb) 86static struct inode *proc_alloc_inode(struct super_block *sb)
87{ 87{
88 struct proc_inode *ei; 88 struct proc_inode *ei;
89 struct inode *inode; 89 struct inode *inode;
90 90
91 ei = (struct proc_inode *)kmem_cache_alloc(proc_inode_cachep, SLAB_KERNEL); 91 ei = (struct proc_inode *)kmem_cache_alloc(proc_inode_cachep, GFP_KERNEL);
92 if (!ei) 92 if (!ei)
93 return NULL; 93 return NULL;
94 ei->pid = NULL; 94 ei->pid = NULL;
@@ -105,7 +105,7 @@ static void proc_destroy_inode(struct inode *inode)
105 kmem_cache_free(proc_inode_cachep, PROC_I(inode)); 105 kmem_cache_free(proc_inode_cachep, PROC_I(inode));
106} 106}
107 107
108static void init_once(void * foo, kmem_cache_t * cachep, unsigned long flags) 108static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags)
109{ 109{
110 struct proc_inode *ei = (struct proc_inode *) foo; 110 struct proc_inode *ei = (struct proc_inode *) foo;
111 111
diff --git a/fs/proc/kcore.c b/fs/proc/kcore.c
index 1294eda4ac..1be73082ed 100644
--- a/fs/proc/kcore.c
+++ b/fs/proc/kcore.c
@@ -22,6 +22,7 @@
22#include <asm/uaccess.h> 22#include <asm/uaccess.h>
23#include <asm/io.h> 23#include <asm/io.h>
24 24
25#define CORE_STR "CORE"
25 26
26static int open_kcore(struct inode * inode, struct file * filp) 27static int open_kcore(struct inode * inode, struct file * filp)
27{ 28{
@@ -82,10 +83,11 @@ static size_t get_kcore_size(int *nphdr, size_t *elf_buflen)
82 } 83 }
83 *elf_buflen = sizeof(struct elfhdr) + 84 *elf_buflen = sizeof(struct elfhdr) +
84 (*nphdr + 2)*sizeof(struct elf_phdr) + 85 (*nphdr + 2)*sizeof(struct elf_phdr) +
85 3 * (sizeof(struct elf_note) + 4) + 86 3 * ((sizeof(struct elf_note)) +
86 sizeof(struct elf_prstatus) + 87 roundup(sizeof(CORE_STR), 4)) +
87 sizeof(struct elf_prpsinfo) + 88 roundup(sizeof(struct elf_prstatus), 4) +
88 sizeof(struct task_struct); 89 roundup(sizeof(struct elf_prpsinfo), 4) +
90 roundup(sizeof(struct task_struct), 4);
89 *elf_buflen = PAGE_ALIGN(*elf_buflen); 91 *elf_buflen = PAGE_ALIGN(*elf_buflen);
90 return size + *elf_buflen; 92 return size + *elf_buflen;
91} 93}
@@ -210,7 +212,7 @@ static void elf_kcore_store_hdr(char *bufp, int nphdr, int dataoff)
210 nhdr->p_offset = offset; 212 nhdr->p_offset = offset;
211 213
212 /* set up the process status */ 214 /* set up the process status */
213 notes[0].name = "CORE"; 215 notes[0].name = CORE_STR;
214 notes[0].type = NT_PRSTATUS; 216 notes[0].type = NT_PRSTATUS;
215 notes[0].datasz = sizeof(struct elf_prstatus); 217 notes[0].datasz = sizeof(struct elf_prstatus);
216 notes[0].data = &prstatus; 218 notes[0].data = &prstatus;
@@ -221,7 +223,7 @@ static void elf_kcore_store_hdr(char *bufp, int nphdr, int dataoff)
221 bufp = storenote(&notes[0], bufp); 223 bufp = storenote(&notes[0], bufp);
222 224
223 /* set up the process info */ 225 /* set up the process info */
224 notes[1].name = "CORE"; 226 notes[1].name = CORE_STR;
225 notes[1].type = NT_PRPSINFO; 227 notes[1].type = NT_PRPSINFO;
226 notes[1].datasz = sizeof(struct elf_prpsinfo); 228 notes[1].datasz = sizeof(struct elf_prpsinfo);
227 notes[1].data = &prpsinfo; 229 notes[1].data = &prpsinfo;
@@ -238,7 +240,7 @@ static void elf_kcore_store_hdr(char *bufp, int nphdr, int dataoff)
238 bufp = storenote(&notes[1], bufp); 240 bufp = storenote(&notes[1], bufp);
239 241
240 /* set up the task structure */ 242 /* set up the task structure */
241 notes[2].name = "CORE"; 243 notes[2].name = CORE_STR;
242 notes[2].type = NT_TASKSTRUCT; 244 notes[2].type = NT_TASKSTRUCT;
243 notes[2].datasz = sizeof(struct task_struct); 245 notes[2].datasz = sizeof(struct task_struct);
244 notes[2].data = current; 246 notes[2].data = current;
diff --git a/fs/proc/nommu.c b/fs/proc/nommu.c
index d7dbdf9e0f..5ec67257e5 100644
--- a/fs/proc/nommu.c
+++ b/fs/proc/nommu.c
@@ -46,7 +46,7 @@ int nommu_vma_show(struct seq_file *m, struct vm_area_struct *vma)
46 file = vma->vm_file; 46 file = vma->vm_file;
47 47
48 if (file) { 48 if (file) {
49 struct inode *inode = vma->vm_file->f_dentry->d_inode; 49 struct inode *inode = vma->vm_file->f_path.dentry->d_inode;
50 dev = inode->i_sb->s_dev; 50 dev = inode->i_sb->s_dev;
51 ino = inode->i_ino; 51 ino = inode->i_ino;
52 } 52 }
@@ -67,7 +67,7 @@ int nommu_vma_show(struct seq_file *m, struct vm_area_struct *vma)
67 if (len < 1) 67 if (len < 1)
68 len = 1; 68 len = 1;
69 seq_printf(m, "%*c", len, ' '); 69 seq_printf(m, "%*c", len, ' ');
70 seq_path(m, file->f_vfsmnt, file->f_dentry, ""); 70 seq_path(m, file->f_path.mnt, file->f_path.dentry, "");
71 } 71 }
72 72
73 seq_putc(m, '\n'); 73 seq_putc(m, '\n');
diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c
index 93c43b676e..92ea7743fe 100644
--- a/fs/proc/proc_misc.c
+++ b/fs/proc/proc_misc.c
@@ -39,13 +39,15 @@
39#include <linux/seq_file.h> 39#include <linux/seq_file.h>
40#include <linux/times.h> 40#include <linux/times.h>
41#include <linux/profile.h> 41#include <linux/profile.h>
42#include <linux/utsname.h>
42#include <linux/blkdev.h> 43#include <linux/blkdev.h>
43#include <linux/hugetlb.h> 44#include <linux/hugetlb.h>
44#include <linux/jiffies.h> 45#include <linux/jiffies.h>
45#include <linux/sysrq.h> 46#include <linux/sysrq.h>
46#include <linux/vmalloc.h> 47#include <linux/vmalloc.h>
47#include <linux/crash_dump.h> 48#include <linux/crash_dump.h>
48#include <linux/pspace.h> 49#include <linux/pid_namespace.h>
50#include <linux/compile.h>
49#include <asm/uaccess.h> 51#include <asm/uaccess.h>
50#include <asm/pgtable.h> 52#include <asm/pgtable.h>
51#include <asm/io.h> 53#include <asm/io.h>
@@ -92,7 +94,7 @@ static int loadavg_read_proc(char *page, char **start, off_t off,
92 LOAD_INT(a), LOAD_FRAC(a), 94 LOAD_INT(a), LOAD_FRAC(a),
93 LOAD_INT(b), LOAD_FRAC(b), 95 LOAD_INT(b), LOAD_FRAC(b),
94 LOAD_INT(c), LOAD_FRAC(c), 96 LOAD_INT(c), LOAD_FRAC(c),
95 nr_running(), nr_threads, init_pspace.last_pid); 97 nr_running(), nr_threads, current->nsproxy->pid_ns->last_pid);
96 return proc_calc_metrics(page, start, off, count, eof, len); 98 return proc_calc_metrics(page, start, off, count, eof, len);
97} 99}
98 100
@@ -252,8 +254,15 @@ static int version_read_proc(char *page, char **start, off_t off,
252{ 254{
253 int len; 255 int len;
254 256
255 strcpy(page, linux_banner); 257 /* FIXED STRING! Don't touch! */
256 len = strlen(page); 258 len = snprintf(page, PAGE_SIZE,
259 "%s version %s"
260 " (" LINUX_COMPILE_BY "@" LINUX_COMPILE_HOST ")"
261 " (" LINUX_COMPILER ")"
262 " %s\n",
263 utsname()->sysname,
264 utsname()->release,
265 utsname()->version);
257 return proc_calc_metrics(page, start, off, count, eof, len); 266 return proc_calc_metrics(page, start, off, count, eof, len);
258} 267}
259 268
@@ -696,9 +705,11 @@ void __init proc_misc_init(void)
696 proc_symlink("mounts", NULL, "self/mounts"); 705 proc_symlink("mounts", NULL, "self/mounts");
697 706
698 /* And now for trickier ones */ 707 /* And now for trickier ones */
708#ifdef CONFIG_PRINTK
699 entry = create_proc_entry("kmsg", S_IRUSR, &proc_root); 709 entry = create_proc_entry("kmsg", S_IRUSR, &proc_root);
700 if (entry) 710 if (entry)
701 entry->proc_fops = &proc_kmsg_operations; 711 entry->proc_fops = &proc_kmsg_operations;
712#endif
702 create_seq_entry("devices", 0, &proc_devinfo_operations); 713 create_seq_entry("devices", 0, &proc_devinfo_operations);
703 create_seq_entry("cpuinfo", 0, &proc_cpuinfo_operations); 714 create_seq_entry("cpuinfo", 0, &proc_cpuinfo_operations);
704#ifdef CONFIG_BLOCK 715#ifdef CONFIG_BLOCK
diff --git a/fs/proc/root.c b/fs/proc/root.c
index ffe66c3848..64d242b6dc 100644
--- a/fs/proc/root.c
+++ b/fs/proc/root.c
@@ -13,6 +13,7 @@
13#include <linux/proc_fs.h> 13#include <linux/proc_fs.h>
14#include <linux/stat.h> 14#include <linux/stat.h>
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/sched.h>
16#include <linux/module.h> 17#include <linux/module.h>
17#include <linux/bitops.h> 18#include <linux/bitops.h>
18#include <linux/smp_lock.h> 19#include <linux/smp_lock.h>
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index 6b769afac5..55ade0d156 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -94,8 +94,8 @@ int proc_exe_link(struct inode *inode, struct dentry **dentry, struct vfsmount *
94 } 94 }
95 95
96 if (vma) { 96 if (vma) {
97 *mnt = mntget(vma->vm_file->f_vfsmnt); 97 *mnt = mntget(vma->vm_file->f_path.mnt);
98 *dentry = dget(vma->vm_file->f_dentry); 98 *dentry = dget(vma->vm_file->f_path.dentry);
99 result = 0; 99 result = 0;
100 } 100 }
101 101
@@ -135,7 +135,7 @@ static int show_map_internal(struct seq_file *m, void *v, struct mem_size_stats
135 int len; 135 int len;
136 136
137 if (file) { 137 if (file) {
138 struct inode *inode = vma->vm_file->f_dentry->d_inode; 138 struct inode *inode = vma->vm_file->f_path.dentry->d_inode;
139 dev = inode->i_sb->s_dev; 139 dev = inode->i_sb->s_dev;
140 ino = inode->i_ino; 140 ino = inode->i_ino;
141 } 141 }
@@ -156,7 +156,7 @@ static int show_map_internal(struct seq_file *m, void *v, struct mem_size_stats
156 */ 156 */
157 if (file) { 157 if (file) {
158 pad_len_spaces(m, len); 158 pad_len_spaces(m, len);
159 seq_path(m, file->f_vfsmnt, file->f_dentry, "\n"); 159 seq_path(m, file->f_path.mnt, file->f_path.dentry, "\n");
160 } else { 160 } else {
161 const char *name = arch_vma_name(vma); 161 const char *name = arch_vma_name(vma);
162 if (!name) { 162 if (!name) {
diff --git a/fs/proc/task_nommu.c b/fs/proc/task_nommu.c
index 091aa8e48e..fcc5caf93f 100644
--- a/fs/proc/task_nommu.c
+++ b/fs/proc/task_nommu.c
@@ -126,8 +126,8 @@ int proc_exe_link(struct inode *inode, struct dentry **dentry, struct vfsmount *
126 } 126 }
127 127
128 if (vma) { 128 if (vma) {
129 *mnt = mntget(vma->vm_file->f_vfsmnt); 129 *mnt = mntget(vma->vm_file->f_path.mnt);
130 *dentry = dget(vma->vm_file->f_dentry); 130 *dentry = dget(vma->vm_file->f_path.dentry);
131 result = 0; 131 result = 0;
132 } 132 }
133 133