aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm64/mm/fault.c
diff options
context:
space:
mode:
authorCatalin Marinas <catalin.marinas@arm.com>2016-07-21 13:20:41 -0400
committerCatalin Marinas <catalin.marinas@arm.com>2016-07-21 13:20:41 -0400
commita95b0644b38c16c40b753224671b919b9af0b73c (patch)
tree62f4b54f35dd3a99d6a3c2337bddcf1c72c32c8c /arch/arm64/mm/fault.c
parente75118a7b581b19b08282c7819c1ec6f68b91b79 (diff)
parentf7e35c5ba4322838ce84b23a2f1a6d6b7f0b57ec (diff)
Merge branch 'for-next/kprobes' into for-next/core
* kprobes: arm64: kprobes: Add KASAN instrumentation around stack accesses arm64: kprobes: Cleanup jprobe_return arm64: kprobes: Fix overflow when saving stack arm64: kprobes: WARN if attempting to step with PSTATE.D=1 kprobes: Add arm64 case in kprobe example module arm64: Add kernel return probes support (kretprobes) arm64: Add trampoline code for kretprobes arm64: kprobes instruction simulation support arm64: Treat all entry code as non-kprobe-able arm64: Blacklist non-kprobe-able symbol arm64: Kprobes with single stepping support arm64: add conditional instruction simulation support arm64: Add more test functions to insn.c arm64: Add HAVE_REGS_AND_STACK_ACCESS_API feature
Diffstat (limited to 'arch/arm64/mm/fault.c')
-rw-r--r--arch/arm64/mm/fault.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c
index fc5a34a72c6d..4ebda515a016 100644
--- a/arch/arm64/mm/fault.c
+++ b/arch/arm64/mm/fault.c
@@ -41,6 +41,28 @@
41 41
42static const char *fault_name(unsigned int esr); 42static const char *fault_name(unsigned int esr);
43 43
44#ifdef CONFIG_KPROBES
45static inline int notify_page_fault(struct pt_regs *regs, unsigned int esr)
46{
47 int ret = 0;
48
49 /* kprobe_running() needs smp_processor_id() */
50 if (!user_mode(regs)) {
51 preempt_disable();
52 if (kprobe_running() && kprobe_fault_handler(regs, esr))
53 ret = 1;
54 preempt_enable();
55 }
56
57 return ret;
58}
59#else
60static inline int notify_page_fault(struct pt_regs *regs, unsigned int esr)
61{
62 return 0;
63}
64#endif
65
44/* 66/*
45 * Dump out the page tables associated with 'addr' in mm 'mm'. 67 * Dump out the page tables associated with 'addr' in mm 'mm'.
46 */ 68 */
@@ -262,6 +284,9 @@ static int __kprobes do_page_fault(unsigned long addr, unsigned int esr,
262 unsigned long vm_flags = VM_READ | VM_WRITE | VM_EXEC; 284 unsigned long vm_flags = VM_READ | VM_WRITE | VM_EXEC;
263 unsigned int mm_flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE; 285 unsigned int mm_flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
264 286
287 if (notify_page_fault(regs, esr))
288 return 0;
289
265 tsk = current; 290 tsk = current;
266 mm = tsk->mm; 291 mm = tsk->mm;
267 292
@@ -632,6 +657,7 @@ asmlinkage int __exception do_debug_exception(unsigned long addr,
632 657
633 return rv; 658 return rv;
634} 659}
660NOKPROBE_SYMBOL(do_debug_exception);
635 661
636#ifdef CONFIG_ARM64_PAN 662#ifdef CONFIG_ARM64_PAN
637void cpu_enable_pan(void *__unused) 663void cpu_enable_pan(void *__unused)