summaryrefslogtreecommitdiffstats
path: root/arch/x86/mm
diff options
context:
space:
mode:
authorMatt Fleming <matt.fleming@intel.com>2014-03-05 17:22:57 +0000
committerMatt Fleming <matt.fleming@intel.com>2014-03-05 17:31:41 +0000
commit4fd69331ad227a4d8de26592d017b73e00caca9f (patch)
treebfd95ed518ff0cb44318715432d321a92a7b9a0c /arch/x86/mm
parent69e608411473ac56358ef35277563982d0565381 (diff)
parent0ac09f9f8cd1fb028a48330edba6023d347d3cea (diff)
downloadop-kernel-dev-4fd69331ad227a4d8de26592d017b73e00caca9f.zip
op-kernel-dev-4fd69331ad227a4d8de26592d017b73e00caca9f.tar.gz
Merge remote-tracking branch 'tip/x86/urgent' into efi-for-mingo
Conflicts: arch/x86/include/asm/efi.h
Diffstat (limited to 'arch/x86/mm')
-rw-r--r--arch/x86/mm/fault.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
index 6dea040..e7fa28b 100644
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
@@ -1022,11 +1022,11 @@ static inline bool smap_violation(int error_code, struct pt_regs *regs)
* routines.
*/
static void __kprobes
-__do_page_fault(struct pt_regs *regs, unsigned long error_code)
+__do_page_fault(struct pt_regs *regs, unsigned long error_code,
+ unsigned long address)
{
struct vm_area_struct *vma;
struct task_struct *tsk;
- unsigned long address;
struct mm_struct *mm;
int fault;
unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
@@ -1034,9 +1034,6 @@ __do_page_fault(struct pt_regs *regs, unsigned long error_code)
tsk = current;
mm = tsk->mm;
- /* Get the faulting address: */
- address = read_cr2();
-
/*
* Detect and handle instructions that would cause a page fault for
* both a tracked kernel page and a userspace page.
@@ -1252,9 +1249,11 @@ dotraplinkage void __kprobes
do_page_fault(struct pt_regs *regs, unsigned long error_code)
{
enum ctx_state prev_state;
+ /* Get the faulting address: */
+ unsigned long address = read_cr2();
prev_state = exception_enter();
- __do_page_fault(regs, error_code);
+ __do_page_fault(regs, error_code, address);
exception_exit(prev_state);
}
@@ -1271,9 +1270,16 @@ dotraplinkage void __kprobes
trace_do_page_fault(struct pt_regs *regs, unsigned long error_code)
{
enum ctx_state prev_state;
+ /*
+ * The exception_enter and tracepoint processing could
+ * trigger another page faults (user space callchain
+ * reading) and destroy the original cr2 value, so read
+ * the faulting address now.
+ */
+ unsigned long address = read_cr2();
prev_state = exception_enter();
trace_page_fault_entries(regs, error_code);
- __do_page_fault(regs, error_code);
+ __do_page_fault(regs, error_code, address);
exception_exit(prev_state);
}
OpenPOWER on IntegriCloud