From 771af27e31ba33049fa04033456f04e7d740ec66 Mon Sep 17 00:00:00 2001 From: Jan Willeke Date: Thu, 16 Feb 2017 14:42:51 +0100 Subject: [PATCH] socketpair: extend syscall socketpair tracing information Decode the socketpair vector pointer into two file descriptors. This exposes the connected file descriptors to analyses. As sockerpair is a sub syscall of socketcall in x86_32, sockerpair override must be disabled for x86_32 and x86_compatmode Signed-off-by: Jan Willeke Signed-off-by: Mathieu Desnoyers --- .../headers/syscalls_pointers_override.h | 16 ++++++++++++++++ lttng-syscalls.c | 4 ++++ 2 files changed, 20 insertions(+) diff --git a/instrumentation/syscalls/headers/syscalls_pointers_override.h b/instrumentation/syscalls/headers/syscalls_pointers_override.h index 6b12a562..8e4d4c7f 100644 --- a/instrumentation/syscalls/headers/syscalls_pointers_override.h +++ b/instrumentation/syscalls/headers/syscalls_pointers_override.h @@ -871,4 +871,20 @@ SC_LTTNG_TRACEPOINT_EVENT_CODE(epoll_pwait, ) #endif /* defined(CONFIG_X86_32) || defined(CONFIG_X86_64) || defined(CONFIG_ARM64) || defined(CONFIG_ARM) */ +#if (defined(CONFIG_X86_64) && !defined(LTTNG_SC_COMPAT)) || defined(CONFIG_ARM64) || defined(CONFIG_ARM) +#define OVERRIDE_32_socketpair +#define OVERRIDE_64_socketpair +SC_LTTNG_TRACEPOINT_EVENT(socketpair, + TP_PROTO(sc_exit(long ret,) int family, int type, int protocol, int *usockvec), + TP_ARGS(sc_exit(ret,) family, type, protocol, usockvec), + TP_FIELDS( + sc_exit(ctf_integer(long, ret, ret)) + sc_in(ctf_integer(int, family, family)) + sc_in(ctf_integer(int, type, type)) + sc_in(ctf_integer(int, protocol, protocol)) + sc_out(ctf_user_array(int, socket, usockvec, 2)) + ) +) +#endif /* (defined(CONFIG_X86_64) && !defined(LTTNG_SC_COMPAT)) || defined(CONFIG_ARM64) || defined(CONFIG_ARM) */ + #endif /* CREATE_SYSCALL_TABLE */ diff --git a/lttng-syscalls.c b/lttng-syscalls.c index 080355f4..11f904af 100644 --- a/lttng-syscalls.c +++ b/lttng-syscalls.c @@ -157,6 +157,7 @@ struct user_msghdr; /* Hijack probe callback for compat system call enter */ #define TP_PROBE_CB(_template) &syscall_entry_probe +#define LTTNG_SC_COMPAT #define SC_LTTNG_TRACEPOINT_EVENT(_name, _proto, _args, _fields) \ LTTNG_TRACEPOINT_EVENT(compat_syscall_entry_##_name, PARAMS(_proto), PARAMS(_args), \ PARAMS(_fields)) @@ -188,6 +189,7 @@ struct user_msghdr; #undef TP_PROBE_CB #undef _TRACE_SYSCALLS_INTEGERS_H #undef _TRACE_SYSCALLS_POINTERS_H +#undef LTTNG_SC_COMPAT #undef SC_ENTER @@ -239,6 +241,7 @@ struct user_msghdr; /* Hijack probe callback for compat system call exit */ #define TP_PROBE_CB(_template) &syscall_exit_probe +#define LTTNG_SC_COMPAT #define SC_LTTNG_TRACEPOINT_EVENT(_name, _proto, _args, _fields) \ LTTNG_TRACEPOINT_EVENT(compat_syscall_exit_##_name, PARAMS(_proto), PARAMS(_args), \ PARAMS(_fields)) @@ -270,6 +273,7 @@ struct user_msghdr; #undef TP_PROBE_CB #undef _TRACE_SYSCALLS_INTEGERS_H #undef _TRACE_SYSCALLS_POINTERS_H +#undef LTTNG_SC_COMPAT #undef SC_EXIT -- 2.34.1