Add disabled compat syscalls detail (work in progress)
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 27 Sep 2011 17:53:32 +0000 (13:53 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 27 Sep 2011 17:53:32 +0000 (13:53 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Makefile
instrumentation/syscalls/headers/compat_syscalls_integers.h
ltt-events.h
lttng-compat-syscalls.c [new file with mode: 0644]
lttng-syscalls.c

index d25c3be33eb0cd11461bb9c9d697e3de37b69b82..1d256f39d511cf8b0a310503f5e31dbd1a576783 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -23,6 +23,7 @@ ltt-relay-objs :=  ltt-events.o ltt-debugfs-abi.o \
 
 ifneq ($(CONFIG_HAVE_SYSCALL_TRACEPOINTS),)
 ltt-relay-objs += lttng-syscalls.o
+#ltt-relay-objs += lttng-compat-syscalls.o
 endif
 
 ifneq ($(CONFIG_PERF_EVENTS),)
index dabc4bf731e51be4adadb02b94433fef5fb91f52..1c6e4f2a8994f7a15fd562ccc69a3d0f48a638bb 100644 (file)
@@ -1,3 +1,3 @@
 #ifdef CONFIG_X86_64
-#include "x86-32-syscalls-3.1.0-rc6_integers.h"
+//#include "x86-32-syscalls-3.1.0-rc6_integers.h"
 #endif
index 3ffdcf46045840037d81f1fd42aa7188c213a4e9..e3f0daaa20506a5019b64098c81058889a727142 100644 (file)
@@ -267,6 +267,13 @@ struct ltt_session {
        int metadata_dumped:1;
 };
 
+struct trace_syscall_entry {
+       void *func;
+       const struct lttng_event_desc *desc;
+       const struct lttng_event_field *fields;
+       unsigned int nrargs;
+};
+
 struct ltt_session *ltt_session_create(void);
 int ltt_session_enable(struct ltt_session *session);
 int ltt_session_disable(struct ltt_session *session);
diff --git a/lttng-compat-syscalls.c b/lttng-compat-syscalls.c
new file mode 100644 (file)
index 0000000..28dcdfa
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * lttng-compat-syscalls.c
+ *
+ * Copyright 2010-2011 (c) - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ *
+ * LTTng compat syscall probes.
+ *
+ * Dual LGPL v2.1/GPL v2 license.
+ */
+
+#include <linux/module.h>
+#include <linux/slab.h>
+#include <linux/compat.h>
+#include <asm/ptrace.h>
+#include <asm/syscall.h>
+
+#include "ltt-events.h"
+
+extern
+void syscall_entry_probe(void *__data, struct pt_regs *regs, long id);
+
+/*
+ * Take care of NOARGS not supported by mainline.
+ */
+#define DECLARE_EVENT_CLASS_NOARGS(name, tstruct, assign, print)
+#define DEFINE_EVENT_NOARGS(template, name)
+#define TRACE_EVENT_NOARGS(name, struct, assign, print)
+
+/*
+ * Create LTTng tracepoint probes.
+ */
+#define LTTNG_PACKAGE_BUILD
+#define CREATE_TRACE_POINTS
+#define TP_MODULE_OVERRIDE
+#define TRACE_INCLUDE_PATH ../instrumentation/syscalls/headers
+
+/* Hijack probe callback for system calls */
+#define TP_PROBE_CB(_template)         &syscall_entry_probe
+#include "instrumentation/syscalls/headers/compat_syscalls_integers.h"
+#include "instrumentation/syscalls/headers/compat_syscalls_pointers.h"
+#undef TP_PROBE_CB
+
+#undef TP_MODULE_OVERRIDE
+#undef LTTNG_PACKAGE_BUILD
+#undef CREATE_TRACE_POINTS
+
+#undef TRACE_SYSCALL_TABLE
+#define TRACE_SYSCALL_TABLE(_template, _name, _nr, _nrargs)    \
+       [ _nr ] = {                                             \
+               .func = __event_probe__##_template,             \
+               .nrargs = (_nrargs),                            \
+               .fields = __event_fields___##_template,         \
+               .desc = &__event_desc___##_name,                \
+       },
+
+#define CREATE_SYSCALL_TABLE
+
+/* Create compatibility syscall table */
+const struct trace_syscall_entry compat_sc_table[] = {
+#include "instrumentation/syscalls/headers/compat_syscalls_integers.h"
+#include "instrumentation/syscalls/headers/compat_syscalls_pointers.h"
+};
+const size_t compat_sc_table_len = ARRAY_SIZE(compat_sc_table);
+
+#undef CREATE_SYSCALL_TABLE
index 5135dfe2f88501f47c4436df3b42f878cbb6b800..aef7d4adc90dc93c25bd852b7c577003b1ecf157 100644 (file)
@@ -1,9 +1,9 @@
 /*
  * lttng-syscalls.c
  *
- * Copyright 2010 (c) - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ * Copyright 2010-2011 (c) - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
  *
- * LTTng sched probes.
+ * LTTng syscall probes.
  *
  * Dual LGPL v2.1/GPL v2 license.
  */
@@ -23,7 +23,7 @@ static inline int is_compat_task(void)
 }
 #endif
 
-static void syscall_entry_probe(void *__data, struct pt_regs *regs, long id);
+void syscall_entry_probe(void *__data, struct pt_regs *regs, long id);
 
 /*
  * Take care of NOARGS not supported by mainline.
@@ -52,13 +52,6 @@ static void syscall_entry_probe(void *__data, struct pt_regs *regs, long id);
 #undef LTTNG_PACKAGE_BUILD
 #undef CREATE_TRACE_POINTS
 
-struct trace_syscall_entry {
-       void *func;
-       const struct lttng_event_desc *desc;
-       const struct lttng_event_field *fields;
-       unsigned int nrargs;
-};
-
 #undef TRACE_SYSCALL_TABLE
 #define TRACE_SYSCALL_TABLE(_template, _name, _nr, _nrargs)    \
        [ _nr ] = {                                             \
@@ -75,14 +68,14 @@ static const struct trace_syscall_entry sc_table[] = {
 #include "instrumentation/syscalls/headers/syscalls_pointers.h"
 };
 
-/* Create compatibility syscall table */
-static const struct trace_syscall_entry compat_sc_table[] = {
-#include "instrumentation/syscalls/headers/compat_syscalls_integers.h"
-#include "instrumentation/syscalls/headers/compat_syscalls_pointers.h"
-};
-
 #undef CREATE_SYSCALL_TABLE
 
+//extern const struct trace_syscall_entry compat_sc_table[];
+//extern const size_t compat_sc_table_len;
+//temp disable
+static const struct trace_syscall_entry compat_sc_table[];
+static const size_t compat_sc_table_len;
+
 static void syscall_entry_unknown(struct ltt_event *event,
        struct pt_regs *regs, unsigned int id)
 {
@@ -92,12 +85,7 @@ static void syscall_entry_unknown(struct ltt_event *event,
        __event_probe__sys_unknown(event, id, args);
 }
 
-/*
- * Currently, given that the kernel syscall metadata extraction only
- * considers native system calls (not 32-bit compability ones), we
- * fall-back on the "unknown" system call tracing for 32-bit compat.
- */
-static void syscall_entry_probe(void *__data, struct pt_regs *regs, long id)
+void syscall_entry_probe(void *__data, struct pt_regs *regs, long id)
 {
        struct ltt_channel *chan = __data;
        struct ltt_event *event, *unknown_event;
@@ -106,7 +94,7 @@ static void syscall_entry_probe(void *__data, struct pt_regs *regs, long id)
 
        if (unlikely(is_compat_task())) {
                table = compat_sc_table;
-               table_len = ARRAY_SIZE(compat_sc_table);
+               table_len = compat_sc_table_len;
                unknown_event = chan->sc_compat_unknown;
        } else {
                table = sc_table;
@@ -274,7 +262,7 @@ int lttng_syscalls_register(struct ltt_channel *chan, void *filter)
        if (!chan->compat_sc_table) {
                /* create syscall table mapping compat syscall to events */
                chan->compat_sc_table = kzalloc(sizeof(struct ltt_event *)
-                                       * ARRAY_SIZE(compat_sc_table), GFP_KERNEL);
+                                       * compat_sc_table_len, GFP_KERNEL);
                if (!chan->compat_sc_table)
                        return -ENOMEM;
        }
@@ -332,7 +320,7 @@ int lttng_syscalls_register(struct ltt_channel *chan, void *filter)
        if (ret)
                return ret;
 #ifdef CONFIG_COMPAT
-       ret = fill_table(compat_sc_table, ARRAY_SIZE(compat_sc_table),
+       ret = fill_table(compat_sc_table, compat_sc_table_len,
                        chan->compat_sc_table, chan, filter);
        if (ret)
                return ret;
This page took 0.030008 seconds and 4 git commands to generate.