52 lines
1.5 KiB
Plaintext
52 lines
1.5 KiB
Plaintext
From: jbeulich@novell.com
|
|
Subject: dump the correct page tables for user mode faults
|
|
Patch-mainline: obsolete
|
|
|
|
--- 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
|
|
out:
|
|
printk(KERN_CONT "\n");
|
|
}
|
|
+#define dump_pagetable(addr, krnl) dump_pagetable(addr)
|
|
|
|
#else /* CONFIG_X86_64: */
|
|
|
|
@@ -449,7 +450,7 @@ static int bad_address(void *p)
|
|
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);
|
|
@@ -457,6 +458,9 @@ static void dump_pagetable(unsigned long
|
|
pmd_t *pmd;
|
|
pte_t *pte;
|
|
|
|
+ if (!kernel)
|
|
+ pgd = __user_pgd(base) + pgd_index(address);
|
|
+
|
|
if (bad_address(pgd))
|
|
goto bad;
|
|
|
|
@@ -595,7 +599,7 @@ show_fault_oops(struct pt_regs *regs, un
|
|
printk(KERN_ALERT "IP:");
|
|
printk_address(regs->ip, 1);
|
|
|
|
- dump_pagetable(address);
|
|
+ dump_pagetable(address, !(error_code & PF_USER));
|
|
}
|
|
|
|
static noinline void
|
|
@@ -612,7 +616,7 @@ pgtable_bad(struct pt_regs *regs, unsign
|
|
|
|
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;
|