* [PATCH]x86: make spurious_fault check correct pte bit
@ 2010-07-27 8:06 Shaohua Li
2010-08-26 23:13 ` [tip:x86/mm] x86, mm: Make spurious_fault check explicitly check the PRESENT bit tip-bot for Shaohua Li
0 siblings, 1 reply; 2+ messages in thread
From: Shaohua Li @ 2010-07-27 8:06 UTC (permalink / raw)
To: lkml; +Cc: Ingo Molnar, Andrew Morton, H. Peter Anvin, Huang, Ying
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.
Signed-off-by: Shaohua Li <shaohua.li@intel.com>
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
index f627779..93afd78 100644
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
@@ -893,7 +893,7 @@ spurious_fault(unsigned long error_code, unsigned long address)
return spurious_fault_check(error_code, (pte_t *) pmd);
pte = pte_offset_kernel(pmd, address);
- if (!pte_present(*pte))
+ if (!(pte_flags(*pte) & _PAGE_PRESENT))
return 0;
ret = spurious_fault_check(error_code, pte);
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [tip:x86/mm] x86, mm: Make spurious_fault check explicitly check the PRESENT bit
2010-07-27 8:06 [PATCH]x86: make spurious_fault check correct pte bit Shaohua Li
@ 2010-08-26 23:13 ` tip-bot for Shaohua Li
0 siblings, 0 replies; 2+ messages in thread
From: tip-bot for Shaohua Li @ 2010-08-26 23:13 UTC (permalink / raw)
To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, shaohua.li, tglx, hpa
Commit-ID: 660a293ea9be709b893d371fbc0328fcca33c33a
Gitweb: http://git.kernel.org/tip/660a293ea9be709b893d371fbc0328fcca33c33a
Author: Shaohua Li <shaohua.li@intel.com>
AuthorDate: Tue, 27 Jul 2010 16:06:28 +0800
Committer: H. Peter Anvin <hpa@linux.intel.com>
CommitDate: Thu, 26 Aug 2010 16:00:21 -0700
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>
---
arch/x86/mm/fault.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
index 51f7ee7..caec229 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)
if (pmd_large(*pmd))
return spurious_fault_check(error_code, (pte_t *) pmd);
+ /*
+ * Note: don't use pte_present() here, since it returns true
+ * if the _PAGE_PROTNONE bit is set. However, this aliases the
+ * _PAGE_GLOBAL bit, which for kernel pages give false positives
+ * when CONFIG_DEBUG_PAGEALLOC is used.
+ */
pte = pte_offset_kernel(pmd, address);
- if (!pte_present(*pte))
+ if (!(pte_flags(*pte) & _PAGE_PRESENT))
return 0;
ret = spurious_fault_check(error_code, pte);
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-08-26 23:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-27 8:06 [PATCH]x86: make spurious_fault check correct pte bit Shaohua Li
2010-08-26 23:13 ` [tip:x86/mm] x86, mm: Make spurious_fault check explicitly check the PRESENT bit tip-bot for Shaohua Li
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.