[Bug 254177] When ZFS is recognized, An i386 machine with a lot of memory hangs.

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Wed Mar 10 04:21:32 UTC 2021


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=254177

            Bug ID: 254177
           Summary: When ZFS is recognized, An i386 machine with a lot of
                    memory hangs.
           Product: Base System
           Version: 13.0-STABLE
          Hardware: i386
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: bugs at FreeBSD.org
          Reporter: btrenchd at yahoo.co.jp

When ZFS is recognized, An i386 machine with a lot of memory hangs on FreeBSD
13.0-RC1 (git 60e8939aa85b07f3271dcc01730727dda04c8bf6).

It  occurs on line 799th of /usr/src/sys/contrib/openzfs/module/zfs/dbuf.c 

        while (hsize * zfs_arc_average_blocksize < physmem * PAGESIZE)
                hsize <<= 1;

My machine has 24GB of memory,  so `physmem' is 0x59B9AD and `PAGESIZE' is
0x1000, but `physmem * PAGESIZE'  overflows to 0x9B9AD000.  Then the condition
of the while statement may always be true, and this statement goes into an
eternal loop.



To fix that immediately, that line will be changed to

        while (hsize * zfs_arc_average_blocksize < (uint64_t)physmem *
PAGESIZE)

or

        while (hsize / PAGESIZE * zfs_arc_average_blocksize < physmem)

On the other hand, that problem comes from the type of the variable `physmem'
which is declared on line 65th of /usr/src/sys/sys/systm.h for kernel,

extern long physmem;            /* physical memory */

and on line 54th of  /usr/src/sys/contrib/openzfs/lib/libzpool/kernel.c for
userland.

uint64_t physmem;

That problem does not occur on amd64, because the sizeof(long) is different.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list