]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.4.133/arm-8771-1-kprobes-prohibit-kprobes-on-do_undefinstr.patch
Fixes for 5.10
[thirdparty/kernel/stable-queue.git] / releases / 4.4.133 / arm-8771-1-kprobes-prohibit-kprobes-on-do_undefinstr.patch
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
5
6 From: Masami Hiramatsu <mhiramat@kernel.org>
7
8 commit eb0146daefdde65665b7f076fbff7b49dade95b9 upstream.
9
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
13 recursive exception.
14
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>
20
21 ---
22 arch/arm/kernel/traps.c | 5 ++++-
23 1 file changed, 4 insertions(+), 1 deletion(-)
24
25 --- a/arch/arm/kernel/traps.c
26 +++ b/arch/arm/kernel/traps.c
27 @@ -19,6 +19,7 @@
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);
37 }
38
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)
42 {
43 struct undef_hook *hook;
44 unsigned long flags;
45 @@ -468,6 +470,7 @@ die_sig:
46
47 arm_notify_die("Oops - undefined instruction", regs, &info, 0, 6);
48 }
49 +NOKPROBE_SYMBOL(do_undefinstr)
50
51 /*
52 * Handle FIQ similarly to NMI on x86 systems.