linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] proc/wchan: Use printk format instead of lookup_symbol_name()
@ 2020-12-17 16:54 Helge Deller
  2020-12-23  2:18 ` Andrew Morton
  2021-01-03 14:27 ` [proc/wchan] 30a3a19273: leaking-addresses.proc.wchan./proc/bus/input/devices:B:KEY=1000000000007ff980000000007fffebeffdfffeffffffffffffffffffffe kernel test robot
  0 siblings, 2 replies; 8+ messages in thread
From: Helge Deller @ 2020-12-17 16:54 UTC (permalink / raw)
  To: Alexey Dobriyan, Andrew Morton, linux-kernel, linux-fsdevel

To resolve the symbol fuction name for wchan, use the printk format
specifier %ps instead of manually looking up the symbol function name
via lookup_symbol_name().

Signed-off-by: Helge Deller <deller@gmx.de>

diff --git a/fs/proc/base.c b/fs/proc/base.c
index b362523a9829..c4593e1cafa4 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -67,7 +67,6 @@
 #include <linux/mm.h>
 #include <linux/swap.h>
 #include <linux/rcupdate.h>
-#include <linux/kallsyms.h>
 #include <linux/stacktrace.h>
 #include <linux/resource.h>
 #include <linux/module.h>
@@ -386,19 +385,17 @@ static int proc_pid_wchan(struct seq_file *m, struct pid_namespace *ns,
 			  struct pid *pid, struct task_struct *task)
 {
 	unsigned long wchan;
-	char symname[KSYM_NAME_LEN];

-	if (!ptrace_may_access(task, PTRACE_MODE_READ_FSCREDS))
-		goto print0;
+	if (ptrace_may_access(task, PTRACE_MODE_READ_FSCREDS))
+		wchan = get_wchan(task);
+	else
+		wchan = 0;

-	wchan = get_wchan(task);
-	if (wchan && !lookup_symbol_name(wchan, symname)) {
-		seq_puts(m, symname);
-		return 0;
-	}
+	if (wchan)
+		seq_printf(m, "%ps", (void *) wchan);
+	else
+		seq_putc(m, '0');

-print0:
-	seq_putc(m, '0');
 	return 0;
 }
 #endif /* CONFIG_KALLSYMS */

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-09-24  1:01 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-17 16:54 [PATCH] proc/wchan: Use printk format instead of lookup_symbol_name() Helge Deller
2020-12-23  2:18 ` Andrew Morton
2020-12-23  9:48   ` Helge Deller
2020-12-23 20:29     ` Andrew Morton
2021-01-03 14:27 ` [proc/wchan] 30a3a19273: leaking-addresses.proc.wchan./proc/bus/input/devices:B:KEY=1000000000007ff980000000007fffebeffdfffeffffffffffffffffffffe kernel test robot
2021-01-03 18:25   ` Helge Deller
2021-01-04 13:27     ` Oliver Sang
2021-09-24  1:01     ` /proc/$pid/chan kernel address exposures (was Re: [proc/wchan] 30a3a19273: leaking-addresses.proc.wchan./proc/bus/input/devices:B:KEY=1000000000007ff980000000007fffebeffdfffeffffffffffffffffffffe) Kees Cook

This is a public inbox, see mirroring instructions
on how to clone and mirror all data and code used for this inbox