perf trace augmented_syscalls: Augment sendto's 'addr' arg
authorArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 29 Aug 2018 11:47:08 +0000 (08:47 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 30 Aug 2018 18:52:20 +0000 (15:52 -0300)
Its a 'struct sockaddr' pointer, augment it with the same beautifier as
for 'connect' and 'bind', that all receive from userspace that pointer.

Doing it in the other direction remains to be done, hooking at the
syscalls:sys_exit_{accept4?,recvmsg} tracepoints somehow.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: https://lkml.kernel.org/n/tip-k2eu68lsphnm2fthc32gq76c@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/builtin-trace.c
tools/perf/examples/bpf/augmented_syscalls.c

index 537bb30895dfbdf3740de07dc18c461a08a06964..759d14e3fe6bf752d99def53193231948c34adf5 100644 (file)
@@ -795,7 +795,8 @@ static struct syscall_fmt {
        { .name     = "sendmsg",
          .arg = { [2] = { .scnprintf = SCA_MSG_FLAGS, /* flags */ }, }, },
        { .name     = "sendto",
-         .arg = { [3] = { .scnprintf = SCA_MSG_FLAGS, /* flags */ }, }, },
+         .arg = { [3] = { .scnprintf = SCA_MSG_FLAGS, /* flags */ },
+                  [4] = { .scnprintf = SCA_SOCKADDR, /* addr */ }, }, },
        { .name     = "set_tid_address", .errpid = true, },
        { .name     = "setitimer",
          .arg = { [0] = STRARRAY(which, itimers), }, },
index 71edb7ad86980a4965d8f9bd683d2e79b3de1d81..be06d2c9e8c91f48363698017a4095935ca2148a 100644 (file)
@@ -142,4 +142,17 @@ struct syscall_enter_connect_args {
 
 augmented_sockaddr_syscall_enter(connect);
 
+struct syscall_enter_sendto_args {
+       unsigned long long common_tp_fields;
+       long               syscall_nr;
+       long               fd;
+       void               *buff;
+       long               len;
+       unsigned long      flags;
+       struct sockaddr    *addr_ptr;
+       long               addr_len;
+};
+
+augmented_sockaddr_syscall_enter(sendto);
+
 license(GPL);