Date: Mon, 2 Apr 2007 08:33:21 -0700 From: Ted Faber <faber@ISI.EDU> To: current@freebsd.org Subject: Clock setting bug on current/i386 (patch available) Message-ID: <20070402153321.GC97955@hut.isi.edu>
next in thread | raw e-mail | index | archive | help
--jousvV0MzM2p6OtC Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi. 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=20 http://www.freebsd.org/cgi/query-pr.cgi?pr=3D111117 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. Thanks! --=20 Ted Faber 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 --jousvV0MzM2p6OtC Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.3 (FreeBSD) iD8DBQFGESJBaUz3f+Zf+XsRAoa0AJ0RCyIr7swIQW2G72RzQeFXtCdDxACggd19 lVNlNRZw6ICIsHY6AwTjQZ8= =lfEN -----END PGP SIGNATURE----- --jousvV0MzM2p6OtC--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070402153321.GC97955>