Return to BSD News archive
Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!msuinfo!uwm.edu!lll-winken.llnl.gov!ames!newsfeed.gsfc.nasa.gov!news!kstailey From: kstailey@leidecker.gsfc.nasa.gov (Kenneth Stailey) Newsgroups: comp.os.386bsd.bugs Subject: NetBSD 1.0 fix 4 small primary swap Date: 29 Nov 1994 03:03:34 GMT Organization: NASA Goddard Space Flight Center -- Greenbelt, Maryland USA Lines: 29 Distribution: world Message-ID: <KSTAILEY.94Nov28220334@leidecker.gsfc.nasa.gov> NNTP-Posting-Host: leidecker.gsfc.nasa.gov Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit I have an 8MB primary swap & 16MB core, so if my system ever panics and dumps into it it will be truncated. There is a bug in the code that determines if the dump needs to be truncated. It bubbles up to the surface with this message at boot time: savecore: read: invalid argument It's a signed vs. unsigned comparison bug (very popular type, esp w/upgrades) in /usr/src/sys/arch/i386/i386 --- machdep.c.DIST Fri Oct 14 10:11:44 1994 +++ machdep.c Fri Nov 25 00:31:14 1994 @@ -783,7 +783,7 @@ dumplo &= ~(ctod(1)-1); /* If it does not fit, truncate it by moving dumplo. */ - if (dumplo < ctod(1)) { + if (dumplo < (long)(ctod(1))) { dumplo = ctod(1); dumpsize = dtoc(nblks - dumplo); } Since ctod() is typecast to unsigned, dumplo will be too! No warnings even! Since dumplo will start out negative, it will be huge when it becomes unsigned and the comparison will fail. Ken