diff options
author | Nicolas Pitre <nico@cam.org> | 2007-12-03 15:21:57 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-01-26 10:25:16 -0500 |
commit | 25ce1dd71b8326f2542cf030f68e0e64c3d94dc1 (patch) | |
tree | d2b63f16f2585094e0fb77378c1c7768ba06b7f4 /arch/arm/mm | |
parent | 24ba613c9d6cad315f484e658288db152f1dc447 (diff) |
ARM kprobes: add the kprobes hook to the page fault handler
Signed-off-by: Nicolas Pitre <nico@marvell.com>
Diffstat (limited to 'arch/arm/mm')
-rw-r--r-- | arch/arm/mm/fault.c | 27 |
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 | ||
26 | static 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 | ||
41 | static 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 | ||