X-Git-Url: http://git.lttng.org/?a=blobdiff_plain;f=lttng-syscalls.c;h=a3149d0d01caa4260bc2e0442907207f4f4aac4b;hb=924397cb36314bdf15d91e78fb1bf6d77c1acfa7;hp=5fa66660b5f2532d715e80d90fb7c8feb6ec08ca;hpb=7456615b6fee0905435303ebb5d7c330cd4d068c;p=lttng-modules.git diff --git a/lttng-syscalls.c b/lttng-syscalls.c index 5fa66660..a3149d0d 100644 --- a/lttng-syscalls.c +++ b/lttng-syscalls.c @@ -34,11 +34,11 @@ #include #include -#include "lib/bitfield.h" -#include "wrapper/tracepoint.h" -#include "wrapper/file.h" -#include "wrapper/rcu.h" -#include "lttng-events.h" +#include +#include +#include +#include +#include #ifndef CONFIG_COMPAT # ifndef is_compat_task @@ -46,6 +46,11 @@ # endif #endif +/* in_compat_syscall appears in kernel 4.6. */ +#ifndef in_compat_syscall + #define in_compat_syscall() is_compat_task() +#endif + enum sc_type { SC_TYPE_ENTRY, SC_TYPE_EXIT, @@ -78,6 +83,7 @@ struct old_utsname; struct sel_arg_struct; struct mmap_arg_struct; struct file_handle; +struct user_msghdr; #ifdef IA32_NR_syscalls #define NR_compat_syscalls IA32_NR_syscalls @@ -91,14 +97,14 @@ struct file_handle; #define LTTNG_PACKAGE_BUILD #define CREATE_TRACE_POINTS #define TP_MODULE_NOINIT -#define TRACE_INCLUDE_PATH ../instrumentation/syscalls/headers +#define TRACE_INCLUDE_PATH instrumentation/syscalls/headers #define PARAMS(args...) args /* Handle unknown syscalls */ #undef TRACE_SYSTEM #define TRACE_SYSTEM syscalls_unknown -#include "instrumentation/syscalls/headers/syscalls_unknown.h" +#include #undef TRACE_SYSTEM #define SC_ENTER @@ -118,10 +124,10 @@ struct file_handle; #define SC_LTTNG_TRACEPOINT_EVENT(_name, _proto, _args, _fields) \ LTTNG_TRACEPOINT_EVENT(syscall_entry_##_name, PARAMS(_proto), PARAMS(_args), \ PARAMS(_fields)) -#define SC_LTTNG_TRACEPOINT_EVENT_CODE(_name, _proto, _args, _locvar, _code, _fields) \ +#define SC_LTTNG_TRACEPOINT_EVENT_CODE(_name, _proto, _args, _locvar, _code_pre, _fields, _code_post) \ LTTNG_TRACEPOINT_EVENT_CODE(syscall_entry_##_name, PARAMS(_proto), PARAMS(_args), \ - PARAMS(_locvar), PARAMS(_code), \ - PARAMS(_fields)) + PARAMS(_locvar), PARAMS(_code_pre), \ + PARAMS(_fields), PARAMS(_code_post)) #define SC_LTTNG_TRACEPOINT_EVENT_CLASS_NOARGS(_name, _fields) \ LTTNG_TRACEPOINT_EVENT_CLASS_NOARGS(syscall_entry_##_name, PARAMS(_fields)) #define SC_LTTNG_TRACEPOINT_EVENT_INSTANCE_NOARGS(_template, _name) \ @@ -129,12 +135,12 @@ struct file_handle; #undef TRACE_SYSTEM #define TRACE_SYSTEM syscall_entry_integers #define TRACE_INCLUDE_FILE syscalls_integers -#include "instrumentation/syscalls/headers/syscalls_integers.h" +#include #undef TRACE_INCLUDE_FILE #undef TRACE_SYSTEM #define TRACE_SYSTEM syscall_entry_pointers #define TRACE_INCLUDE_FILE syscalls_pointers -#include "instrumentation/syscalls/headers/syscalls_pointers.h" +#include #undef TRACE_INCLUDE_FILE #undef TRACE_SYSTEM #undef SC_LTTNG_TRACEPOINT_EVENT_CODE @@ -150,9 +156,9 @@ struct file_handle; #define SC_LTTNG_TRACEPOINT_EVENT(_name, _proto, _args, _fields) \ LTTNG_TRACEPOINT_EVENT(compat_syscall_entry_##_name, PARAMS(_proto), PARAMS(_args), \ PARAMS(_fields)) -#define SC_LTTNG_TRACEPOINT_EVENT_CODE(_name, _proto, _args, _locvar, _code, _fields) \ +#define SC_LTTNG_TRACEPOINT_EVENT_CODE(_name, _proto, _args, _locvar, _code_pre, _fields, _code_post) \ LTTNG_TRACEPOINT_EVENT_CODE(compat_syscall_entry_##_name, PARAMS(_proto), PARAMS(_args), \ - PARAMS(_locvar), PARAMS(_code), PARAMS(_fields)) + PARAMS(_locvar), PARAMS(_code_pre), PARAMS(_fields), PARAMS(_code_post)) #define SC_LTTNG_TRACEPOINT_EVENT_CLASS_NOARGS(_name, _fields) \ LTTNG_TRACEPOINT_EVENT_CLASS_NOARGS(compat_syscall_entry_##_name, PARAMS(_fields)) #define SC_LTTNG_TRACEPOINT_EVENT_INSTANCE_NOARGS(_template, _name) \ @@ -160,12 +166,12 @@ struct file_handle; compat_syscall_entry_##_name) #define TRACE_SYSTEM compat_syscall_entry_integers #define TRACE_INCLUDE_FILE compat_syscalls_integers -#include "instrumentation/syscalls/headers/compat_syscalls_integers.h" +#include #undef TRACE_INCLUDE_FILE #undef TRACE_SYSTEM #define TRACE_SYSTEM compat_syscall_entry_pointers #define TRACE_INCLUDE_FILE compat_syscalls_pointers -#include "instrumentation/syscalls/headers/compat_syscalls_pointers.h" +#include #undef TRACE_INCLUDE_FILE #undef TRACE_SYSTEM #undef SC_LTTNG_TRACEPOINT_EVENT_CODE @@ -194,9 +200,9 @@ struct file_handle; #define SC_LTTNG_TRACEPOINT_EVENT(_name, _proto, _args, _fields) \ LTTNG_TRACEPOINT_EVENT(syscall_exit_##_name, PARAMS(_proto), PARAMS(_args), \ PARAMS(_fields)) -#define SC_LTTNG_TRACEPOINT_EVENT_CODE(_name, _proto, _args, _locvar, _code, _fields) \ +#define SC_LTTNG_TRACEPOINT_EVENT_CODE(_name, _proto, _args, _locvar, _code_pre, _fields, _code_post) \ LTTNG_TRACEPOINT_EVENT_CODE(syscall_exit_##_name, PARAMS(_proto), PARAMS(_args), \ - PARAMS(_locvar), PARAMS(_code), PARAMS(_fields)) + PARAMS(_locvar), PARAMS(_code_pre), PARAMS(_fields), PARAMS(_code_post)) #define SC_LTTNG_TRACEPOINT_EVENT_CLASS_NOARGS(_name, _fields) \ LTTNG_TRACEPOINT_EVENT_CLASS_NOARGS(syscall_exit_##_name, PARAMS(_fields)) #define SC_LTTNG_TRACEPOINT_EVENT_INSTANCE_NOARGS(_template, _name) \ @@ -204,12 +210,12 @@ struct file_handle; syscall_exit_##_name) #define TRACE_SYSTEM syscall_exit_integers #define TRACE_INCLUDE_FILE syscalls_integers -#include "instrumentation/syscalls/headers/syscalls_integers.h" +#include #undef TRACE_INCLUDE_FILE #undef TRACE_SYSTEM #define TRACE_SYSTEM syscall_exit_pointers #define TRACE_INCLUDE_FILE syscalls_pointers -#include "instrumentation/syscalls/headers/syscalls_pointers.h" +#include #undef TRACE_INCLUDE_FILE #undef TRACE_SYSTEM #undef SC_LTTNG_TRACEPOINT_EVENT_CODE @@ -226,9 +232,9 @@ struct file_handle; #define SC_LTTNG_TRACEPOINT_EVENT(_name, _proto, _args, _fields) \ LTTNG_TRACEPOINT_EVENT(compat_syscall_exit_##_name, PARAMS(_proto), PARAMS(_args), \ PARAMS(_fields)) -#define SC_LTTNG_TRACEPOINT_EVENT_CODE(_name, _proto, _args, _locvar, _code, _fields) \ +#define SC_LTTNG_TRACEPOINT_EVENT_CODE(_name, _proto, _args, _locvar, _code_pre, _fields, _code_post) \ LTTNG_TRACEPOINT_EVENT_CODE(compat_syscall_exit_##_name, PARAMS(_proto), PARAMS(_args), \ - PARAMS(_locvar), PARAMS(_code), PARAMS(_fields)) + PARAMS(_locvar), PARAMS(_code_pre), PARAMS(_fields), PARAMS(_code_post)) #define SC_LTTNG_TRACEPOINT_EVENT_CLASS_NOARGS(_name, _fields) \ LTTNG_TRACEPOINT_EVENT_CLASS_NOARGS(compat_syscall_exit_##_name, PARAMS(_fields)) #define SC_LTTNG_TRACEPOINT_EVENT_INSTANCE_NOARGS(_template, _name) \ @@ -236,12 +242,12 @@ struct file_handle; compat_syscall_exit_##_name) #define TRACE_SYSTEM compat_syscall_exit_integers #define TRACE_INCLUDE_FILE compat_syscalls_integers -#include "instrumentation/syscalls/headers/compat_syscalls_integers.h" +#include #undef TRACE_INCLUDE_FILE #undef TRACE_SYSTEM #define TRACE_SYSTEM compat_syscall_exit_pointers #define TRACE_INCLUDE_FILE compat_syscalls_pointers -#include "instrumentation/syscalls/headers/compat_syscalls_pointers.h" +#include #undef TRACE_INCLUDE_FILE #undef TRACE_SYSTEM #undef SC_LTTNG_TRACEPOINT_EVENT_CODE @@ -283,8 +289,8 @@ struct trace_syscall_entry { /* Syscall enter tracing table */ static const struct trace_syscall_entry sc_table[] = { -#include "instrumentation/syscalls/headers/syscalls_integers.h" -#include "instrumentation/syscalls/headers/syscalls_pointers.h" +#include +#include }; #undef TRACE_SYSCALL_TABLE @@ -298,8 +304,8 @@ static const struct trace_syscall_entry sc_table[] = { /* Compat syscall enter 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" +#include +#include }; #undef SC_ENTER @@ -320,8 +326,8 @@ const struct trace_syscall_entry compat_sc_table[] = { /* Syscall exit table */ static const struct trace_syscall_entry sc_exit_table[] = { -#include "instrumentation/syscalls/headers/syscalls_integers.h" -#include "instrumentation/syscalls/headers/syscalls_pointers.h" +#include +#include }; #undef TRACE_SYSCALL_TABLE @@ -335,8 +341,8 @@ static const struct trace_syscall_entry sc_exit_table[] = { /* Compat syscall exit table */ const struct trace_syscall_entry compat_sc_exit_table[] = { -#include "instrumentation/syscalls/headers/compat_syscalls_integers.h" -#include "instrumentation/syscalls/headers/compat_syscalls_pointers.h" +#include +#include }; #undef SC_EXIT @@ -354,7 +360,7 @@ static void syscall_entry_unknown(struct lttng_event *event, unsigned long args[UNKNOWN_SYSCALL_NRARGS]; syscall_get_arguments(current, regs, 0, UNKNOWN_SYSCALL_NRARGS, args); - if (unlikely(is_compat_task())) + if (unlikely(in_compat_syscall())) __event_probe__compat_syscall_entry_unknown(event, id, args); else __event_probe__syscall_entry_unknown(event, id, args); @@ -367,7 +373,7 @@ void syscall_entry_probe(void *__data, struct pt_regs *regs, long id) const struct trace_syscall_entry *table, *entry; size_t table_len; - if (unlikely(is_compat_task())) { + if (unlikely(in_compat_syscall())) { struct lttng_syscall_filter *filter; filter = lttng_rcu_dereference(chan->sc_filter); @@ -400,7 +406,7 @@ void syscall_entry_probe(void *__data, struct pt_regs *regs, long id) syscall_entry_unknown(unknown_event, regs, id); return; } - if (unlikely(is_compat_task())) + if (unlikely(in_compat_syscall())) event = chan->compat_sc_table[id]; else event = chan->sc_table[id]; @@ -505,7 +511,7 @@ static void syscall_exit_unknown(struct lttng_event *event, unsigned long args[UNKNOWN_SYSCALL_NRARGS]; syscall_get_arguments(current, regs, 0, UNKNOWN_SYSCALL_NRARGS, args); - if (unlikely(is_compat_task())) + if (unlikely(in_compat_syscall())) __event_probe__compat_syscall_exit_unknown(event, id, ret, args); else @@ -521,7 +527,7 @@ void syscall_exit_probe(void *__data, struct pt_regs *regs, long ret) long id; id = syscall_get_nr(current, regs); - if (unlikely(is_compat_task())) { + if (unlikely(in_compat_syscall())) { struct lttng_syscall_filter *filter; filter = lttng_rcu_dereference(chan->sc_filter); @@ -554,7 +560,7 @@ void syscall_exit_probe(void *__data, struct pt_regs *regs, long ret) syscall_exit_unknown(unknown_event, regs, id, ret); return; } - if (unlikely(is_compat_task())) + if (unlikely(in_compat_syscall())) event = chan->compat_sc_exit_table[id]; else event = chan->sc_exit_table[id];