Commit 24b2ec21 authored by Alexey Dobriyan's avatar Alexey Dobriyan Committed by Linus Torvalds
Browse files

proc: check permissions earlier for /proc/*/wchan

get_wchan() accesses stack page before permissions are checked, let's
not play this game.


Signed-off-by: default avatarAlexey Dobriyan <>
Reviewed-by: default avatarAndrew Morton <>
Cc: Andy Shevchenko <>
Cc: Rasmus Villemoes <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent d0f02231
......@@ -388,14 +388,17 @@ static int proc_pid_wchan(struct seq_file *m, struct pid_namespace *ns,
unsigned long wchan;
char symname[KSYM_NAME_LEN];
wchan = get_wchan(task);
if (!ptrace_may_access(task, PTRACE_MODE_READ_FSCREDS))
goto print0;
if (wchan && ptrace_may_access(task, PTRACE_MODE_READ_FSCREDS)
&& !lookup_symbol_name(wchan, symname))
wchan = get_wchan(task);
if (wchan && !lookup_symbol_name(wchan, symname)) {
seq_printf(m, "%s", symname);
seq_putc(m, '0');
return 0;
seq_putc(m, '0');
return 0;
#endif /* CONFIG_KALLSYMS */
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment