aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/mm
diff options
context:
space:
mode:
authorShaohua Li <shaohua.li@intel.com>2010-07-27 04:06:28 -0400
committerH. Peter Anvin <hpa@linux.intel.com>2010-08-26 19:00:21 -0400
commit660a293ea9be709b893d371fbc0328fcca33c33a (patch)
tree4ef65b2eebb30e4d61ca685b23bac0678a24852f /arch/x86/mm
parent9b861528a8012e7bc4d1f7bae07395b225331477 (diff)
x86, mm: Make spurious_fault check explicitly check the PRESENT bit
pte_present() returns true even present bit isn't set but _PAGE_PROTNONE (global bit) bit is set. While with CONFIG_DEBUG_PAGEALLOC, free pages have global bit set but present bit clear. This patch makes we could catch free pages access with CONFIG_DEBUG_PAGEALLOC enabled. [ hpa: added a comment in the code as a warning to janitors ] Signed-off-by: Shaohua Li <shaohua.li@intel.com> LKML-Reference: <1280217988.32400.75.camel@sli10-desk.sh.intel.com> Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'arch/x86/mm')
-rw-r--r--arch/x86/mm/fault.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
index 51f7ee71d6c7..caec22906d7c 100644
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
@@ -872,8 +872,14 @@ spurious_fault(unsigned long error_code, unsigned long address)
872 if (pmd_large(*pmd)) 872 if (pmd_large(*pmd))
873 return spurious_fault_check(error_code, (pte_t *) pmd); 873 return spurious_fault_check(error_code, (pte_t *) pmd);
874 874
875 /*
876 * Note: don't use pte_present() here, since it returns true
877 * if the _PAGE_PROTNONE bit is set. However, this aliases the
878 * _PAGE_GLOBAL bit, which for kernel pages give false positives
879 * when CONFIG_DEBUG_PAGEALLOC is used.
880 */
875 pte = pte_offset_kernel(pmd, address); 881 pte = pte_offset_kernel(pmd, address);
876 if (!pte_present(*pte)) 882 if (!(pte_flags(*pte) & _PAGE_PRESENT))
877 return 0; 883 return 0;
878 884
879 ret = spurious_fault_check(error_code, pte); 885 ret = spurious_fault_check(error_code, pte);