Commit 91bc6523 authored by Roland McGrath's avatar Roland McGrath Committed by Linus Torvalds

[PATCH] fix x86-64 ptrace access to 32-bit vsyscall page

When I made get_user_pages support looking up a pte for the "gate" area, I
assumed it would be part of the kernel's fixed mappings.  On x86-64 running
a 32-bit task, the 32-bit vsyscall DSO page still has no vma but has its
pte allocated in the user mm in the normal fashion.  This patch makes it
use the generic page-table lookup calls rather than the shortcuts.
With this, ptrace on x86-64 can access a 32-bit process's vsyscall page.

The behavior on x86 is unchanged.
Signed-off-by: default avatarRoland McGrath <roland@redhat.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent d35fd13a
......@@ -718,19 +718,24 @@ int get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
pte_t *pte;
if (write) /* user gate pages are read-only */
return i ? : -EFAULT;
pgd = pgd_offset_k(pg);
pgd = pgd_offset(mm, pg);
if (!pgd)
return i ? : -EFAULT;
pmd = pmd_offset(pgd, pg);
if (!pmd)
return i ? : -EFAULT;
pte = pte_offset_kernel(pmd, pg);
if (!pte || !pte_present(*pte))
pte = pte_offset_map(pmd, pg);
if (!pte)
return i ? : -EFAULT;
if (!pte_present(*pte)) {
pte_unmap(pte);
return i ? : -EFAULT;
}
if (pages) {
pages[i] = pte_page(*pte);
get_page(pages[i]);
}
pte_unmap(pte);
if (vmas)
vmas[i] = gate_vma;
i++;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment