aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/mm/fault.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c
index a8a7dab757eb..1e7b1ed304d8 100644
--- a/arch/arm/mm/fault.c
+++ b/arch/arm/mm/fault.c
@@ -12,6 +12,7 @@
12#include <linux/signal.h> 12#include <linux/signal.h>
13#include <linux/mm.h> 13#include <linux/mm.h>
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/kprobes.h>
15 16
16#include <asm/system.h> 17#include <asm/system.h>
17#include <asm/pgtable.h> 18#include <asm/pgtable.h>
@@ -20,6 +21,29 @@
20 21
21#include "fault.h" 22#include "fault.h"
22 23
24
25#ifdef CONFIG_KPROBES
26static inline int notify_page_fault(struct pt_regs *regs, unsigned int fsr)
27{
28 int ret = 0;
29
30 if (!user_mode(regs)) {
31 /* kprobe_running() needs smp_processor_id() */
32 preempt_disable();
33 if (kprobe_running() && kprobe_fault_handler(regs, fsr))
34 ret = 1;
35 preempt_enable();
36 }
37
38 return ret;
39}
40#else
41static inline int notify_page_fault(struct pt_regs *regs, unsigned int fsr)
42{
43 return 0;
44}
45#endif
46
23/* 47/*
24 * This is useful to dump out the page tables associated with 48 * This is useful to dump out the page tables associated with
25 * 'addr' in mm 'mm'. 49 * 'addr' in mm 'mm'.
@@ -222,6 +246,9 @@ do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
222 struct mm_struct *mm; 246 struct mm_struct *mm;
223 int fault, sig, code; 247 int fault, sig, code;
224 248
249 if (notify_page_fault(regs, fsr))
250 return 0;
251
225 tsk = current; 252 tsk = current;
226 mm = tsk->mm; 253 mm = tsk->mm;
227 254