On Sat, Jun 09, 2007 at 01:56:35PM -0700, Ed Ravin wrote: > > I encountered the problem in NetBSD's scandir(), when reading off > a Solaris NFS fileserver with ZFS filesystems. I've already filed a > bug report with NetBSD. They were using the st_size, divided by 24, to > determine how much memory to allocate with malloc() before reading in > the directory entries. All without any sanity checking.
Ah, so the original bug should never been filed against our scandir(3c), which is resilient to this type of failure. > I've found other programs that make similar assumptions, including > the hard-coding of "24" instead of "sizeof dirent". Yikes. Even on a 'normal' filesystem, what happens if entries are added to a directory in the middle of such an operation? > What was the reason to make ZFS use directory sizes as the number of > entries rather than the way other Unix filesystems use it? I seem to recall some discussion about it, but maybe someone else on the team has a better memory than me ;-) - Eric -- Eric Schrock, Solaris Kernel Development http://blogs.sun.com/eschrock _______________________________________________ zfs-discuss mailing list zfs-discuss@opensolaris.org http://mail.opensolaris.org/mailman/listinfo/zfs-discuss