Bug 32126 - readdir64_r: Do not skip entries with zero d_ino values
Summary: readdir64_r: Do not skip entries with zero d_ino values
Status: RESOLVED FIXED
Alias: None
Product: glibc
Classification: Unclassified
Component: libc (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: 2.41
Assignee: Florian Weimer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-08-30 06:53 UTC by Florian Weimer
Modified: 2024-09-21 17:38 UTC (History)
3 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 2024-08-30 06:53:49 UTC
This is the same bug as bug 12165, but for the 64-bit versions of readdir_r.

The d_ino == 0 check needs to be removed:

diff --git a/sysdeps/unix/sysv/linux/readdir64_r.c b/sysdeps/unix/sysv/linux/readdir64_r.c
index e87882ee06..168914ef67 100644
--- a/sysdeps/unix/sysv/linux/readdir64_r.c
+++ b/sysdeps/unix/sysv/linux/readdir64_r.c
@@ -95,10 +95,8 @@ __readdir64_r (DIR *dirp, struct dirent64 *entry, struct dirent64 **result)
 	      continue;
 	    }
 	}
-
-      /* Skip deleted and ignored files.  */
     }
-  while (dp->d_ino == 0);
+  while (0);
 
   if (dp != NULL)
     {
Comment 1 Sourceware Commits 2024-09-21 17:37:43 UTC
The master branch has been updated by Florian Weimer <fw@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=6f3f6c506cdaf981a4374f1f12863b98ac7fea1a

commit 6f3f6c506cdaf981a4374f1f12863b98ac7fea1a
Author: Florian Weimer <fweimer@redhat.com>
Date:   Sat Sep 21 19:32:34 2024 +0200

    Linux: readdir64_r should not skip d_ino == 0 entries (bug 32126)
    
    This is the same bug as bug 12165, but for readdir_r.  The
    regression test covers both bug 12165 and bug 32126.
    
    Reviewed-by: DJ Delorie <dj@redhat.com>
Comment 2 Florian Weimer 2024-09-21 17:38:07 UTC
Fixed for 2.41.