Date: Sun, 31 Dec 2000 17:26:07 +0100 From: alex@big.endian.de (Alexander Langer) To: audit@freebsd.org Subject: getnanouptime() patch Message-ID: <20001231172607.A175@cichlids.cichlids.com>
next in thread | raw e-mail | index | archive | help
Hello!
I have this old mail from BDE sitting here about the print_uptime()
bugs. One of these bugs is:
- the implementation is buggy. getnanouptime() accesses uninitialized
pointers when it is called before timecounters have been
initialized.
This causes recursive panics which lock up at least my systems (boot
with -d and decide you didn't want to boot this kernel after all,
and type "panic" at the debugger prompt -- this locks up the system).
The following patch to getnanouptime() should fix this.
I don't know what the KTR define is for, I stole this from another
function in the kern_tc.c file, which also handles uninitialized
pointer correctly.
Comments?
cvs diff: Diffing .
Index: kern_tc.c
===================================================================
RCS file: /usr/home/ncvs/src/sys/kern/kern_tc.c,v
retrieving revision 1.109
diff -u -r1.109 kern_tc.c
--- kern_tc.c 2000/09/07 01:32:51 1.109
+++ kern_tc.c 2000/12/31 16:23:27
@@ -188,6 +188,13 @@
ngetnanouptime++;
tc = timecounter;
+#ifdef KTR
+ if (tc == NULL) { /* called before initialization */
+ tsp->tv_sec = 0;
+ tsp->tv_nsec = 0;
+ return;
+ }
+#endif
tsp->tv_sec = tc->tc_offset_sec;
tsp->tv_nsec = tc->tc_offset_nano >> 32;
}
--
cat: /home/alex/.sig: No such file or directory
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-audit" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20001231172607.A175>
