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: <20171205213414.14641-1-andi@firstfloor.org>
Date:   Tue,  5 Dec 2017 13:34:14 -0800
From:   Andi Kleen <andi@...stfloor.org>
To:     acme@...nel.org
Cc:     linux-kernel@...r.kernel.org, Andi Kleen <ak@...ux.intel.com>,
        jolsa@...nel.org
Subject: [PATCH] perf, tools: Fix perf stat for old kernels w/o PERF_SAMPLE_IDENTIFIER

From: Andi Kleen <ak@...ux.intel.com>

PERF_SAMPLE_IDENTIFIER is a newer kernel feature and not available
on old kernels. Since 4979d0c7d0c7 ("perf stat record: Add record command")
we set it unconditionally for perf stat, which makes perf stat
show all counters as "not supported" on a 3.0 kernel.

Make it conditional on perf stat record. So at least normal perf
stat works again on 3.0, just not record.

Fixes: 4979d0c7d0c7 ("perf stat record: Add record command")
Cc: jolsa@...nel.org
Signed-off-by: Andi Kleen <ak@...ux.intel.com>
---
 tools/perf/builtin-stat.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 69523ed55894..b1bc77cfecbb 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -240,12 +240,15 @@ static int create_perf_stat_counter(struct perf_evsel *evsel)
 	 * But set sample_type to PERF_SAMPLE_IDENTIFIER, which should be harmless
 	 * while avoiding that older tools show confusing messages.
 	 *
+	 * Avoid doing this for non record because it doesn't work
+	 * on old enough kernels.
+	 *
 	 * However for pipe sessions we need to keep it zero,
 	 * because script's perf_evsel__check_attr is triggered
 	 * by attr->sample_type != 0, and we can't run it on
 	 * stat sessions.
 	 */
-	if (!(STAT_RECORD && perf_stat.file.is_pipe))
+	if (STAT_RECORD && !perf_stat.file.is_pipe)
 		attr->sample_type = PERF_SAMPLE_IDENTIFIER;
 
 	/*
-- 
2.13.6

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ