]>
Commit | Line | Data |
---|---|---|
2cb7cef9 BS |
1 | From: jbeulich@novell.com |
2 | Subject: dump the correct page tables for user mode faults | |
3 | Patch-mainline: obsolete | |
4 | ||
5 | Index: head-2008-11-10/arch/x86/mm/fault-xen.c | |
6 | =================================================================== | |
7 | --- head-2008-11-10.orig/arch/x86/mm/fault-xen.c 2008-11-17 11:33:51.000000000 +0100 | |
8 | +++ head-2008-11-10/arch/x86/mm/fault-xen.c 2008-11-17 11:38:21.000000000 +0100 | |
9 | @@ -189,9 +189,11 @@ static int bad_address(void *p) | |
10 | unsigned long dummy; | |
11 | return probe_kernel_address((unsigned long *)p, dummy); | |
12 | } | |
13 | +#else | |
14 | +#define dump_pagetable(addr, krnl) dump_pagetable(addr) | |
15 | #endif | |
16 | ||
17 | -static void dump_pagetable(unsigned long address) | |
18 | +static void dump_pagetable(unsigned long address, bool kernel) | |
19 | { | |
20 | #ifdef CONFIG_X86_32 | |
21 | __typeof__(pte_val(__pte(0))) page; | |
22 | @@ -239,6 +241,8 @@ static void dump_pagetable(unsigned long | |
23 | pgd = (pgd_t *)read_cr3(); | |
24 | ||
25 | pgd = __va((unsigned long)pgd & PHYSICAL_PAGE_MASK); | |
26 | + if (!kernel) | |
27 | + pgd = __user_pgd(pgd); | |
28 | pgd += pgd_index(address); | |
29 | if (bad_address(pgd)) goto bad; | |
30 | printk("PGD %lx ", pgd_val(*pgd)); | |
31 | @@ -419,7 +423,7 @@ static void show_fault_oops(struct pt_re | |
32 | printk(KERN_CONT " at %p\n", (void *) address); | |
33 | printk(KERN_ALERT "IP:"); | |
34 | printk_address(regs->ip, 1); | |
35 | - dump_pagetable(address); | |
36 | + dump_pagetable(address, !(error_code & PF_USER)); | |
37 | } | |
38 | ||
39 | #ifdef CONFIG_X86_64 | |
40 | @@ -431,7 +435,7 @@ static noinline void pgtable_bad(unsigne | |
41 | ||
42 | printk(KERN_ALERT "%s: Corrupted page table at address %lx\n", | |
43 | current->comm, address); | |
44 | - dump_pagetable(address); | |
45 | + dump_pagetable(address, !(error_code & PF_USER)); | |
46 | tsk = current; | |
47 | tsk->thread.cr2 = address; | |
48 | tsk->thread.trap_no = 14; |