Re: [PATCH] vfs: fix statfs64() returning impossible EOVERFLOW for 64-bit f_files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Oct 5, 2017 at 1:57 PM, Al Viro <viro@xxxxxxxxxxxxxxxxxx> wrote:
>
> AFAICS, the real bug here is in hugetlbfs; that's where obscene values in
> ->f_bsize come from.  IMO all that code in put_compat_statfs64() should be
> replaced with
>         if (kbuf->bsize != (u32)kbuf->bsize)
>                 return -EOVERFLOW;
> That, or hugetlbfs could be taught to fake saner ->f_bsize (recalculating
> ->f_bavail/->f_bfree/->f_blocks to go with that).

Make it so. Except you shouldn't do

     if (kbuf->bsize != (u32)kbuf->bsize)

you should do something like

    #define FITS_IN(x,y)  ({ typeof x __x = (x); typeof y __y = __x;
__x == __y; })

and then do

    if (!FITS_IN(kbuf->bsize, ubuf->bsize)) ...

because there is nothing that specifies that the ubuf size of all
fields has to be 32 bits.

But yes,m either you need to then special-case that crazy all-ones
value, or just fix hugetlbfs to not use crazy crap.

                  Linus



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux