lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <tip-lqag8e86ybidrh5zpqne05ov@git.kernel.org>
Date:   Thu, 20 Jul 2017 01:44:23 -0700
From:   tip-bot for Arnaldo Carvalho de Melo <tipbot@...or.com>
To:     linux-tip-commits@...r.kernel.org
Cc:     namhyung@...nel.org, linux-kernel@...r.kernel.org,
        mingo@...nel.org, jolsa@...nel.org, tglx@...utronix.de,
        dsahern@...il.com, acme@...hat.com, wangnan0@...wei.com,
        hpa@...or.com, adrian.hunter@...el.com
Subject: [tip:perf/core] perf trace beauty: Give syscall return beautifier
 more context

Commit-ID:  7ee5743404e3641f3c11792761632a5a7d583587
Gitweb:     http://git.kernel.org/tip/7ee5743404e3641f3c11792761632a5a7d583587
Author:     Arnaldo Carvalho de Melo <acme@...hat.com>
AuthorDate: Fri, 14 Jul 2017 15:16:54 -0300
Committer:  Arnaldo Carvalho de Melo <acme@...hat.com>
CommitDate: Tue, 18 Jul 2017 23:14:02 -0300

perf trace beauty: Give syscall return beautifier more context

We need the current thread and the trace internal state so that we can
use the fd beautifier to augment syscall returns, so use struct
syscall_arg with some fields that make sense on returns (val, thread,
trace).

Cc: Adrian Hunter <adrian.hunter@...el.com>
Cc: David Ahern <dsahern@...il.com>
Cc: Jiri Olsa <jolsa@...nel.org>
Cc: Namhyung Kim <namhyung@...nel.org>
Cc: Wang Nan <wangnan0@...wei.com>
Link: http://lkml.kernel.org/n/tip-lqag8e86ybidrh5zpqne05ov@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
 tools/perf/builtin-trace.c           | 11 ++++++++---
 tools/perf/trace/beauty/beauty.h     |  5 ++++-
 tools/perf/trace/beauty/fcntl.c      |  9 +++++++--
 tools/perf/trace/beauty/open_flags.c |  5 +----
 4 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index d48981c..cfa8bf1 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -918,7 +918,7 @@ struct thread_trace {
 	unsigned long	  pfmaj, pfmin;
 	char		  *entry_str;
 	double		  runtime_ms;
-	size_t		  (*ret_scnprintf)(unsigned long value, char *bf, size_t size);
+	size_t		  (*ret_scnprintf)(char *bf, size_t size, struct syscall_arg *arg);
         struct {
 		unsigned long ptr;
 		short int     entry_str_pos;
@@ -971,7 +971,7 @@ fail:
 
 
 void syscall_arg__set_ret_scnprintf(struct syscall_arg *arg,
-				    size_t (*ret_scnprintf)(unsigned long val, char *bf, size_t size))
+				    size_t (*ret_scnprintf)(char *bf, size_t size, struct syscall_arg *arg))
 {
 	struct thread_trace *ttrace = thread__priv(arg->thread);
 
@@ -1726,7 +1726,12 @@ signed_print:
 		fprintf(trace->output, ") = 0 Timeout");
 	else if (ttrace->ret_scnprintf) {
 		char bf[1024];
-		ttrace->ret_scnprintf(ret, bf, sizeof(bf));
+		struct syscall_arg arg = {
+			.val	= ret,
+			.thread	= thread,
+			.trace	= trace,
+		};
+		ttrace->ret_scnprintf(bf, sizeof(bf), &arg);
 		ttrace->ret_scnprintf = NULL;
 		fprintf(trace->output, ") = %s", bf);
 	} else if (sc->fmt->hexret)
diff --git a/tools/perf/trace/beauty/beauty.h b/tools/perf/trace/beauty/beauty.h
index a9613d2..b64c411 100644
--- a/tools/perf/trace/beauty/beauty.h
+++ b/tools/perf/trace/beauty/beauty.h
@@ -46,6 +46,9 @@ size_t syscall_arg__scnprintf_fcntl_cmd(char *bf, size_t size, struct syscall_ar
 size_t syscall_arg__scnprintf_fcntl_arg(char *bf, size_t size, struct syscall_arg *arg);
 #define SCA_FCNTL_ARG syscall_arg__scnprintf_fcntl_arg
 
+size_t syscall_arg__scnprintf_open_flags(char *bf, size_t size, struct syscall_arg *arg);
+#define SCA_OPEN_FLAGS syscall_arg__scnprintf_open_flags
+
 size_t syscall_arg__scnprintf_statx_flags(char *bf, size_t size, struct syscall_arg *arg);
 #define SCA_STATX_FLAGS syscall_arg__scnprintf_statx_flags
 
@@ -55,6 +58,6 @@ size_t syscall_arg__scnprintf_statx_mask(char *bf, size_t size, struct syscall_a
 size_t open__scnprintf_flags(unsigned long flags, char *bf, size_t size);
 
 void syscall_arg__set_ret_scnprintf(struct syscall_arg *arg,
-				    size_t (*ret_scnprintf)(unsigned long val, char *bf, size_t size));
+				    size_t (*ret_scnprintf)(char *bf, size_t size, struct syscall_arg *arg));
 
 #endif /* _PERF_TRACE_BEAUTY_H */
diff --git a/tools/perf/trace/beauty/fcntl.c b/tools/perf/trace/beauty/fcntl.c
index 384f177..9de80a7 100644
--- a/tools/perf/trace/beauty/fcntl.c
+++ b/tools/perf/trace/beauty/fcntl.c
@@ -15,14 +15,19 @@ static size_t fcntl__scnprintf_getfd(unsigned long val, char *bf, size_t size)
 	return scnprintf(bf, size, "%s", val ? "CLOEXEC" : "0");
 }
 
+static size_t syscall_arg__scnprintf_fcntl_getfd(char *bf, size_t size, struct syscall_arg *arg)
+{
+	return fcntl__scnprintf_getfd(arg->val, bf, size);
+}
+
 size_t syscall_arg__scnprintf_fcntl_cmd(char *bf, size_t size, struct syscall_arg *arg)
 {
 	if (arg->val == F_GETFL) {
-		syscall_arg__set_ret_scnprintf(arg, open__scnprintf_flags);
+		syscall_arg__set_ret_scnprintf(arg, syscall_arg__scnprintf_open_flags);
 		goto mask_arg;
 	}
 	if (arg->val == F_GETFD) {
-		syscall_arg__set_ret_scnprintf(arg, fcntl__scnprintf_getfd);
+		syscall_arg__set_ret_scnprintf(arg, syscall_arg__scnprintf_fcntl_getfd);
 		goto mask_arg;
 	}
 	/*
diff --git a/tools/perf/trace/beauty/open_flags.c b/tools/perf/trace/beauty/open_flags.c
index 3c20683..e359e04 100644
--- a/tools/perf/trace/beauty/open_flags.c
+++ b/tools/perf/trace/beauty/open_flags.c
@@ -73,7 +73,7 @@ size_t open__scnprintf_flags(unsigned long flags, char *bf, size_t size)
 	return printed;
 }
 
-static size_t syscall_arg__scnprintf_open_flags(char *bf, size_t size, struct syscall_arg *arg)
+size_t syscall_arg__scnprintf_open_flags(char *bf, size_t size, struct syscall_arg *arg)
 {
 	int flags = arg->val;
 
@@ -82,6 +82,3 @@ static size_t syscall_arg__scnprintf_open_flags(char *bf, size_t size, struct sy
 
 	return open__scnprintf_flags(flags, bf, size);
 }
-
-
-#define SCA_OPEN_FLAGS syscall_arg__scnprintf_open_flags

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ