Clock setting bug on current/i386 (patch available)
faber at ISI.EDU
Mon Apr 2 15:43:27 UTC 2007
I had a sort of wierd bug with the code in sys/i386/isa/clock.c that
sets the kernel clock from the realtime clock. The short story is in
The longer story is that my EPIA ME6000 clock seems to have the day of
the week wrong in its real time clock (RTC) and no way to adjust that
value. This shouldn't be a big deal, but the code that converts from
the RTC to seconds (clock_ct_to_ts() in sys/kern/subr_clock.c) checks
the day of the week value - unless it's set to -1 - though it isn't
used in the conversion. That code fails with an error if the day of the
week is wrong. The i386 clock-setting code doesn't check this return
value and the kernel time is set to whatever lucky value was on the
stack when the function was called.
There is much odd behavior on a box that thinks that the year is 1937.
newsyslog fails to parse configuration files, for example...
The PR has a few line patch to call clock_ct_to_ts() again with the day
of the week set to -1 if the function fails and the day of the week
wasn't -1. It prints some diagnostics to let a user know their clock
isn't set should none of that work. Feel free to clip the diagnostics,
but they would have saved me some time. :-)
It's a short patch. I'm sending this mail in the hope that some
committer will pop it in as an easy Monday morning thing.
http://www.isi.edu/~faber PGP: http://www.isi.edu/~faber/pubkeys.asc
Unexpected attachment on this mail? See http://www.isi.edu/~faber/FAQ.html#SIG
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-current/attachments/20070402/dc3dd3a5/attachment.pgp
More information about the freebsd-current