Re: integer overflow in bufinit() on large-memory machines

From: Kris Kennaway <kris_at_obsecurity.org>
Date: Tue, 20 Sep 2005 15:15:28 -0400
On Tue, Sep 20, 2005 at 12:57:40PM -0400, Kris Kennaway wrote:
> I have a sparc64 machine with 10GB of RAM that is hanging at boot in
> bufinit() (also seen on other sparc64 machines with more than this
> amount of RAM).  Instrumenting the code shows that it's happening
> here:
> 
> /*
>  * To support extreme low-memory systems, make sure hidirtybuffers cannot
>  * eat up all available buffer space.  This occurs when our minimum cannot
>  * be met.  We try to size hidirtybuffers to 3/4 our buffer space assuming
>  * BKVASIZE'd (8K) buffers.
>  */
>         while (hidirtybuffers * BKVASIZE > 3 * hibufspace / 4) {
>                 hidirtybuffers >>= 1;
>         }
>         lodirtybuffers = hidirtybuffers / 2;
> 
> because 3*hibufspace is overflowing the 32-bit int hibufspace (this
> code was added a few years ago by dillon).
> 
> hidirtybuffers=18182 BKVASIZE=16384 hibufspace=1189625856

BTW, on a 16gb amd64 machine I get this:

hidirtybuffers=3462, BKVASIZE=16384, hibufspace=224968704, 3 * hibufspace=674906112

so amd64 is not hitting the problem because it's sizing things very
differently.

Kris
Received on Tue Sep 20 2005 - 17:15:33 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:43 UTC