Sanity check for m_ialloc_blks in libxfs_mount()

"Marc Schönefeld"
2019-10-16T19:08:53Z

Hi all,

it looks like there is a sanity check missing for the divisor (m_ialloc_blks) in line 664 of xfsprogs-5.2.1/libxfs/init.c:
Program received signal SIGFPE, Arithmetic exception.

0x0000000000427ddf in libxfs_mount (mp=mp@entry=0x6a2de0 <xmount>, sb=sb@entry=0x6a2de0 <xmount>, dev=18446744073709551615,
logdev=<optimized out>, rtdev=<optimized out>, flags=flags@entry=1) at init.c:663

which is

663                 mp->m_maxicount = XFS_FSB_TO_INO(mp,
664                                 (mp->m_maxicount / mp->m_ialloc_blks) *
665                                  mp->m_ialloc_blks);

In case it would be required I have a reproducer file for this, which I can share via pm. The bug is reachable from user input via the "xfs_db -c _cmd_ _xfsfile_" command.

Sincerely
Marc Schoenefeld