Update lttng-syscalls-extractor for v5.6.0
authorMichael Jeanson <mjeanson@efficios.com>
Wed, 4 Mar 2020 20:21:03 +0000 (15:21 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 9 Mar 2020 16:12:43 +0000 (12:12 -0400)
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I48e4d82484d6edcc7601a40d2f94e5c46ad5184b

instrumentation/syscalls/README
instrumentation/syscalls/lttng-syscalls-extractor/linux-link-trace-syscalls-as-data.patch
instrumentation/syscalls/lttng-syscalls-extractor/lttng-syscalls-extractor.c

index a2a66fa038ae48ce0d43f82a1d1c8701aa06c289..6dbc640ecac8081763327c0e2ae6fa524df266f0 100644 (file)
@@ -10,12 +10,11 @@ is expected). See the dmesg output for system call metadata.
 
 2) Generate system call TRACE_EVENT().
 
-Take the dmesg metadata and feed it to lttng-syscalls-generate-headers.sh
-(do not include the ending SUCCESS line), e.g., from the
-instrumentation/syscalls directory. See the script header for usage example.
-It should be run for both the integers and pointers types.
+Take the dmesg data and feed it to lttng-syscalls-generate-headers.sh from
+the instrumentation/syscalls directory. See the script header for usage
+example. It should be run for both the integers and pointers types.
 
-After these are created, we just need to follow the new system call additions,
+After these are created, you just need to follow the new system call additions,
 no need to regenerate the whole thing, since system calls are only appended to.
 
 3) Override headers
index 6ba8e6686dd82e161f201a762f4ec0f20018e421..5269071f308f194bfd53cabd9aa957fb7a92b1fb 100644 (file)
@@ -3,27 +3,24 @@ Linux: link syscalls metadata as data (for LTTng syscall extraction)
 * NOT for mainline *
 
 Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
----
- include/asm-generic/vmlinux.lds.h |    2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
 
-Index: linux-2.6-lttng/include/asm-generic/vmlinux.lds.h
-===================================================================
---- linux-2.6-lttng.orig/include/asm-generic/vmlinux.lds.h
-+++ linux-2.6-lttng/include/asm-generic/vmlinux.lds.h
-@@ -169,6 +169,7 @@
-       MEM_KEEP(exit.data)                                             \
+diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
+index e00f41aa8ec4..13f51fa7c3f3 100644
+--- a/include/asm-generic/vmlinux.lds.h
++++ b/include/asm-generic/vmlinux.lds.h
+@@ -318,6 +318,7 @@
+       __end_once = .;                                                 \
        STRUCT_ALIGN();                                                 \
        *(__tracepoints)                                                \
 +      TRACE_SYSCALLS()                                                \
        /* implement dynamic printk debug */                            \
-       . = ALIGN(8);                                                   \
-       VMLINUX_SYMBOL(__start___jump_table) = .;                       \
-@@ -489,7 +490,6 @@
-       *(.init.rodata)                                                 \
+       . = ALIGN(8);                                                   \
+       __start___verbose = .;                                          \
+@@ -650,7 +651,6 @@
        MCOUNT_REC()                                                    \
+       *(.init.rodata .init.rodata.*)                                  \
        FTRACE_EVENTS()                                                 \
 -      TRACE_SYSCALLS()                                                \
-       DEV_DISCARD(init.rodata)                                        \
-       CPU_DISCARD(init.rodata)                                        \
+       KPROBE_BLACKLIST()                                              \
+       ERROR_INJECT_WHITELIST()                                        \
        MEM_DISCARD(init.rodata)                                        \
index ccf7681f6c74e1e420014857213f18a5088257e7..f1e342603a2f7635cd83da7b8d928de225ee2d07 100644 (file)
@@ -4,8 +4,8 @@
  *
  * Dump syscall metadata to console.
  *
- * Copyright 2011 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- * Copyright 2011 Julien Desfossez <julien.desfossez@polymtl.ca>
+ * Copyright 2011 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ * Copyright 2011 Julien Desfossez <julien.desfossez@polymtl.ca>
  */
 
 #include <linux/module.h>
@@ -16,7 +16,7 @@
 #include <linux/slab.h>
 #include <linux/kallsyms.h>
 #include <linux/dcache.h>
-#include <linux/ftrace_event.h>
+#include <linux/trace_events.h>
 #include <trace/syscall.h>
 #include <asm/syscall.h>
 
 #error "You need to set CONFIG_KALLSYMS_ALL=y"
 #endif
 
+/*
+ * The 'ident' parameter is prepended to each printk line to help
+ * extract the proper lines from dmesg.
+ */
+static char *ident = "";
+module_param(ident, charp, 0);
+
 static struct syscall_metadata **__start_syscalls_metadata;
 static struct syscall_metadata **__stop_syscalls_metadata;
 
@@ -52,31 +59,35 @@ int init_module(void)
        __start_syscalls_metadata = (void *) kallsyms_lookup_name("__start_syscalls_metadata");
        __stop_syscalls_metadata = (void *) kallsyms_lookup_name("__stop_syscalls_metadata");
 
+       printk("%s---START---\n", ident);
        for (i = 0; i < NR_syscalls; i++) {
                int j;
 
                meta = find_syscall_meta(i);
                if (!meta)
                        continue;
-               printk("syscall %s nr %d nbargs %d ",
-                       meta->name, meta->syscall_nr, meta->nb_args);
-               printk("types: (");
+               printk("%ssyscall %s nr %d nbargs %d ",
+                       ident, meta->name, meta->syscall_nr, meta->nb_args);
+               printk(KERN_CONT "types: (");
                for (j = 0; j < meta->nb_args; j++) {
                        if (j > 0)
-                               printk(", ");
-                       printk("%s", meta->types[j]);
+                               printk(KERN_CONT ", ");
+                       printk(KERN_CONT "%s", meta->types[j]);
                }
-               printk(") ");
-               printk("args: (");
+               printk(KERN_CONT ") ");
+               printk(KERN_CONT "args: (");
                for (j = 0; j < meta->nb_args; j++) {
                        if (j > 0)
-                               printk(", ");
-                       printk("%s", meta->args[j]);
+                               printk(KERN_CONT ", ");
+                       printk(KERN_CONT "%s", meta->args[j]);
                }
-               printk(")\n");
+               printk(KERN_CONT ")\n");
        }
-       printk("SUCCESS\n");
+       printk("%s---END---\n", ident);
 
+       /*
+        * This module always fails to load.
+        */
        return -1;
 }
 
This page took 0.028989 seconds and 4 git commands to generate.