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] [day] [month] [year] [list]
Date:   Wed, 11 Jan 2017 07:46:01 -0800
From:   tip-bot for Colin King <tipbot@...or.com>
To:     linux-tip-commits@...r.kernel.org
Cc:     tglx@...utronix.de, colin.king@...onical.com, mingo@...nel.org,
        peterz@...radead.org, kan.liang@...el.com,
        linux-kernel@...r.kernel.org, alexander.shishkin@...ux.intel.com,
        ak@...ux.intel.com, eranian@...gle.com, hpa@...or.com
Subject: [tip:perf/urgent] perf/x86/intel: Use ULL constant to prevent
 undefined shift behaviour

Commit-ID:  ad5013d5699d30ded0cdbbc68b93b2aa28222c6e
Gitweb:     http://git.kernel.org/tip/ad5013d5699d30ded0cdbbc68b93b2aa28222c6e
Author:     Colin King <colin.king@...onical.com>
AuthorDate: Wed, 11 Jan 2017 11:43:10 +0000
Committer:  Thomas Gleixner <tglx@...utronix.de>
CommitDate: Wed, 11 Jan 2017 16:43:30 +0100

perf/x86/intel: Use ULL constant to prevent undefined shift behaviour

When x86_pmu.num_counters is 32 the shift of the integer constant 1 is
exceeding 32bit and therefor undefined behaviour.

Fix this by shifting 1ULL instead of 1.

Reported-by: CoverityScan CID#1192105 ("Bad bit shift operation")
Signed-off-by: Colin Ian King <colin.king@...onical.com>
Cc: Andi Kleen <ak@...ux.intel.com>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Kan Liang <kan.liang@...el.com>
Cc: Stephane Eranian <eranian@...gle.com>
Cc: Alexander Shishkin <alexander.shishkin@...ux.intel.com>
Link: http://lkml.kernel.org/r/20170111114310.17928-1-colin.king@canonical.com
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
---
 arch/x86/events/intel/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c
index 8613826..d611cab 100644
--- a/arch/x86/events/intel/core.c
+++ b/arch/x86/events/intel/core.c
@@ -3987,7 +3987,7 @@ __init int intel_pmu_init(void)
 		     x86_pmu.num_counters, INTEL_PMC_MAX_GENERIC);
 		x86_pmu.num_counters = INTEL_PMC_MAX_GENERIC;
 	}
-	x86_pmu.intel_ctrl = (1 << x86_pmu.num_counters) - 1;
+	x86_pmu.intel_ctrl = (1ULL << x86_pmu.num_counters) - 1;
 
 	if (x86_pmu.num_counters_fixed > INTEL_PMC_MAX_FIXED) {
 		WARN(1, KERN_ERR "hw perf events fixed %d > max(%d), clipping!",

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ