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]
Date:   Mon, 7 Dec 2020 16:50:20 -0400
From:   Jason Gunthorpe <jgg@...pe.ca>
To:     Thomas Gleixner <tglx@...utronix.de>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        Alexandre Belloni <alexandre.belloni@...tlin.com>,
        Miroslav Lichvar <mlichvar@...hat.com>,
        John Stultz <john.stultz@...aro.org>,
        Prarit Bhargava <prarit@...hat.com>,
        Alessandro Zummo <a.zummo@...ertech.it>,
        linux-rtc@...r.kernel.org, Peter Zijlstra <peterz@...radead.org>
Subject: Re: [patch 3/8] rtc: cmos: Make rtc_cmos sync offset correct

On Sun, Dec 06, 2020 at 10:46:16PM +0100, Thomas Gleixner wrote:
> The offset for rtc_cmos must be -500ms to work correctly with the current
> implementation of rtc_set_ntp_time() due to the following:
> 
>   tsched       twrite(t2.tv_sec - 1) 	 t2 (seconds increment)
> 
> twrite - tsched is the transport time for the write to hit the device,
> which is negligible for this chip because it's accessed directly.
> 
> t2 - twrite = 500ms according to the datasheet.
> 
> But rtc_set_ntp_time() calculation of tsched is:
> 
>     tsched = t2 - 1sec - (t2 - twrite)
> 
> The default for the sync offset is 500ms which means that the write happens
> at t2 - 1.5 seconds which is obviously off by a second for this device.
> 
> Make the offset -500ms so it works correct.
> 
> Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
> ---
>  drivers/rtc/rtc-cmos.c |    3 +++
>  1 file changed, 3 insertions(+)

Reviewed-by: Jason Gunthorpe <jgg@...dia.com>

Matches what sync_cmos_clock() does at least.

My recollection is this change was not supposed to change anything, so
either I got things mixed up and this is wrong:

drivers/rtc/class.c:    rtc->set_offset_nsec =  NSEC_PER_SEC / 2;

Or it faithfully preserved some nonsense from before..

Jason

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ