statvfs is broken in uclibc/head

Bernhard Reutner-Fischer rep.dot.nop at gmail.com
Mon Jan 21 09:41:20 UTC 2013


On 20 January 2013 03:51, Anthony G. Basile <basile at opensource.dyc.edu> wrote:
> Hi Bernhard,
>
> Following your "statfs: support f_frsize" commit a couple of days ago,
> statvfs is broken.  Here's a little poc:
>
> #include <sys/statvfs.h>
> int main() {
>         struct statvfs mystat;
>         statvfs("/usr/portage/distfiles", &mystat);
>         return 0;
> }
>
> which dies with
>
> *** stack smashing detected ***: ./poc terminated
> Killed
>
> Looks like buf->__f_spare is not getting properly zeroed at line 48 of
> libc/misc/statfs/internal_statvfs.c.  Reverting to 6 ints fixes it:

except that the struct is 5 nowadays, not 6. I'll play with the alignment..
>
> -  memset (buf->__f_spare, '\0', sizeof(fsbuf.f_spare));
> +  memset (buf->__f_spare, '\0', 6 * sizeof(int));

Thanks for the heads-up though.
cheers,


More information about the uClibc mailing list