Re: [PATCH] include/asm-x86_64/pgtable.h pgd_offset_gate()

From: John Blackwood
Date: Tue Dec 14 2004 - 10:01:31 EST


Please ignore my previous posting.

It turns out that there is already a fix for this problem by Andi Kleen:

# ChangeSet
# 2004/11/15 19:53:40-08:00 ak@xxxxxxx
# [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@xxxxxxx>
# Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
# Signed-off-by: Linus Torvalds <torvalds@xxxxxxxx>
#
# mm/memory.c
# 2004/11/15 19:29:06-08:00 ak@xxxxxxx +7 -11
# x86-64: Fix get_user_pages access to vsyscall page
#
diff -Nru a/mm/memory.c b/mm/memory.c
--- a/mm/memory.c 2004-12-14 05:20:10 -08:00
+++ b/mm/memory.c 2004-12-14 05:20:10 -08:00
@@ -739,19 +739,15 @@
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]);

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/