mbox series

[v3,0/7] Fix getdents{64} regression on some FS

Message ID 20201021141542.2003377-1-adhemerval.zanella@linaro.org
Headers show
Series Fix getdents{64} regression on some FS | expand

Message

Adhemerval Zanella Oct. 21, 2020, 2:15 p.m. UTC
This is updated version [1], rebased against master add with some
suggestion from previous review.  The main changes are:

  - The translation buffer is allocated as an auxiliarry one (instead
    of a reserved spacefrom the dirstream) and readdir might reallocate
    it if it finds a large entry.

  - Failures in non-LFS readdir (such as d_ino/d_off overflow or failure
    in expand the translation buffer) is ignored.  This allows code that
    does not handle possible failure in readdir to successful read the
    rest of entries in the directory.

  - So minor fixes in dirent/tst-seekdir2.c

  - Added __attribute_deprecated_msg__ on getdirentries to redirect to
    getdents64.

I have checked on x86_64-linux-gnu, powerpc64-linux-gnu and on some
32-bit ABIs arm-linux-gnueabihf, powerpc-linux-gnu, and sparcv9-linux-gnu.


[1] https://sourceware.org/pipermail/libc-alpha/2020-October/118274.html

Adhemerval Zanella (7):
  linux: Do not skip entries with zero d_ino values [BZ #12165]
  linux: Use getdents64 on non-LFS readdir
  linux: Set internal DIR filepos as off64_t [BZ #23960, BZ #24050]
  linux: Add __readdir64_unlocked
  linux: Add __old_readdir64_unlocked
  linux: Use getdents64 on readdir64 compat implementation
  dirent: Deprecate getdirentries

 NEWS                                  |   3 +
 dirent/Makefile                       |   2 +-
 dirent/dirent.h                       |  14 +-
 dirent/tst-seekdir2.c                 | 158 +++++++++++++++++++++
 include/dirent.h                      |   1 +
 sysdeps/unix/sysv/linux/Makefile      |   3 +
 sysdeps/unix/sysv/linux/closedir.c    |   8 ++
 sysdeps/unix/sysv/linux/dirstream.h   |  11 +-
 sysdeps/unix/sysv/linux/getdents64.c  |  93 ------------
 sysdeps/unix/sysv/linux/olddirent.h   |   4 +-
 sysdeps/unix/sysv/linux/opendir.c     |  37 +++++
 sysdeps/unix/sysv/linux/readdir.c     |  83 +++++++----
 sysdeps/unix/sysv/linux/readdir64.c   | 196 +++++++++++++++-----------
 sysdeps/unix/sysv/linux/readdir64_r.c | 159 +++++----------------
 sysdeps/unix/sysv/linux/rewinddir.c   |   5 +
 sysdeps/unix/sysv/linux/seekdir.c     |  36 ++++-
 sysdeps/unix/sysv/linux/telldir.c     |  47 +++++-
 sysdeps/unix/sysv/linux/telldir.h     |  64 +++++++++
 18 files changed, 583 insertions(+), 341 deletions(-)
 create mode 100644 dirent/tst-seekdir2.c
 create mode 100644 sysdeps/unix/sysv/linux/telldir.h