qubes-linux-kernel/patches.xen/xen-x86_64-dump-user-pgt
2010-07-07 13:12:45 +02:00

52 lines
1.5 KiB
Plaintext

From: jbeulich@novell.com
Subject: dump the correct page tables for user mode faults
Patch-mainline: obsolete
--- head-2010-03-15.orig/arch/x86/mm/fault-xen.c 2010-01-28 10:38:23.000000000 +0100
+++ head-2010-03-15/arch/x86/mm/fault-xen.c 2010-01-25 14:00:59.000000000 +0100
@@ -329,6 +329,7 @@ static void dump_pagetable(unsigned long
out:
printk(KERN_CONT "\n");
}
+#define dump_pagetable(addr, krnl) dump_pagetable(addr)
#else /* CONFIG_X86_64: */
@@ -453,7 +454,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);
@@ -461,6 +462,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;
@@ -599,7 +603,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
@@ -616,7 +620,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;