diff options
Diffstat (limited to 'fs/proc')
| -rw-r--r-- | fs/proc/base.c | 9 | ||||
| -rw-r--r-- | fs/proc/proc_misc.c | 16 | ||||
| -rw-r--r-- | fs/proc/task_mmu.c | 6 | ||||
| -rw-r--r-- | fs/proc/task_nommu.c | 2 |
4 files changed, 25 insertions, 8 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c index 3b455371e7ff..58c3e6a8e15e 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
| @@ -233,7 +233,7 @@ static int check_mem_permission(struct task_struct *task) | |||
| 233 | */ | 233 | */ |
| 234 | if (task->parent == current && (task->ptrace & PT_PTRACED) && | 234 | if (task->parent == current && (task->ptrace & PT_PTRACED) && |
| 235 | task_is_stopped_or_traced(task) && | 235 | task_is_stopped_or_traced(task) && |
| 236 | ptrace_may_attach(task)) | 236 | ptrace_may_access(task, PTRACE_MODE_ATTACH)) |
| 237 | return 0; | 237 | return 0; |
| 238 | 238 | ||
| 239 | /* | 239 | /* |
| @@ -251,7 +251,8 @@ struct mm_struct *mm_for_maps(struct task_struct *task) | |||
| 251 | task_lock(task); | 251 | task_lock(task); |
| 252 | if (task->mm != mm) | 252 | if (task->mm != mm) |
| 253 | goto out; | 253 | goto out; |
| 254 | if (task->mm != current->mm && __ptrace_may_attach(task) < 0) | 254 | if (task->mm != current->mm && |
| 255 | __ptrace_may_access(task, PTRACE_MODE_READ) < 0) | ||
| 255 | goto out; | 256 | goto out; |
| 256 | task_unlock(task); | 257 | task_unlock(task); |
| 257 | return mm; | 258 | return mm; |
| @@ -518,7 +519,7 @@ static int proc_fd_access_allowed(struct inode *inode) | |||
| 518 | */ | 519 | */ |
| 519 | task = get_proc_task(inode); | 520 | task = get_proc_task(inode); |
| 520 | if (task) { | 521 | if (task) { |
| 521 | allowed = ptrace_may_attach(task); | 522 | allowed = ptrace_may_access(task, PTRACE_MODE_READ); |
| 522 | put_task_struct(task); | 523 | put_task_struct(task); |
| 523 | } | 524 | } |
| 524 | return allowed; | 525 | return allowed; |
| @@ -904,7 +905,7 @@ static ssize_t environ_read(struct file *file, char __user *buf, | |||
| 904 | if (!task) | 905 | if (!task) |
| 905 | goto out_no_task; | 906 | goto out_no_task; |
| 906 | 907 | ||
| 907 | if (!ptrace_may_attach(task)) | 908 | if (!ptrace_may_access(task, PTRACE_MODE_READ)) |
| 908 | goto out; | 909 | goto out; |
| 909 | 910 | ||
| 910 | ret = -ENOMEM; | 911 | ret = -ENOMEM; |
diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c index 7e277f2ad466..c652d469dc08 100644 --- a/fs/proc/proc_misc.c +++ b/fs/proc/proc_misc.c | |||
| @@ -123,6 +123,11 @@ static int uptime_read_proc(char *page, char **start, off_t off, | |||
| 123 | return proc_calc_metrics(page, start, off, count, eof, len); | 123 | return proc_calc_metrics(page, start, off, count, eof, len); |
| 124 | } | 124 | } |
| 125 | 125 | ||
| 126 | int __attribute__((weak)) arch_report_meminfo(char *page) | ||
| 127 | { | ||
| 128 | return 0; | ||
| 129 | } | ||
| 130 | |||
| 126 | static int meminfo_read_proc(char *page, char **start, off_t off, | 131 | static int meminfo_read_proc(char *page, char **start, off_t off, |
| 127 | int count, int *eof, void *data) | 132 | int count, int *eof, void *data) |
| 128 | { | 133 | { |
| @@ -221,6 +226,8 @@ static int meminfo_read_proc(char *page, char **start, off_t off, | |||
| 221 | 226 | ||
| 222 | len += hugetlb_report_meminfo(page + len); | 227 | len += hugetlb_report_meminfo(page + len); |
| 223 | 228 | ||
| 229 | len += arch_report_meminfo(page + len); | ||
| 230 | |||
| 224 | return proc_calc_metrics(page, start, off, count, eof, len); | 231 | return proc_calc_metrics(page, start, off, count, eof, len); |
| 225 | #undef K | 232 | #undef K |
| 226 | } | 233 | } |
| @@ -472,6 +479,13 @@ static const struct file_operations proc_vmalloc_operations = { | |||
| 472 | }; | 479 | }; |
| 473 | #endif | 480 | #endif |
| 474 | 481 | ||
| 482 | #ifndef arch_irq_stat_cpu | ||
| 483 | #define arch_irq_stat_cpu(cpu) 0 | ||
| 484 | #endif | ||
| 485 | #ifndef arch_irq_stat | ||
| 486 | #define arch_irq_stat() 0 | ||
| 487 | #endif | ||
| 488 | |||
| 475 | static int show_stat(struct seq_file *p, void *v) | 489 | static int show_stat(struct seq_file *p, void *v) |
| 476 | { | 490 | { |
| 477 | int i; | 491 | int i; |
| @@ -509,7 +523,9 @@ static int show_stat(struct seq_file *p, void *v) | |||
| 509 | sum += temp; | 523 | sum += temp; |
| 510 | per_irq_sum[j] += temp; | 524 | per_irq_sum[j] += temp; |
| 511 | } | 525 | } |
| 526 | sum += arch_irq_stat_cpu(i); | ||
| 512 | } | 527 | } |
| 528 | sum += arch_irq_stat(); | ||
| 513 | 529 | ||
| 514 | seq_printf(p, "cpu %llu %llu %llu %llu %llu %llu %llu %llu %llu\n", | 530 | seq_printf(p, "cpu %llu %llu %llu %llu %llu %llu %llu %llu %llu\n", |
| 515 | (unsigned long long)cputime64_to_clock_t(user), | 531 | (unsigned long long)cputime64_to_clock_t(user), |
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index c492449f3b45..164bd9f9ede3 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c | |||
| @@ -210,7 +210,7 @@ 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_attach(task)) | 213 | if (maps_protect && !ptrace_may_access(task, PTRACE_MODE_READ)) |
| 214 | return -EACCES; | 214 | return -EACCES; |
| 215 | 215 | ||
| 216 | if (file) { | 216 | if (file) { |
| @@ -646,7 +646,7 @@ static ssize_t pagemap_read(struct file *file, char __user *buf, | |||
| 646 | goto out; | 646 | goto out; |
| 647 | 647 | ||
| 648 | ret = -EACCES; | 648 | ret = -EACCES; |
| 649 | if (!ptrace_may_attach(task)) | 649 | if (!ptrace_may_access(task, PTRACE_MODE_READ)) |
| 650 | goto out_task; | 650 | goto out_task; |
| 651 | 651 | ||
| 652 | ret = -EINVAL; | 652 | ret = -EINVAL; |
| @@ -747,7 +747,7 @@ static int show_numa_map_checked(struct seq_file *m, void *v) | |||
| 747 | struct proc_maps_private *priv = m->private; | 747 | struct proc_maps_private *priv = m->private; |
| 748 | struct task_struct *task = priv->task; | 748 | struct task_struct *task = priv->task; |
| 749 | 749 | ||
| 750 | if (maps_protect && !ptrace_may_attach(task)) | 750 | if (maps_protect && !ptrace_may_access(task, PTRACE_MODE_READ)) |
| 751 | return -EACCES; | 751 | return -EACCES; |
| 752 | 752 | ||
| 753 | return show_numa_map(m, v); | 753 | return show_numa_map(m, v); |
diff --git a/fs/proc/task_nommu.c b/fs/proc/task_nommu.c index 4b4f9cc2f186..5d84e7121df8 100644 --- a/fs/proc/task_nommu.c +++ b/fs/proc/task_nommu.c | |||
| @@ -113,7 +113,7 @@ static int show_map(struct seq_file *m, void *_vml) | |||
| 113 | struct proc_maps_private *priv = m->private; | 113 | struct proc_maps_private *priv = m->private; |
| 114 | struct task_struct *task = priv->task; | 114 | struct task_struct *task = priv->task; |
| 115 | 115 | ||
| 116 | if (maps_protect && !ptrace_may_attach(task)) | 116 | if (maps_protect && !ptrace_may_access(task, PTRACE_MODE_READ)) |
| 117 | return -EACCES; | 117 | return -EACCES; |
| 118 | 118 | ||
| 119 | return nommu_vma_show(m, vml->vma); | 119 | return nommu_vma_show(m, vml->vma); |
