2010-07-07 11:12:45 +00:00
|
|
|
From: jbeulich@novell.com
|
|
|
|
Subject: dump the correct page tables for user mode faults
|
|
|
|
Patch-mainline: obsolete
|
|
|
|
|
2011-04-19 20:09:59 +00:00
|
|
|
--- head-2011-03-17.orig/arch/x86/mm/fault-xen.c 2011-03-17 14:22:21.000000000 +0100
|
|
|
|
+++ head-2011-03-17/arch/x86/mm/fault-xen.c 2011-03-17 14:35:18.000000000 +0100
|
|
|
|
@@ -345,6 +345,7 @@ static void dump_pagetable(unsigned long
|
2010-07-07 11:12:45 +00:00
|
|
|
out:
|
|
|
|
printk(KERN_CONT "\n");
|
|
|
|
}
|
|
|
|
+#define dump_pagetable(addr, krnl) dump_pagetable(addr)
|
|
|
|
|
|
|
|
#else /* CONFIG_X86_64: */
|
|
|
|
|
2011-04-19 20:09:59 +00:00
|
|
|
@@ -449,7 +450,7 @@ static int bad_address(void *p)
|
2010-07-07 11:12:45 +00:00
|
|
|
return probe_kernel_address((unsigned long *)p, dummy);
|
|
|
|
}
|
|
|
|
|
|
|
|
-static void dump_pagetable(unsigned long address)
|
|
|
|
+static void dump_pagetable(unsigned long address, bool kernel)
|
|
|
|
{
|
|
|
|
pgd_t *base = __va(read_cr3() & PHYSICAL_PAGE_MASK);
|
|
|
|
pgd_t *pgd = base + pgd_index(address);
|
2011-04-19 20:09:59 +00:00
|
|
|
@@ -457,6 +458,9 @@ static void dump_pagetable(unsigned long
|
2010-07-07 11:12:45 +00:00
|
|
|
pmd_t *pmd;
|
|
|
|
pte_t *pte;
|
|
|
|
|
|
|
|
+ if (!kernel)
|
|
|
|
+ pgd = __user_pgd(base) + pgd_index(address);
|
|
|
|
+
|
|
|
|
if (bad_address(pgd))
|
|
|
|
goto bad;
|
|
|
|
|
2011-04-19 20:09:59 +00:00
|
|
|
@@ -595,7 +599,7 @@ show_fault_oops(struct pt_regs *regs, un
|
2010-07-07 11:12:45 +00:00
|
|
|
printk(KERN_ALERT "IP:");
|
|
|
|
printk_address(regs->ip, 1);
|
|
|
|
|
|
|
|
- dump_pagetable(address);
|
|
|
|
+ dump_pagetable(address, !(error_code & PF_USER));
|
|
|
|
}
|
|
|
|
|
|
|
|
static noinline void
|
2011-04-19 20:09:59 +00:00
|
|
|
@@ -612,7 +616,7 @@ pgtable_bad(struct pt_regs *regs, unsign
|
2010-07-07 11:12:45 +00:00
|
|
|
|
|
|
|
printk(KERN_ALERT "%s: Corrupted page table at address %lx\n",
|
|
|
|
tsk->comm, address);
|
|
|
|
- dump_pagetable(address);
|
|
|
|
+ dump_pagetable(address, !(error_code & PF_USER));
|
|
|
|
|
|
|
|
tsk->thread.cr2 = address;
|
|
|
|
tsk->thread.trap_no = 14;
|