Two bugs in kernel time code

Torsten Duwe (duwe@ns.lst.de)
Wed, 17 Sep 1997 00:47:54 +0200 (MEST)


Ulrich> There's a very old bug in the kernel that rarely occurs (who's
Ulrich> using NTP?): The code to update the CMOS clock does not consider
Ulrich> the hour field. I had no clever idea to fix it, so I simply added
Ulrich> a message to log the problem (well, a part of it).

Oh, no, please... If you have no clever idea to fix it -- a log message every
11 minutes ? This behaviour is _intentional_ -- I have no idea about the time
zone the RTC is running on, so hours are untouched. No one from a half-hour
or fifteen-minute time zone has complained yet :-|. A semi-clever approach
would be to watch warp_time() from outside and add the kernel time zone
conditionally.

Ulrich> In adjtimex() several parameters were not checked, making it
Ulrich> possibly to pass invalid values to the kernel. Also the plain old
Ulrich> adjtim() was dependent on the time_status & STA_PLL, which should
Ulrich> be completely independent of adjtimex() (ntp_adjtime).

Ulrich> Especially it was allowed to change the read-only bits of
Ulrich> time_status...

This however is a bug. Classic adjtime() shouldn't mess with the KPLL bits or
at least set them to a defined state. Please note that use of adjtime() and
ntp_adjtime() _*IS*_ exclusive for practical reasons. Note that adjtime() is
_not_ limited to half a second !

Ulrich> The function now even returns TIME_ERROR if the flags in
Ulrich> time_state indicate an error condition.

You have read RFC-1589 before doing modifications, haven't You ?

Ulrich> It should go into 2.1 as well I guess...

Please, work these suggestions into your patch, and maybe You can provide a
diff -Bub next time if You re-indent things ? TIA

Thanks a lot for your attention and work !

Torsten