diff options
Diffstat (limited to 'fs/proc')
-rw-r--r-- | fs/proc/array.c | 13 | ||||
-rw-r--r-- | fs/proc/base.c | 5 | ||||
-rw-r--r-- | fs/proc/root.c | 3 |
3 files changed, 14 insertions, 7 deletions
diff --git a/fs/proc/array.c b/fs/proc/array.c index 7e4877d9dcb5..725a650bbbb8 100644 --- a/fs/proc/array.c +++ b/fs/proc/array.c | |||
@@ -80,6 +80,7 @@ | |||
80 | #include <linux/delayacct.h> | 80 | #include <linux/delayacct.h> |
81 | #include <linux/seq_file.h> | 81 | #include <linux/seq_file.h> |
82 | #include <linux/pid_namespace.h> | 82 | #include <linux/pid_namespace.h> |
83 | #include <linux/ptrace.h> | ||
83 | #include <linux/tracehook.h> | 84 | #include <linux/tracehook.h> |
84 | 85 | ||
85 | #include <asm/pgtable.h> | 86 | #include <asm/pgtable.h> |
@@ -352,6 +353,7 @@ static int do_task_stat(struct seq_file *m, struct pid_namespace *ns, | |||
352 | char state; | 353 | char state; |
353 | pid_t ppid = 0, pgid = -1, sid = -1; | 354 | pid_t ppid = 0, pgid = -1, sid = -1; |
354 | int num_threads = 0; | 355 | int num_threads = 0; |
356 | int permitted; | ||
355 | struct mm_struct *mm; | 357 | struct mm_struct *mm; |
356 | unsigned long long start_time; | 358 | unsigned long long start_time; |
357 | unsigned long cmin_flt = 0, cmaj_flt = 0; | 359 | unsigned long cmin_flt = 0, cmaj_flt = 0; |
@@ -364,11 +366,14 @@ static int do_task_stat(struct seq_file *m, struct pid_namespace *ns, | |||
364 | 366 | ||
365 | state = *get_task_state(task); | 367 | state = *get_task_state(task); |
366 | vsize = eip = esp = 0; | 368 | vsize = eip = esp = 0; |
369 | permitted = ptrace_may_access(task, PTRACE_MODE_READ); | ||
367 | mm = get_task_mm(task); | 370 | mm = get_task_mm(task); |
368 | if (mm) { | 371 | if (mm) { |
369 | vsize = task_vsize(mm); | 372 | vsize = task_vsize(mm); |
370 | eip = KSTK_EIP(task); | 373 | if (permitted) { |
371 | esp = KSTK_ESP(task); | 374 | eip = KSTK_EIP(task); |
375 | esp = KSTK_ESP(task); | ||
376 | } | ||
372 | } | 377 | } |
373 | 378 | ||
374 | get_task_comm(tcomm, task); | 379 | get_task_comm(tcomm, task); |
@@ -424,7 +429,7 @@ static int do_task_stat(struct seq_file *m, struct pid_namespace *ns, | |||
424 | unlock_task_sighand(task, &flags); | 429 | unlock_task_sighand(task, &flags); |
425 | } | 430 | } |
426 | 431 | ||
427 | if (!whole || num_threads < 2) | 432 | if (permitted && (!whole || num_threads < 2)) |
428 | wchan = get_wchan(task); | 433 | wchan = get_wchan(task); |
429 | if (!whole) { | 434 | if (!whole) { |
430 | min_flt = task->min_flt; | 435 | min_flt = task->min_flt; |
@@ -476,7 +481,7 @@ static int do_task_stat(struct seq_file *m, struct pid_namespace *ns, | |||
476 | rsslim, | 481 | rsslim, |
477 | mm ? mm->start_code : 0, | 482 | mm ? mm->start_code : 0, |
478 | mm ? mm->end_code : 0, | 483 | mm ? mm->end_code : 0, |
479 | mm ? mm->start_stack : 0, | 484 | (permitted && mm) ? mm->start_stack : 0, |
480 | esp, | 485 | esp, |
481 | eip, | 486 | eip, |
482 | /* The signal information here is obsolete. | 487 | /* The signal information here is obsolete. |
diff --git a/fs/proc/base.c b/fs/proc/base.c index aa763ab00777..fb45615943c2 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
@@ -322,7 +322,10 @@ static int proc_pid_wchan(struct task_struct *task, char *buffer) | |||
322 | wchan = get_wchan(task); | 322 | wchan = get_wchan(task); |
323 | 323 | ||
324 | if (lookup_symbol_name(wchan, symname) < 0) | 324 | if (lookup_symbol_name(wchan, symname) < 0) |
325 | return sprintf(buffer, "%lu", wchan); | 325 | if (!ptrace_may_access(task, PTRACE_MODE_READ)) |
326 | return 0; | ||
327 | else | ||
328 | return sprintf(buffer, "%lu", wchan); | ||
326 | else | 329 | else |
327 | return sprintf(buffer, "%s", symname); | 330 | return sprintf(buffer, "%s", symname); |
328 | } | 331 | } |
diff --git a/fs/proc/root.c b/fs/proc/root.c index 1e15a2b176e8..b080b791d9e3 100644 --- a/fs/proc/root.c +++ b/fs/proc/root.c | |||
@@ -67,8 +67,7 @@ static int proc_get_sb(struct file_system_type *fs_type, | |||
67 | sb->s_flags = flags; | 67 | sb->s_flags = flags; |
68 | err = proc_fill_super(sb); | 68 | err = proc_fill_super(sb); |
69 | if (err) { | 69 | if (err) { |
70 | up_write(&sb->s_umount); | 70 | deactivate_locked_super(sb); |
71 | deactivate_super(sb); | ||
72 | return err; | 71 | return err; |
73 | } | 72 | } |
74 | 73 | ||