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]
Message-ID: <20210519092349.513729-1-hejingxian@huawei.com>
Date:   Wed, 19 May 2021 17:23:49 +0800
From:   Jingxian He <hejingxian@...wei.com>
To:     <tglx@...utronix.de>, <mingo@...hat.com>, <bp@...en8.de>,
        <x86@...nel.org>, <linux-kernel@...r.kernel.org>, <hpa@...or.com>
CC:     <hejie3@...wei.com>, <hewenliang4@...wei.com>,
        <wuxu.wu@...wei.com>, <hejingxian@...wei.com>
Subject: [PATCH] rtc: Fix hwclock write fail problem in x86 arch

When RTC_ALWAYS_BCD is set as 1, the function mc146818_set_time
ignores the reading value of RTC_CONTROL register,
and assumes that RTC always operates in binary mode.

However, the mc146818 development manual says that:
if !(CMOS_READ(RTC_CONTROL) & 0x04), then
the rtc time is in binary mode;
if (CMOS_READ(RTC_CONTROL) & 0x04), then
the rtc time is in bcd mode.

We use 'hwclock -w' to set the RTC from the system time
at our x86 machines, and we find that when 
(CMOS_READ(RTC_CONTROL) & 0x04) is equal to 1,
'hwclock -w' will fail to set the RTC.

We change the RTC_ALWAYS_BCD to 0 to parse the rtc
time according to the read value of RTC_CONTROL register.

Signed-off-by: Jingxian He <hejingxian@...wei.com>
Signed-off-by: Jie He <hejie3@...wei.com>
---
 arch/x86/include/asm/mc146818rtc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/mc146818rtc.h b/arch/x86/include/asm/mc146818rtc.h
index 9719800..63cf0d5 100644
--- a/arch/x86/include/asm/mc146818rtc.h
+++ b/arch/x86/include/asm/mc146818rtc.h
@@ -10,7 +10,7 @@
 
 #ifndef RTC_PORT
 #define RTC_PORT(x)	(0x70 + (x))
-#define RTC_ALWAYS_BCD	1	/* RTC operates in binary mode */
+#define RTC_ALWAYS_BCD	0
 #endif
 
 #if defined(CONFIG_X86_32)
-- 
2.9.5

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ