From owner-freebsd-arch Mon Jan 1 4:34:41 2001 From owner-freebsd-arch@FreeBSD.ORG Mon Jan 1 04:34:39 2001 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mailout00.sul.t-online.com (mailout00.sul.t-online.com [194.25.134.16]) by hub.freebsd.org (Postfix) with ESMTP id 6942937B400 for ; Mon, 1 Jan 2001 04:34:38 -0800 (PST) Received: from fwd04.sul.t-online.com by mailout00.sul.t-online.com with smtp id 14D4Af-0000z9-02; Mon, 01 Jan 2001 13:34:37 +0100 Received: from neutron.cichlids.com (520050424122-0001@[62.225.194.113]) by fmrl04.sul.t-online.com with esmtp id 14D4Ab-0UN4uuC; Mon, 1 Jan 2001 13:34:33 +0100 Received: from cichlids.cichlids.com (cichlids.cichlids.com [192.168.0.10]) by neutron.cichlids.com (Postfix) with ESMTP id B5DF2AB0C for ; Mon, 1 Jan 2001 13:35:05 +0100 (CET) Received: by cichlids.cichlids.com (Postfix, from userid 1001) id 5C25314AF8; Mon, 1 Jan 2001 13:34:38 +0100 (CET) Date: Mon, 1 Jan 2001 13:34:38 +0100 From: Alexander Langer To: arch@freebsd.org Subject: (fwd) getnanouptime() patch Message-ID: <20010101133438.A4214@cichlids.cichlids.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i X-PGP-Fingerprint: 44 28 CA 4C 46 5B D3 A8 A8 E3 BA F3 4E 60 7D 7F X-PGP-at: finger alex@big.endian.de X-Verwirrung: Dieser Header dient der allgemeinen Verwirrung. X-Sender: 520050424122-0001@t-dialin.net Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG [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