1 From eb0146daefdde65665b7f076fbff7b49dade95b9 Mon Sep 17 00:00:00 2001
2 From: Masami Hiramatsu <mhiramat@kernel.org>
3 Date: Sun, 13 May 2018 05:04:16 +0100
4 Subject: ARM: 8771/1: kprobes: Prohibit kprobes on do_undefinstr
6 From: Masami Hiramatsu <mhiramat@kernel.org>
8 commit eb0146daefdde65665b7f076fbff7b49dade95b9 upstream.
10 Prohibit kprobes on do_undefinstr because kprobes on
11 arm is implemented by undefined instruction. This means
12 if we probe do_undefinstr(), it can cause infinit
15 Fixes: 24ba613c9d6c ("ARM kprobes: core code")
16 Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
17 Cc: stable@vger.kernel.org
18 Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
19 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 arch/arm/kernel/traps.c | 5 ++++-
23 1 file changed, 4 insertions(+), 1 deletion(-)
25 --- a/arch/arm/kernel/traps.c
26 +++ b/arch/arm/kernel/traps.c
28 #include <linux/uaccess.h>
29 #include <linux/hardirq.h>
30 #include <linux/kdebug.h>
31 +#include <linux/kprobes.h>
32 #include <linux/module.h>
33 #include <linux/kexec.h>
34 #include <linux/bug.h>
35 @@ -395,7 +396,8 @@ void unregister_undef_hook(struct undef_
36 raw_spin_unlock_irqrestore(&undef_lock, flags);
39 -static int call_undef_hook(struct pt_regs *regs, unsigned int instr)
40 +static nokprobe_inline
41 +int call_undef_hook(struct pt_regs *regs, unsigned int instr)
43 struct undef_hook *hook;
45 @@ -468,6 +470,7 @@ die_sig:
47 arm_notify_die("Oops - undefined instruction", regs, &info, 0, 6);
49 +NOKPROBE_SYMBOL(do_undefinstr)
52 * Handle FIQ similarly to NMI on x86 systems.