Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 83693
b: refs/heads/master
c: d8b57bb
h: refs/heads/master
i:
  83691: 0522f4d
v: v3
  • Loading branch information
Thomas Gleixner authored and Ingo Molnar committed Feb 6, 2008
1 parent 41bbc1b commit 3fee555
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3aa4b37d3e899cfe7a9cbdcda2b277df4c1f210d
refs/heads/master: d8b57bb700a73872fd06b891d7c9bc4cea1a6af4
23 changes: 17 additions & 6 deletions trunk/arch/x86/mm/fault.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
}

/*
Expand Down

0 comments on commit 3fee555

Please sign in to comment.