From 3fee55543b1473685a438826e6faec8feb93d97a Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Wed, 6 Feb 2008 22:39:43 +0100 Subject: [PATCH] --- yaml --- r: 83693 b: refs/heads/master c: d8b57bb700a73872fd06b891d7c9bc4cea1a6af4 h: refs/heads/master i: 83691: 0522f4da73db045edb0654de11cb3c11cc709bbd v: v3 --- [refs] | 2 +- trunk/arch/x86/mm/fault.c | 23 +++++++++++++++++------ 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/[refs] b/[refs] index 837002f5a36c..1f4f0cf074f8 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 3aa4b37d3e899cfe7a9cbdcda2b277df4c1f210d +refs/heads/master: d8b57bb700a73872fd06b891d7c9bc4cea1a6af4 diff --git a/trunk/arch/x86/mm/fault.c b/trunk/arch/x86/mm/fault.c index ad8b9733d6b3..d8ed4006b3d2 100644 --- a/trunk/arch/x86/mm/fault.c +++ b/trunk/arch/x86/mm/fault.c @@ -428,6 +428,16 @@ static noinline void pgtable_bad(unsigned long address, struct pt_regs *regs, } #endif +static int spurious_fault_check(unsigned long error_code, pte_t *pte) +{ + if ((error_code & PF_WRITE) && !pte_write(*pte)) + return 0; + if ((error_code & PF_INSTR) && !pte_exec(*pte)) + return 0; + + return 1; +} + /* * Handle a spurious fault caused by a stale TLB entry. This allows * us to lazily refresh the TLB when increasing the permissions of a @@ -457,20 +467,21 @@ static int spurious_fault(unsigned long address, if (!pud_present(*pud)) return 0; + if (pud_large(*pud)) + return spurious_fault_check(error_code, (pte_t *) pud); + pmd = pmd_offset(pud, address); if (!pmd_present(*pmd)) return 0; + if (pmd_large(*pmd)) + return spurious_fault_check(error_code, (pte_t *) pmd); + pte = pte_offset_kernel(pmd, address); if (!pte_present(*pte)) return 0; - if ((error_code & PF_WRITE) && !pte_write(*pte)) - return 0; - if ((error_code & PF_INSTR) && !pte_exec(*pte)) - return 0; - - return 1; + return spurious_fault_check(error_code, pte); } /*