* [PATCH 0/2] hwclock: Fix excessive adjustment
@ 2014-05-05 18:49 Stanislav Brabec
2014-05-06 10:56 ` Karel Zak
0 siblings, 1 reply; 2+ messages in thread
From: Stanislav Brabec @ 2014-05-05 18:49 UTC (permalink / raw)
To: util-linux
Algorithm of calculation of hwclock adjustment is vulnerable to
miscalculations. These miscalculations may lead to clock drifting by
many years even after fixing CMOS hwclock failure.
Following two patches are attempts to solve the most visible parts of
the problem:
- Calculation of excessive drift values in /etc/adjtime
- Applying of excessive drift that causes many years clock failure.
- It also prevents hangs before 4a44a54b.
There are further poor places in the code that are above the scope of
this patch set:
- Algorithm for detecting of invalid hwclock is very poor (valid_p fails
only if hwclock output fails to pass mktime()).
- There is no or failing discrimination between fine time adjustment and
clock set.
- In particular, proposed patch does not cover miscalculation while
changing clock due to DST change, and more than 2 days passed since
last adjustment. This could be covered by lowering of MAX_DRIFT, but
heuristics for discrimination between adjustment and clock setting
would be much better.
- Most of failures fixed by these patches were hidden by a poor
calculation of time passed since last adjustment:
if ((hclocktime - adjtime_p->last_calib_time) < 23 * 60 * 60)
(As there is no abs(), all times in past were considered as "less than
one day ago".)
--
Best Regards / S pozdravem,
Stanislav Brabec
software developer
---------------------------------------------------------------------
SUSE LINUX, s. r. o. e-mail: sbrabec@suse.cz
Lihovarská 1060/12 tel: +49 911 7405384547
190 00 Praha 9 fax: +420 284 084 001
Czech Republic http://www.suse.cz/
PGP: 830B 40D5 9E05 35D8 5E27 6FA3 717C 209F A04F CD76
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH 0/2] hwclock: Fix excessive adjustment
2014-05-05 18:49 [PATCH 0/2] hwclock: Fix excessive adjustment Stanislav Brabec
@ 2014-05-06 10:56 ` Karel Zak
0 siblings, 0 replies; 2+ messages in thread
From: Karel Zak @ 2014-05-06 10:56 UTC (permalink / raw)
To: Stanislav Brabec; +Cc: util-linux
On Mon, May 05, 2014 at 08:49:01PM +0200, Stanislav Brabec wrote:
> Algorithm of calculation of hwclock adjustment is vulnerable to
> miscalculations. These miscalculations may lead to clock drifting by
> many years even after fixing CMOS hwclock failure.
>
> Following two patches are attempts to solve the most visible parts of
> the problem:
> - Calculation of excessive drift values in /etc/adjtime
> - Applying of excessive drift that causes many years clock failure.
> - It also prevents hangs before 4a44a54b.
Applied, thanks.
> There are further poor places in the code that are above the scope of
> this patch set:
> - Algorithm for detecting of invalid hwclock is very poor (valid_p fails
> only if hwclock output fails to pass mktime()).
> - There is no or failing discrimination between fine time adjustment and
> clock set.
> - In particular, proposed patch does not cover miscalculation while
> changing clock due to DST change, and more than 2 days passed since
> last adjustment. This could be covered by lowering of MAX_DRIFT, but
> heuristics for discrimination between adjustment and clock setting
> would be much better.
> - Most of failures fixed by these patches were hidden by a poor
> calculation of time passed since last adjustment:
> if ((hclocktime - adjtime_p->last_calib_time) < 23 * 60 * 60)
> (As there is no abs(), all times in past were considered as "less than
> one day ago".)
Look forward to see another patches ;-)
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-05-06 10:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-05 18:49 [PATCH 0/2] hwclock: Fix excessive adjustment Stanislav Brabec
2014-05-06 10:56 ` Karel Zak
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox