aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
authorAndy Lutomirski <luto@MIT.EDU>2011-08-03 09:31:54 -0400
committerH. Peter Anvin <hpa@linux.intel.com>2011-08-04 19:13:53 -0400
commitc149a665ac488e0dac22a42287f45ad1bda06ff1 (patch)
tree0f2d945f47e98ae5aefb779850a39bb7462c4417 /arch/x86
parent318f5a2a672152328c9fb4dead504b89ec738a43 (diff)
x86-64: Add vsyscall:emulate_vsyscall trace event
Vsyscall emulation is slow, so make it easy to track down. Signed-off-by: Andy Lutomirski <luto@mit.edu> Link: http://lkml.kernel.org/r/cdaad7da946a80b200df16647c1700db3e1171e9.1312378163.git.luto@mit.edu Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/kernel/vsyscall_64.c6
-rw-r--r--arch/x86/kernel/vsyscall_trace.h29
2 files changed, 35 insertions, 0 deletions
diff --git a/arch/x86/kernel/vsyscall_64.c b/arch/x86/kernel/vsyscall_64.c
index 1725930a6f9f..93a0d46d9569 100644
--- a/arch/x86/kernel/vsyscall_64.c
+++ b/arch/x86/kernel/vsyscall_64.c
@@ -50,6 +50,9 @@
50#include <asm/vgtod.h> 50#include <asm/vgtod.h>
51#include <asm/traps.h> 51#include <asm/traps.h>
52 52
53#define CREATE_TRACE_POINTS
54#include "vsyscall_trace.h"
55
53DEFINE_VVAR(int, vgetcpu_mode); 56DEFINE_VVAR(int, vgetcpu_mode);
54DEFINE_VVAR(struct vsyscall_gtod_data, vsyscall_gtod_data) = 57DEFINE_VVAR(struct vsyscall_gtod_data, vsyscall_gtod_data) =
55{ 58{
@@ -146,6 +149,9 @@ void dotraplinkage do_emulate_vsyscall(struct pt_regs *regs, long error_code)
146 * and int 0xcc is two bytes long. 149 * and int 0xcc is two bytes long.
147 */ 150 */
148 vsyscall_nr = addr_to_vsyscall_nr(regs->ip - 2); 151 vsyscall_nr = addr_to_vsyscall_nr(regs->ip - 2);
152
153 trace_emulate_vsyscall(vsyscall_nr);
154
149 if (vsyscall_nr < 0) { 155 if (vsyscall_nr < 0) {
150 warn_bad_vsyscall(KERN_WARNING, regs, 156 warn_bad_vsyscall(KERN_WARNING, regs,
151 "illegal int 0xcc (exploit attempt?)"); 157 "illegal int 0xcc (exploit attempt?)");
diff --git a/arch/x86/kernel/vsyscall_trace.h b/arch/x86/kernel/vsyscall_trace.h
new file mode 100644
index 000000000000..a8b2edec54fe
--- /dev/null
+++ b/arch/x86/kernel/vsyscall_trace.h
@@ -0,0 +1,29 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM vsyscall
3
4#if !defined(__VSYSCALL_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
5#define __VSYSCALL_TRACE_H
6
7#include <linux/tracepoint.h>
8
9TRACE_EVENT(emulate_vsyscall,
10
11 TP_PROTO(int nr),
12
13 TP_ARGS(nr),
14
15 TP_STRUCT__entry(__field(int, nr)),
16
17 TP_fast_assign(
18 __entry->nr = nr;
19 ),
20
21 TP_printk("nr = %d", __entry->nr)
22);
23
24#endif
25
26#undef TRACE_INCLUDE_PATH
27#define TRACE_INCLUDE_PATH ../../arch/x86/kernel
28#define TRACE_INCLUDE_FILE vsyscall_trace
29#include <trace/define_trace.h>