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: <20260123231521.790598171@kernel.org>
Date: Sat, 24 Jan 2026 00:17:55 +0100
From: Thomas Gleixner <tglx@...nel.org>
To: LKML <linux-kernel@...r.kernel.org>
Cc: "Paul E. McKenney" <paulmck@...nel.org>,
 John Stultz <jstultz@...gle.com>,
 Waiman Long <longman@...hat.com>,
 Peter Zijlstra <peterz@...radead.org>,
 Daniel Lezcano <daniel.lezcano@...aro.org>,
 Stephen Boyd <sboyd@...nel.org>,
 x86@...nel.org,
 "Gautham R. Shenoy" <gautham.shenoy@....com>,
 Jiri Wiesner <jwiesner@...e.de>,
 Daniel J Blueman <daniel@...ra.org>,
 Scott Hamilton <scott.hamilton@...den.com>,
 Helge Deller <deller@....de>,
 linux-parisc@...r.kernel.org,
 Thomas Bogendoerfer <tsbogend@...ha.franken.de>,
 linux-mips@...r.kernel.org
Subject: [patch 3/5] x86/tsc: Handle CLOCK_SOURCE_VALID_FOR_HRES correctly

Unconditionally setting the CLOCK_SOURCE_VALID_FOR_HRES for the real TSC
clocksource is wrong as there is no guarantee that the early TSC was
validated for high resolution mode.

Set the flag only when the early TSC was validated as otherwise the
clocksource selection might enable high resolution mode with a TSC of
unknown quality and possibly no way to back out once it is discovered to be
unsuitable.

Signed-off-by: Thomas Gleixner <tglx@...nel.org>
Cc: x86@...nel.org
---
 arch/x86/kernel/tsc.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -1193,7 +1193,6 @@ static struct clocksource clocksource_ts
 	.read			= read_tsc,
 	.mask			= CLOCKSOURCE_MASK(64),
 	.flags			= CLOCK_SOURCE_IS_CONTINUOUS |
-				  CLOCK_SOURCE_VALID_FOR_HRES |
 				  CLOCK_SOURCE_MUST_VERIFY |
 				  CLOCK_SOURCE_VERIFY_PERCPU,
 	.id			= CSID_X86_TSC,
@@ -1403,6 +1402,15 @@ static void tsc_refine_calibration_work(
 		have_art = true;
 		clocksource_tsc.base = &art_base_clk;
 	}
+
+	/*
+	 * Transfer the valid for high resolution flag if it was set on the
+	 * early TSC already. That guarantees that there is no intermediate
+	 * clocksource selected once the early TSC is unregistered.
+	 */
+	if (clocksource_tsc_early.flags & CLOCK_SOURCE_VALID_FOR_HRES)
+		clocksource_tsc.flags |= CLOCK_SOURCE_VALID_FOR_HRES;
+
 	clocksource_register_khz(&clocksource_tsc, tsc_khz);
 unreg:
 	clocksource_unregister(&clocksource_tsc_early);


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ