statvfs is broken in uclibc/head

Anthony G. Basile basile at opensource.dyc.edu
Sun Jan 20 02:51:13 UTC 2013


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:

-  memset (buf->__f_spare, '\0', sizeof(fsbuf.f_spare));
+  memset (buf->__f_spare, '\0', 6 * sizeof(int));


-- 
Anthony G. Basile, Ph. D.
Chair of Information Technology
D'Youville College
Buffalo, NY 14201
(716) 829-8197


More information about the uClibc mailing list