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-next>] [day] [month] [year] [list]
Date:	Mon,  4 Apr 2016 06:12:54 -0700
From:	kan.liang@...el.com
To:	acme@...nel.org
Cc:	jolsa@...hat.com, ak@...ux.intel.com,
	alexander.shishkin@...ux.intel.com, linux-kernel@...r.kernel.org,
	Kan Liang <kan.liang@...el.com>
Subject: [PATCH 1/1] perf tools: Fix format value calculation

From: Kan Liang <kan.liang@...el.com>

The calculation of format value also rely on the continuity of the
format. However, uncore event format is not continuous.
E.g. The bit 21 as qpi event is lost.

perf stat -a -e uncore_qpi_0/event=0x200038,config1=0x1C00,
config2=0x3FE00/ -vvv
------------------------------------------------------------
perf_event_attr:
  type                             10
  size                             112
  config                           0x38



This patch checks the bit according to the bit position.

Signed-off-by: Kan Liang <kan.liang@...el.com>
---
 tools/perf/util/pmu.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
index bf34468..47c096c 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -586,14 +586,14 @@ __u64 perf_pmu__format_bits(struct list_head *formats, const char *name)
 static void pmu_format_value(unsigned long *format, __u64 value, __u64 *v,
 			     bool zero)
 {
-	unsigned long fbit, vbit;
+	unsigned long fbit;
 
-	for (fbit = 0, vbit = 0; fbit < PERF_PMU_FORMAT_BITS; fbit++) {
+	for (fbit = 0; fbit < PERF_PMU_FORMAT_BITS; fbit++) {
 
 		if (!test_bit(fbit, format))
 			continue;
 
-		if (value & (1llu << vbit++))
+		if (value & (1llu << fbit))
 			*v |= (1llu << fbit);
 		else if (zero)
 			*v &= ~(1llu << fbit);
-- 
2.5.5

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ