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>
This commit is contained in:
@@ -397,12 +397,11 @@ static void *m_start(struct seq_file *m, loff_t *pos)
|
||||
if (!priv->task)
|
||||
return NULL;
|
||||
|
||||
mm = get_task_mm(priv->task);
|
||||
mm = mm_for_maps(priv->task);
|
||||
if (!mm)
|
||||
return NULL;
|
||||
|
||||
priv->tail_vma = tail_vma = get_gate_vma(priv->task);
|
||||
down_read(&mm->mmap_sem);
|
||||
|
||||
/* Start with last addr hint */
|
||||
if (last_addr && (vma = find_vma(mm, last_addr))) {
|
||||
|
Reference in New Issue
Block a user