Subject: Re: bin/19852: Potential problem with dump and large amount of memory
To: None <gnats-admin@netbsd.org, netbsd-bugs@netbsd.org>
From: Christian Biere <christianbiere@gmx.de>
List: netbsd-bugs
Date: 09/10/2005 18:22:01
The following reply was made to PR bin/19852; it has been noted by GNATS.
From: Christian Biere <christianbiere@gmx.de>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: bin/19852: Potential problem with dump and large amount of memory
Date: Sat, 10 Sep 2005 20:21:12 +0200
Manuel Bouyer wrote:
> On Tue, Jan 14, 2003 at 11:54:29PM +0100, Christian Biere wrote:
> > /usr/src/sbin/dump/rcache.c:
> >
> > static int cachebufs;
Note that "cachebufs" is still of type "int" in the current code.
> > void
> > initcache(int cachesize, int readblksize)
> > {
> > size_t len;
> > size_t sharedSize;
> >
> > nblksread = (readblksize + ufsib->ufs_bsize - 1) / ufsib->ufs_bsize;
> > if(cachesize == -1) { /* Compute from memory available */
> > int usermem;
> > int mib[2] = { CTL_HW, HW_USERMEM };
They type of "usermem" is not "uint64_t" and "HW_USERMEM" was replaced
with "HW_USERMEM64". I'm not 100% certain but to me it looks like
"cachebufs" could *still* be negative on a system with a sufficiently
high amount of RAM i.e., several Gigabyte which is certainly not unlikely
on 64-bit server machines. Even if that's unlikely now, it's a time bomb.
> Well, HW_USERMEM is really returning an int.
> It looks like we need to redefine these sysctls.
HW_USERMEM64 was introduced but this fix is most-likely incomplete
as explained above.
--
Christian