Re: [PATCH] proc: avoid leaking eip, esp, or wchan to non-privileged processes (fwd)

Eric W. Biederman
2009-05-04T06:09:42Z

James Morris <jmorris@namei.org> writes:

> diff --git a/fs/proc/base.c b/fs/proc/base.c
> index aa763ab..cd3c0d7 100644
> --- a/fs/proc/base.c
> +++ b/fs/proc/base.c
> @@ -319,6 +319,9 @@ static int proc_pid_wchan(struct task_struct *task, char
> *buffer)
> unsigned long wchan;
> char symname[KSYM_NAME_LEN];
>
> + if (!ptrace_may_access(task, PTRACE_MODE_READ))
> + return 0;
> +
> wchan = get_wchan(task);
>
> if (lookup_symbol_name(wchan, symname) < 0)

If the symbol is in the kernel it should be safe to return it's
name, all that is an information leak of a different sort.
Overall I expect we should return -EPERM here and not simply
an empty file.

Have you tested these patches against ps top and similar common
tools?

Eric