提交 24b2ec21 编写于 作者: A Alexey Dobriyan 提交者: Linus Torvalds

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

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

Link: http://lkml.kernel.org/r/20180217071923.GA16074@avx2Signed-off-by: NAlexey Dobriyan <adobriyan@gmail.com>
Reviewed-by: NAndrew Morton <akpm@linux-foundation.org>
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 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);
else
seq_putc(m, '0');
return 0;
}
print0:
seq_putc(m, '0');
return 0;
}
#endif /* CONFIG_KALLSYMS */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册