lkml.org 
[lkml]   [2017]   [Oct]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] vfs: fix statfs64() returning impossible EOVERFLOW for 64-bit f_files
On Thu, Oct 5, 2017 at 1:57 PM, Al Viro <viro@zeniv.linux.org.uk> 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

\
 
 \ /
  Last update: 2017-10-06 00:32    [W:0.048 / U:4.860 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site