aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorAndi Kleen <ak@suse.de>2004-11-15 03:53:40 -0800
committerLinus Torvalds <torvalds@ppc970.osdl.org>2004-11-15 03:53:40 -0800
commitce57094bd9472a2752d471c8dc7aadb5cbdf11e8 (patch)
tree53440dedaa722c55a108b22e37a8db648c97ecbc /mm
parent46ce6729f516eac3295f94dee0a18862a7e5db64 (diff)
downloadhistory-ce57094bd9472a2752d471c8dc7aadb5cbdf11e8.tar.gz
[PATCH] x86-64: Fix get_user_pages access to vsyscall page
The current kernel oopses on x86-64 when gdb steps into the vsyscall page. This patch fixes it. I also removed the bogus NULL checks of *_offset and replaced them with proper _none checks. I made them BUGs because vsyscall pages should be always mapped. Signed-off-by: Andi Kleen <ak@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/memory.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/mm/memory.c b/mm/memory.c
index 2f2ba8b1b03278..2c2ff72c118ef5 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -739,19 +739,15 @@ 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_gate(mm, pg);
- if (!pgd)
- return i ? : -EFAULT;
+ if (pg > TASK_SIZE)
+ pgd = pgd_offset_k(pg);
+ else
+ pgd = pgd_offset_gate(mm, pg);
+ BUG_ON(pgd_none(*pgd));
pmd = pmd_offset(pgd, pg);
- if (!pmd)
- return i ? : -EFAULT;
+ BUG_ON(pmd_none(*pmd));
pte = pte_offset_map(pmd, pg);
- if (!pte)
- return i ? : -EFAULT;
- if (!pte_present(*pte)) {
- pte_unmap(pte);
- return i ? : -EFAULT;
- }
+ BUG_ON(pte_none(*pte));
if (pages) {
pages[i] = pte_page(*pte);
get_page(pages[i]);