Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

proc/wchan: use printk format instead of lookup_symbol_name()

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().

Link: https://lkml.kernel.org/r/20201217165413.GA1959@ls3530.fritz.box
Signed-off-by: Helge Deller <deller@gmx.de>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Helge Deller and committed by
Linus Torvalds
152c432b 2956f4e4

+8 -11
+8 -11
fs/proc/base.c
··· 67 67 #include <linux/mm.h> 68 68 #include <linux/swap.h> 69 69 #include <linux/rcupdate.h> 70 - #include <linux/kallsyms.h> 71 70 #include <linux/stacktrace.h> 72 71 #include <linux/resource.h> 73 72 #include <linux/module.h> ··· 385 386 struct pid *pid, struct task_struct *task) 386 387 { 387 388 unsigned long wchan; 388 - char symname[KSYM_NAME_LEN]; 389 389 390 - if (!ptrace_may_access(task, PTRACE_MODE_READ_FSCREDS)) 391 - goto print0; 390 + if (ptrace_may_access(task, PTRACE_MODE_READ_FSCREDS)) 391 + wchan = get_wchan(task); 392 + else 393 + wchan = 0; 392 394 393 - wchan = get_wchan(task); 394 - if (wchan && !lookup_symbol_name(wchan, symname)) { 395 - seq_puts(m, symname); 396 - return 0; 397 - } 395 + if (wchan) 396 + seq_printf(m, "%ps", (void *) wchan); 397 + else 398 + seq_putc(m, '0'); 398 399 399 - print0: 400 - seq_putc(m, '0'); 401 400 return 0; 402 401 } 403 402 #endif /* CONFIG_KALLSYMS */