Bug 19970 - readdir: Do not skip entries with zero d_ino values
Summary: readdir: Do not skip entries with zero d_ino values
Status: RESOLVED DUPLICATE of bug 12165
Alias: None
Product: glibc
Classification: Unclassified
Component: libc (show other bugs)
Version: 2.24
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-04-20 01:36 UTC by Florian Weimer
Modified: 2016-04-28 15:37 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:
fweimer: security-


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Florian Weimer 2016-04-20 01:36:12 UTC
According to this kernel commit, Linux did not treat d_ino == 0 as a special case, it is a valid inode number.  The commit does not change existing inode numbers, so we should still fix the glibc bug which causes it to skip directory entries with d_ino == 0.

commit 2adc376c551943a07170cbe70f43e6d6065f8906
Author: Carlos Maiolino <cmaiolino@redhat.com>
Date:   Thu Jun 25 12:25:58 2015 -0300

    vfs: avoid creation of inode number 0 in get_next_ino
    
    currently, get_next_ino() is able to create inodes with inode number = 0.
    This have a bad impact in the filesystems relying in this function to generate
    inode numbers.
    
    While there is no problem at all in having inodes with number 0, userspace tools
    which handle file management tasks can have problems handling these files, like
    for example, the impossiblity of users to delete these files, since glibc will
    ignore them. So, I believe the best way is kernel to avoid creating them.
    
    This problem has been raised previously, but the old thread didn't have any
    other update for a year+, and I've seen too many users hitting the same issue
    regarding the impossibility to delete files while using filesystems relying on
    this function. So, I'm starting the thread again, with the same patch
    that I believe is enough to address this problem.
    
    Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
    Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Comment 1 Paul Pluzhnikov 2016-04-22 03:57:12 UTC
I reported this only a few years ago:
https://sourceware.org/bugzilla/show_bug.cgi?id=12165

FWIW, Google carries a local patch to fix this.
Comment 2 Florian Weimer 2016-04-22 17:02:00 UTC
This was already reported in 2010.

*** This bug has been marked as a duplicate of bug 12165 ***