aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/filesystems/proc.txt5
-rw-r--r--fs/proc/array.c16
-rw-r--r--fs/proc/base.c9
3 files changed, 20 insertions, 10 deletions
diff --git a/Documentation/filesystems/proc.txt b/Documentation/filesystems/proc.txt
index d411ca63c8b6..3a9d65c912e7 100644
--- a/Documentation/filesystems/proc.txt
+++ b/Documentation/filesystems/proc.txt
@@ -140,7 +140,8 @@ Table 1-1: Process specific entries in /proc
140 stat Process status 140 stat Process status
141 statm Process memory status information 141 statm Process memory status information
142 status Process status in human readable form 142 status Process status in human readable form
143 wchan If CONFIG_KALLSYMS is set, a pre-decoded wchan 143 wchan Present with CONFIG_KALLSYMS=y: it shows the kernel function
144 symbol the task is blocked in - or "0" if not blocked.
144 pagemap Page table 145 pagemap Page table
145 stack Report full stack trace, enable via CONFIG_STACKTRACE 146 stack Report full stack trace, enable via CONFIG_STACKTRACE
146 smaps a extension based on maps, showing the memory consumption of 147 smaps a extension based on maps, showing the memory consumption of
@@ -310,7 +311,7 @@ Table 1-4: Contents of the stat files (as of 2.6.30-rc7)
310 blocked bitmap of blocked signals 311 blocked bitmap of blocked signals
311 sigign bitmap of ignored signals 312 sigign bitmap of ignored signals
312 sigcatch bitmap of caught signals 313 sigcatch bitmap of caught signals
313 wchan address where process went to sleep 314 0 (place holder, used to be the wchan address, use /proc/PID/wchan instead)
314 0 (place holder) 315 0 (place holder)
315 0 (place holder) 316 0 (place holder)
316 exit_signal signal to send to parent thread on exit 317 exit_signal signal to send to parent thread on exit
diff --git a/fs/proc/array.c b/fs/proc/array.c
index f60f0121e331..eed2050db9be 100644
--- a/fs/proc/array.c
+++ b/fs/proc/array.c
@@ -375,7 +375,7 @@ int proc_pid_status(struct seq_file *m, struct pid_namespace *ns,
375static int do_task_stat(struct seq_file *m, struct pid_namespace *ns, 375static int do_task_stat(struct seq_file *m, struct pid_namespace *ns,
376 struct pid *pid, struct task_struct *task, int whole) 376 struct pid *pid, struct task_struct *task, int whole)
377{ 377{
378 unsigned long vsize, eip, esp, wchan = ~0UL; 378 unsigned long vsize, eip, esp, wchan = 0;
379 int priority, nice; 379 int priority, nice;
380 int tty_pgrp = -1, tty_nr = 0; 380 int tty_pgrp = -1, tty_nr = 0;
381 sigset_t sigign, sigcatch; 381 sigset_t sigign, sigcatch;
@@ -507,7 +507,19 @@ static int do_task_stat(struct seq_file *m, struct pid_namespace *ns,
507 seq_put_decimal_ull(m, ' ', task->blocked.sig[0] & 0x7fffffffUL); 507 seq_put_decimal_ull(m, ' ', task->blocked.sig[0] & 0x7fffffffUL);
508 seq_put_decimal_ull(m, ' ', sigign.sig[0] & 0x7fffffffUL); 508 seq_put_decimal_ull(m, ' ', sigign.sig[0] & 0x7fffffffUL);
509 seq_put_decimal_ull(m, ' ', sigcatch.sig[0] & 0x7fffffffUL); 509 seq_put_decimal_ull(m, ' ', sigcatch.sig[0] & 0x7fffffffUL);
510 seq_put_decimal_ull(m, ' ', wchan); 510
511 /*
512 * We used to output the absolute kernel address, but that's an
513 * information leak - so instead we show a 0/1 flag here, to signal
514 * to user-space whether there's a wchan field in /proc/PID/wchan.
515 *
516 * This works with older implementations of procps as well.
517 */
518 if (wchan)
519 seq_puts(m, " 1");
520 else
521 seq_puts(m, " 0");
522
511 seq_put_decimal_ull(m, ' ', 0); 523 seq_put_decimal_ull(m, ' ', 0);
512 seq_put_decimal_ull(m, ' ', 0); 524 seq_put_decimal_ull(m, ' ', 0);
513 seq_put_decimal_ll(m, ' ', task->exit_signal); 525 seq_put_decimal_ll(m, ' ', task->exit_signal);
diff --git a/fs/proc/base.c b/fs/proc/base.c
index b25eee4cead5..29595af32866 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -430,13 +430,10 @@ static int proc_pid_wchan(struct seq_file *m, struct pid_namespace *ns,
430 430
431 wchan = get_wchan(task); 431 wchan = get_wchan(task);
432 432
433 if (lookup_symbol_name(wchan, symname) < 0) { 433 if (wchan && ptrace_may_access(task, PTRACE_MODE_READ) && !lookup_symbol_name(wchan, symname))
434 if (!ptrace_may_access(task, PTRACE_MODE_READ))
435 return 0;
436 seq_printf(m, "%lu", wchan);
437 } else {
438 seq_printf(m, "%s", symname); 434 seq_printf(m, "%s", symname);
439 } 435 else
436 seq_putc(m, '0');
440 437
441 return 0; 438 return 0;
442} 439}