Date: Mon, 1 Jan 2001 13:34:38 +0100 From: Alexander Langer <alex@big.endian.de> To: arch@freebsd.org Subject: (fwd) getnanouptime() patch Message-ID: <20010101133438.A4214@cichlids.cichlids.com>
next in thread | raw e-mail | index | archive | help
[per suggestion by Chris Faulhaber, I'm forwarding this to -arch] 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? I just noted, that this patch must be applied to the getmicrouptime() function as well. Diff _not_ included. 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 ----- End forwarded message ----- -- cat: /home/alex/.sig: No such file or directory To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010101133438.A4214>