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:   Sun, 26 Apr 2020 04:35:21 +0300
From:   Leonid Bloch <lb.workbox@...il.com>
To:     linux-kernel@...r.kernel.org
Cc:     John Stultz <john.stultz@...aro.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Stephen Boyd <sboyd@...nel.org>,
        Leonid Bloch <lb.workbox@...il.com>
Subject: [PATCH] rtc: Do not sync CMOS clock when CONFIG_RTC_SYSTOHC is not set

According to documentation in 'drivers/rtc/Kconfig', if
'CONFIG_RTC_SYSTOHC' is set, then:

'''
The system time (wall clock) will be stored in the RTC specified by
RTC_HCTOSYS_DEVICE approximately every 11 minutes if userspace reports
synchronized NTP status.
'''

However in reality, even if 'CONFIG_RTC_SYSTOHC' is not set, the RTC
is still sometimes synced with the system time: at least when the RTC
driver is 'rtc_cmos', in certain situations. This commit prevents that.

Signed-off-by: Leonid Bloch <lb.workbox@...il.com>
---
 kernel/time/ntp.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c
index 069ca78fb0bf..58260ca75c64 100644
--- a/kernel/time/ntp.c
+++ b/kernel/time/ntp.c
@@ -535,9 +535,6 @@ static void sync_rtc_clock(void)
 	struct timespec64 adjust, now;
 	int rc;
 
-	if (!IS_ENABLED(CONFIG_RTC_SYSTOHC))
-		return;
-
 	ktime_get_real_ts64(&now);
 
 	adjust = now;
@@ -613,6 +610,9 @@ static bool sync_cmos_clock(void)
  */
 static void sync_hw_clock(struct work_struct *work)
 {
+	if (!IS_ENABLED(CONFIG_RTC_SYSTOHC))
+		return;
+
 	if (!ntp_synced())
 		return;
 
-- 
2.26.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ