diff options
author | Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> | 2014-04-17 04:17:26 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2014-04-24 04:02:58 -0400 |
commit | 98def1dedd00f42ded8423c418c971751f46aad2 (patch) | |
tree | 33852494b1b3f98dcf26e30a9cc8a4cb8949ac44 /arch/x86 | |
parent | 8027197220e02d5cebbbfdff36c2827661fbc692 (diff) |
kprobes, x86: Prohibit probing on thunk functions and restore
thunk/restore functions are also used for tracing irqoff etc.
and those are involved in kprobe's exception handling.
Prohibit probing on them to avoid kernel crash.
Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Reviewed-by: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/20140417081726.26341.3872.stgit@ltc230.yrl.intra.hitachi.co.jp
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/lib/thunk_32.S | 3 | ||||
-rw-r--r-- | arch/x86/lib/thunk_64.S | 3 |
2 files changed, 5 insertions, 1 deletions
diff --git a/arch/x86/lib/thunk_32.S b/arch/x86/lib/thunk_32.S index 2930ae05d773..28f85c916712 100644 --- a/arch/x86/lib/thunk_32.S +++ b/arch/x86/lib/thunk_32.S | |||
@@ -4,8 +4,8 @@ | |||
4 | * (inspired by Andi Kleen's thunk_64.S) | 4 | * (inspired by Andi Kleen's thunk_64.S) |
5 | * Subject to the GNU public license, v.2. No warranty of any kind. | 5 | * Subject to the GNU public license, v.2. No warranty of any kind. |
6 | */ | 6 | */ |
7 | |||
8 | #include <linux/linkage.h> | 7 | #include <linux/linkage.h> |
8 | #include <asm/asm.h> | ||
9 | 9 | ||
10 | #ifdef CONFIG_TRACE_IRQFLAGS | 10 | #ifdef CONFIG_TRACE_IRQFLAGS |
11 | /* put return address in eax (arg1) */ | 11 | /* put return address in eax (arg1) */ |
@@ -22,6 +22,7 @@ | |||
22 | popl %ecx | 22 | popl %ecx |
23 | popl %eax | 23 | popl %eax |
24 | ret | 24 | ret |
25 | _ASM_NOKPROBE(\name) | ||
25 | .endm | 26 | .endm |
26 | 27 | ||
27 | thunk_ra trace_hardirqs_on_thunk,trace_hardirqs_on_caller | 28 | thunk_ra trace_hardirqs_on_thunk,trace_hardirqs_on_caller |
diff --git a/arch/x86/lib/thunk_64.S b/arch/x86/lib/thunk_64.S index a63efd6bb6a5..92d9feaff42b 100644 --- a/arch/x86/lib/thunk_64.S +++ b/arch/x86/lib/thunk_64.S | |||
@@ -8,6 +8,7 @@ | |||
8 | #include <linux/linkage.h> | 8 | #include <linux/linkage.h> |
9 | #include <asm/dwarf2.h> | 9 | #include <asm/dwarf2.h> |
10 | #include <asm/calling.h> | 10 | #include <asm/calling.h> |
11 | #include <asm/asm.h> | ||
11 | 12 | ||
12 | /* rdi: arg1 ... normal C conventions. rax is saved/restored. */ | 13 | /* rdi: arg1 ... normal C conventions. rax is saved/restored. */ |
13 | .macro THUNK name, func, put_ret_addr_in_rdi=0 | 14 | .macro THUNK name, func, put_ret_addr_in_rdi=0 |
@@ -25,6 +26,7 @@ | |||
25 | call \func | 26 | call \func |
26 | jmp restore | 27 | jmp restore |
27 | CFI_ENDPROC | 28 | CFI_ENDPROC |
29 | _ASM_NOKPROBE(\name) | ||
28 | .endm | 30 | .endm |
29 | 31 | ||
30 | #ifdef CONFIG_TRACE_IRQFLAGS | 32 | #ifdef CONFIG_TRACE_IRQFLAGS |
@@ -43,3 +45,4 @@ restore: | |||
43 | RESTORE_ARGS | 45 | RESTORE_ARGS |
44 | ret | 46 | ret |
45 | CFI_ENDPROC | 47 | CFI_ENDPROC |
48 | _ASM_NOKPROBE(restore) | ||