diff options
Diffstat (limited to 'arch/x86/mm')
-rw-r--r-- | arch/x86/mm/fault.c | 18 | ||||
-rw-r--r-- | arch/x86/mm/init.c | 2 | ||||
-rw-r--r-- | arch/x86/mm/init_32.c | 2 |
3 files changed, 17 insertions, 5 deletions
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c index c6acc6326374..baa0e86adfbc 100644 --- a/arch/x86/mm/fault.c +++ b/arch/x86/mm/fault.c | |||
@@ -14,6 +14,7 @@ | |||
14 | 14 | ||
15 | #include <asm/traps.h> /* dotraplinkage, ... */ | 15 | #include <asm/traps.h> /* dotraplinkage, ... */ |
16 | #include <asm/pgalloc.h> /* pgd_*(), ... */ | 16 | #include <asm/pgalloc.h> /* pgd_*(), ... */ |
17 | #include <asm/kmemcheck.h> /* kmemcheck_*(), ... */ | ||
17 | 18 | ||
18 | /* | 19 | /* |
19 | * Page fault error code bits: | 20 | * Page fault error code bits: |
@@ -956,6 +957,13 @@ do_page_fault(struct pt_regs *regs, unsigned long error_code) | |||
956 | /* Get the faulting address: */ | 957 | /* Get the faulting address: */ |
957 | address = read_cr2(); | 958 | address = read_cr2(); |
958 | 959 | ||
960 | /* | ||
961 | * Detect and handle instructions that would cause a page fault for | ||
962 | * both a tracked kernel page and a userspace page. | ||
963 | */ | ||
964 | if (kmemcheck_active(regs)) | ||
965 | kmemcheck_hide(regs); | ||
966 | |||
959 | if (unlikely(kmmio_fault(regs, address))) | 967 | if (unlikely(kmmio_fault(regs, address))) |
960 | return; | 968 | return; |
961 | 969 | ||
@@ -973,9 +981,13 @@ do_page_fault(struct pt_regs *regs, unsigned long error_code) | |||
973 | * protection error (error_code & 9) == 0. | 981 | * protection error (error_code & 9) == 0. |
974 | */ | 982 | */ |
975 | if (unlikely(fault_in_kernel_space(address))) { | 983 | if (unlikely(fault_in_kernel_space(address))) { |
976 | if (!(error_code & (PF_RSVD|PF_USER|PF_PROT)) && | 984 | if (!(error_code & (PF_RSVD | PF_USER | PF_PROT))) { |
977 | vmalloc_fault(address) >= 0) | 985 | if (vmalloc_fault(address) >= 0) |
978 | return; | 986 | return; |
987 | |||
988 | if (kmemcheck_fault(regs, address, error_code)) | ||
989 | return; | ||
990 | } | ||
979 | 991 | ||
980 | /* Can handle a stale RO->RW TLB: */ | 992 | /* Can handle a stale RO->RW TLB: */ |
981 | if (spurious_fault(error_code, address)) | 993 | if (spurious_fault(error_code, address)) |
diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c index 34c1bfb64f1c..f53b57e4086f 100644 --- a/arch/x86/mm/init.c +++ b/arch/x86/mm/init.c | |||
@@ -213,7 +213,7 @@ unsigned long __init_refok init_memory_mapping(unsigned long start, | |||
213 | if (!after_bootmem) | 213 | if (!after_bootmem) |
214 | init_gbpages(); | 214 | init_gbpages(); |
215 | 215 | ||
216 | #ifdef CONFIG_DEBUG_PAGEALLOC | 216 | #if defined(CONFIG_DEBUG_PAGEALLOC) || defined(CONFIG_KMEMCHECK) |
217 | /* | 217 | /* |
218 | * For CONFIG_DEBUG_PAGEALLOC, identity mapping will use small pages. | 218 | * For CONFIG_DEBUG_PAGEALLOC, identity mapping will use small pages. |
219 | * This will simplify cpa(), which otherwise needs to support splitting | 219 | * This will simplify cpa(), which otherwise needs to support splitting |
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c index 949708d7a481..80cafd76a2bd 100644 --- a/arch/x86/mm/init_32.c +++ b/arch/x86/mm/init_32.c | |||
@@ -111,7 +111,7 @@ static pte_t * __init one_page_table_init(pmd_t *pmd) | |||
111 | pte_t *page_table = NULL; | 111 | pte_t *page_table = NULL; |
112 | 112 | ||
113 | if (after_bootmem) { | 113 | if (after_bootmem) { |
114 | #ifdef CONFIG_DEBUG_PAGEALLOC | 114 | #if defined(CONFIG_DEBUG_PAGEALLOC) || defined(CONFIG_KMEMCHECK) |
115 | page_table = (pte_t *) alloc_bootmem_pages(PAGE_SIZE); | 115 | page_table = (pte_t *) alloc_bootmem_pages(PAGE_SIZE); |
116 | #endif | 116 | #endif |
117 | if (!page_table) | 117 | if (!page_table) |