diff options
author | Jake Edge <jake@lwn.net> | 2009-05-04 14:51:14 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-05-04 18:14:23 -0400 |
commit | f83ce3e6b02d5e48b3a43b001390e2b58820389d (patch) | |
tree | 71c57abf4f9d259f5bfa22deaf724db85738f862 /fs/proc/base.c | |
parent | 7fdf523067666b0eaff330f362401ee50ce187c4 (diff) |
proc: avoid information leaks to non-privileged processes
By using the same test as is used for /proc/pid/maps and /proc/pid/smaps,
only allow processes that can ptrace() a given process to see information
that might be used to bypass address space layout randomization (ASLR).
These include eip, esp, wchan, and start_stack in /proc/pid/stat as well
as the non-symbolic output from /proc/pid/wchan.
ASLR can be bypassed by sampling eip as shown by the proof-of-concept
code at http://code.google.com/p/fuzzyaslr/ As part of a presentation
(http://www.cr0.org/paper/to-jt-linux-alsr-leak.pdf) esp and wchan were
also noted as possibly usable information leaks as well. The
start_stack address also leaks potentially useful information.
Cc: Stable Team <stable@kernel.org>
Signed-off-by: Jake Edge <jake@lwn.net>
Acked-by: Arjan van de Ven <arjan@linux.intel.com>
Acked-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/proc/base.c')
-rw-r--r-- | fs/proc/base.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c index aa763ab00777..fb45615943c2 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
@@ -322,7 +322,10 @@ static int proc_pid_wchan(struct task_struct *task, char *buffer) | |||
322 | wchan = get_wchan(task); | 322 | wchan = get_wchan(task); |
323 | 323 | ||
324 | if (lookup_symbol_name(wchan, symname) < 0) | 324 | if (lookup_symbol_name(wchan, symname) < 0) |
325 | return sprintf(buffer, "%lu", wchan); | 325 | if (!ptrace_may_access(task, PTRACE_MODE_READ)) |
326 | return 0; | ||
327 | else | ||
328 | return sprintf(buffer, "%lu", wchan); | ||
326 | else | 329 | else |
327 | return sprintf(buffer, "%s", symname); | 330 | return sprintf(buffer, "%s", symname); |
328 | } | 331 | } |