unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Florian Weimer via Libc-alpha <libc-alpha@sourceware.org>
To: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Cc: James Clarke <jrtc27@debian.org>,
	Adhemerval Zanella via Libc-alpha <libc-alpha@sourceware.org>,
	John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Subject: Re: [PATCH v2 4/9] linux: Use getdents64 on non-LFS readdir
Date: Mon, 19 Oct 2020 22:50:45 +0200	[thread overview]
Message-ID: <87blgy6iu2.fsf@oldenburg2.str.redhat.com> (raw)
In-Reply-To: <902d1573-3a8f-dbad-9e3f-78f98744d362@linaro.org> (Adhemerval Zanella's message of "Mon, 19 Oct 2020 17:00:41 -0300")

* Adhemerval Zanella:

> On 19/10/2020 05:18, Florian Weimer wrote:
>> * Adhemerval Zanella:
>> 
>>> Using a single allocation make the code slight faster (which not sure if
>>> plays much difference since a lot of memory copy would be required for 
>>> non-LFS) and it does not require to handle the possible reallocation
>>> failure on readdir.
>> 
>> But you'd still have to handle the case where name is longer than the
>> allocation, to avoid a buffer overflow.  So an error case still exists.
>> 
>> Thanks,
>> Florian
>
> The dirstream_ret_entry already handles it by returning EOVERFLOW for such
> case.  Also keep in mind this limitation is only for the old non-LFS
> interface, for the LFS one it will use all the available allocated buffer
> created by the opendir (it still have the 32kb limit for getdents64 call).
> I can add a more complex buffer handling to resize the auxiliary buffer,
> but I am not sure it really pays of the complexity.

Hmm.  The error code should be ENAMETOOLONG.  Ideally, it should be
delayed until the end of the stream, so that the rest of the directory
can be listed (similar to what we do for readdir_r).  It's probably okay
to report an ENOMEM failure immediately.

Anyway, I'll look at the overflow check and see if we can move this
forward, and then revisit the translation buffer allocation in a
separate patch.

Thanks,
Florian
-- 
Red Hat GmbH, https://de.redhat.com/ , Registered seat: Grasbrunn,
Commercial register: Amtsgericht Muenchen, HRB 153243,
Managing Directors: Charles Cachera, Brian Klemm, Laurie Krebs, Michael O'Neill


  reply	other threads:[~2020-10-19 20:50 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-02 17:06 [PATCH v2 0/9] Fix getdents{64} regression on some FS Adhemerval Zanella via Libc-alpha
2020-10-02 17:06 ` [PATCH v2 1/9] linux: Move posix dir implementations to Linux Adhemerval Zanella via Libc-alpha
2020-10-13 15:33   ` Florian Weimer via Libc-alpha
2020-10-15 14:08     ` Adhemerval Zanella via Libc-alpha
2020-10-02 17:06 ` [PATCH v2 2/9] linux: Simplify opendir buffer allocation Adhemerval Zanella via Libc-alpha
2020-10-13 15:34   ` Florian Weimer via Libc-alpha
2020-10-02 17:06 ` [PATCH v2 3/9] linux: Add __readdir_unlocked Adhemerval Zanella via Libc-alpha
2020-10-13 15:43   ` Florian Weimer via Libc-alpha
2020-10-15 14:10     ` Adhemerval Zanella via Libc-alpha
2020-10-02 17:06 ` [PATCH v2 4/9] linux: Use getdents64 on non-LFS readdir Adhemerval Zanella via Libc-alpha
2020-10-13 15:59   ` Florian Weimer via Libc-alpha
2020-10-15 14:25     ` Adhemerval Zanella via Libc-alpha
2020-10-19  8:18       ` Florian Weimer via Libc-alpha
2020-10-19 20:00         ` Adhemerval Zanella via Libc-alpha
2020-10-19 20:50           ` Florian Weimer via Libc-alpha [this message]
2020-10-19 21:09             ` Adhemerval Zanella via Libc-alpha
2020-10-20  7:38               ` Florian Weimer via Libc-alpha
2020-10-20 12:05                 ` Adhemerval Zanella via Libc-alpha
2020-10-20 12:35                   ` Florian Weimer via Libc-alpha
2020-10-20 14:09                     ` Adhemerval Zanella via Libc-alpha
2020-10-20 17:42                     ` Adhemerval Zanella via Libc-alpha
2020-10-02 17:06 ` [PATCH v2 5/9] linux: Set internal DIR filepos as off64_t [BZ #23960, BZ #24050] Adhemerval Zanella via Libc-alpha
2020-10-13 16:00   ` Florian Weimer via Libc-alpha
2020-10-15 14:26     ` Adhemerval Zanella via Libc-alpha
2020-10-02 17:06 ` [PATCH v2 6/9] linux: Add __readdir64_unlocked Adhemerval Zanella via Libc-alpha
2020-10-02 17:06 ` [PATCH v2 7/9] linux: Add __old_readdir64_unlocked Adhemerval Zanella via Libc-alpha
2020-10-02 17:06 ` [PATCH v2 8/9] linux: Use getdents64 on readdir64 compat implementation Adhemerval Zanella via Libc-alpha
2020-10-02 17:06 ` [PATCH v2 9/9] dirent: Deprecate getdirentries Adhemerval Zanella via Libc-alpha
2020-10-04 13:08 ` [PATCH v2 0/9] Fix getdents{64} regression on some FS Dave Flogeras via Libc-alpha

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/libc/involved.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87blgy6iu2.fsf@oldenburg2.str.redhat.com \
    --to=libc-alpha@sourceware.org \
    --cc=adhemerval.zanella@linaro.org \
    --cc=fweimer@redhat.com \
    --cc=glaubitz@physik.fu-berlin.de \
    --cc=jrtc27@debian.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).