restrict reading from /proc/<pid>/maps to those who share ->mm or can ptrace pid
authorAl Viro <viro@ZenIV.linux.org.uk>
Wed, 2 Jan 2008 14:09:57 +0000 (14:09 +0000)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Wed, 2 Jan 2008 21:13:27 +0000 (13:13 -0800)
commit831830b5a2b5d413407adf380ef62fe17d6fcbf2
treeb08f54f15374b5b98b0b3bea20a1d2ea8d1f50e0
parentac40532ef0b8649e6f7f83859ea0de1c4ed08a19
restrict reading from /proc/<pid>/maps to those who share ->mm or can ptrace pid

Contents of /proc/*/maps is sensitive and may become sensitive after
open() (e.g.  if target originally shares our ->mm and later does exec
on suid-root binary).

Check at read() (actually, ->start() of iterator) time that mm_struct
we'd grabbed and locked is
 - still the ->mm of target
 - equal to reader's ->mm or the target is ptracable by reader.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Acked-by: Rik van Riel <riel@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/proc/base.c
fs/proc/internal.h
fs/proc/task_mmu.c
fs/proc/task_nommu.c
include/linux/ptrace.h
kernel/ptrace.c