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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-9e3b6ec17374299516d83c2e36135b958a895aa3@git.kernel.org>
Date:	Thu, 2 Apr 2015 22:08:03 -0700
From:	tip-bot for Yunlong Song <tipbot@...or.com>
To:	linux-tip-commits@...r.kernel.org
Cc:	paulus@...ba.org, acme@...hat.com, hpa@...or.com,
	tglx@...utronix.de, wangnan0@...wei.com, mingo@...nel.org,
	yunlong.song@...wei.com, linux-kernel@...r.kernel.org,
	a.p.zijlstra@...llo.nl
Subject: [tip:perf/core] perf evlist:
  Support using -f to override perf.data file ownership

Commit-ID:  9e3b6ec17374299516d83c2e36135b958a895aa3
Gitweb:     http://git.kernel.org/tip/9e3b6ec17374299516d83c2e36135b958a895aa3
Author:     Yunlong Song <yunlong.song@...wei.com>
AuthorDate: Thu, 2 Apr 2015 21:47:10 +0800
Committer:  Arnaldo Carvalho de Melo <acme@...hat.com>
CommitDate: Thu, 2 Apr 2015 13:18:45 -0300

perf evlist: Support using -f to override perf.data file ownership

Enable perf evlist to use perf.data when it is not owned by current user
or root.

Example:

 # perf record ls
 # chown Yunlong.Song:Yunlong.Song perf.data
 # ls -al perf.data
 -rw------- 1 Yunlong.Song Yunlong.Song 28260 Apr  2 10:18 perf.data
 # id
 uid=0(root) gid=0(root) groups=0(root),64(pkcs11)

Before this patch:

 # perf evlist
 File perf.data not owned by current user or root (use -f to override)
 # perf evlist -f
   Error: unknown switch `f'

  usage: perf evlist [<options>]

     -i, --input <file>    Input file name
     -F, --freq            Show the sample frequency
     -v, --verbose         Show all event attr details
     -g, --group           Show event group information

As shown above, the -f option does not work at all.

After this patch:

 # perf evlist
 File perf.data not owned by current user or root (use -f to override)
 # perf evlist -f
 cycles

As shown above, the -f option really works now.

Signed-off-by: Yunlong Song <yunlong.song@...wei.com>
Tested-by: Arnaldo Carvalho de Melo <acme@...hat.com>
Cc: Paul Mackerras <paulus@...ba.org>
Cc: Peter Zijlstra <a.p.zijlstra@...llo.nl>
Cc: Wang Nan <wangnan0@...wei.com>
Link: http://lkml.kernel.org/r/1427982439-27388-2-git-send-email-yunlong.song@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
 tools/perf/builtin-evlist.c | 2 ++
 tools/perf/util/evsel.h     | 1 +
 2 files changed, 3 insertions(+)

diff --git a/tools/perf/builtin-evlist.c b/tools/perf/builtin-evlist.c
index 0f93f85..695ec5a 100644
--- a/tools/perf/builtin-evlist.c
+++ b/tools/perf/builtin-evlist.c
@@ -24,6 +24,7 @@ static int __cmd_evlist(const char *file_name, struct perf_attr_details *details
 	struct perf_data_file file = {
 		.path = file_name,
 		.mode = PERF_DATA_MODE_READ,
+		.force = details->force,
 	};
 
 	session = perf_session__new(&file, 0, NULL);
@@ -47,6 +48,7 @@ int cmd_evlist(int argc, const char **argv, const char *prefix __maybe_unused)
 		    "Show all event attr details"),
 	OPT_BOOLEAN('g', "group", &details.event_group,
 		    "Show event group information"),
+	OPT_BOOLEAN('f', "force", &details.force, "don't complain, do it"),
 	OPT_END()
 	};
 	const char * const evlist_usage[] = {
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h
index dcf202a..c5a43d6 100644
--- a/tools/perf/util/evsel.h
+++ b/tools/perf/util/evsel.h
@@ -335,6 +335,7 @@ struct perf_attr_details {
 	bool freq;
 	bool verbose;
 	bool event_group;
+	bool force;
 };
 
 int perf_evsel__fprintf(struct perf_evsel *evsel,
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ