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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-99a9dc98ba52267ce5e062b52de88ea1f1b2a7d8@git.kernel.org>
Date:   Sun, 14 Jan 2018 02:46:49 -0800
From:   tip-bot for Peter Zijlstra <tipbot@...or.com>
To:     linux-tip-commits@...r.kernel.org
Cc:     hpa@...or.com, linux-kernel@...r.kernel.org, tglx@...utronix.de,
        mingo@...nel.org, peterz@...radead.org, vince@...ter.net,
        vincent.weaver@...ne.edu, alexander.shishkin@...ux.intel.com,
        robert@...ecki.net
Subject: [tip:x86/pti] x86,perf: Disable intel_bts when PTI

Commit-ID:  99a9dc98ba52267ce5e062b52de88ea1f1b2a7d8
Gitweb:     https://git.kernel.org/tip/99a9dc98ba52267ce5e062b52de88ea1f1b2a7d8
Author:     Peter Zijlstra <peterz@...radead.org>
AuthorDate: Sun, 14 Jan 2018 11:27:13 +0100
Committer:  Thomas Gleixner <tglx@...utronix.de>
CommitDate: Sun, 14 Jan 2018 11:42:10 +0100

x86,perf: Disable intel_bts when PTI

The intel_bts driver does not use the 'normal' BTS buffer which is exposed
through the cpu_entry_area but instead uses the memory allocated for the
perf AUX buffer.

This obviously comes apart when using PTI because then the kernel mapping;
which includes that AUX buffer memory; disappears. Fixing this requires to
expose a mapping which is visible in all context and that's not trivial.

As a quick fix disable this driver when PTI is enabled to prevent
malfunction.

Fixes: 385ce0ea4c07 ("x86/mm/pti: Add Kconfig")
Reported-by: Vince Weaver <vincent.weaver@...ne.edu>
Reported-by: Robert Święcki <robert@...ecki.net>
Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
Cc: Alexander Shishkin <alexander.shishkin@...ux.intel.com>
Cc: greg@...ah.com
Cc: hughd@...gle.com
Cc: luto@...capital.net
Cc: Vince Weaver <vince@...ter.net>
Cc: torvalds@...ux-foundation.org
Cc: stable@...r.kernel.org
Link: https://lkml.kernel.org/r/20180114102713.GB6166@worktop.programming.kicks-ass.net

---
 arch/x86/events/intel/bts.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/arch/x86/events/intel/bts.c b/arch/x86/events/intel/bts.c
index 141e07b..24ffa1e 100644
--- a/arch/x86/events/intel/bts.c
+++ b/arch/x86/events/intel/bts.c
@@ -582,6 +582,24 @@ static __init int bts_init(void)
 	if (!boot_cpu_has(X86_FEATURE_DTES64) || !x86_pmu.bts)
 		return -ENODEV;
 
+	if (boot_cpu_has(X86_FEATURE_PTI)) {
+		/*
+		 * BTS hardware writes through a virtual memory map we must
+		 * either use the kernel physical map, or the user mapping of
+		 * the AUX buffer.
+		 *
+		 * However, since this driver supports per-CPU and per-task inherit
+		 * we cannot use the user mapping since it will not be availble
+		 * if we're not running the owning process.
+		 *
+		 * With PTI we can't use the kernal map either, because its not
+		 * there when we run userspace.
+		 *
+		 * For now, disable this driver when using PTI.
+		 */
+		return -ENODEV;
+	}
+
 	bts_pmu.capabilities	= PERF_PMU_CAP_AUX_NO_SG | PERF_PMU_CAP_ITRACE |
 				  PERF_PMU_CAP_EXCLUSIVE;
 	bts_pmu.task_ctx_nr	= perf_sw_context;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ