linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eugeniu Rosca <erosca@de.adit-jv.com>
To: <fdmanana@kernel.org>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: <linux-btrfs@vger.kernel.org>, <stable@vger.kernel.org>,
	Maksim Paimushkin <Maksim.Paimushkin@se.bosch.com>,
	Matthias Thomae <Matthias.Thomae@de.bosch.com>,
	Sebastian Unger <Sebastian.Unger@bosch.com>,
	Dirk Behme <Dirk.Behme@de.bosch.com>,
	Eugeniu Rosca <Eugeniu.Rosca@bosch.com>,
	Eugeniu Rosca <erosca@de.adit-jv.com>,
	Eugeniu Rosca <roscaeugeniu@gmail.com>
Subject: Re: [PATCH] btrfs: fix infinite directory reads
Date: Wed, 24 Jan 2024 23:55:22 +0100	[thread overview]
Message-ID: <20240124225522.GA2614102@lxhi-087> (raw)
In-Reply-To: <c9ceb0e15d92d0634600603b38965d9b6d986b6d.1691923900.git.fdmanana@suse.com>

Hello Greg,
Hello Filipe,

On Sun, Aug 13, 2023 at 12:34:08PM +0100, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
> 
> The readdir implementation currently processes always up to the last index
> it finds. This however can result in an infinite loop if the directory has
> a large number of entries such that they won't all fit in the given buffer
> passed to the readdir callback, that is, dir_emit() returns a non-zero
> value. Because in that case readdir() will be called again and if in the
> meanwhile new directory entries were added and we still can't put all the
> remaining entries in the buffer, we keep repeating this over and over.
> 
> The following C program and test script reproduce the problem:

This crucial fix successfully landed into vanilla v6.5 [1] and stable
v6.4.12 [2], but unfortunately not into the older stable trees.

Consequently, the fix is missing on the popular Ubuntu versions like
20.04 (KNL v5.15.x) and 22.04.3 (KNL v6.2.x). For that reason, people
still experience infinite loops when building Linux on those systems.

To overcome the issue, people fall back to workarounds [3-4].

The patch seems to apply cleanly to v6.2, but not to v5.15
(v5.15 backport attempt failed miserably).

Is there a chance for:
 - Stable maintainers to accept the clean backport to v6.2?
 - BTRFS experts to suggest a conflict resolution for v5.15?

[1] https:// git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=9b378f6ad48cfa
[2] https:// git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=5441532ffc9c8c
[3] https:// android-review.googlesource.com/c/kernel/build/+/2708835
[4] https:// android-review.googlesource.com/c/kernel/build/+/2715296

Best Regards
Eugeniu

  parent reply	other threads:[~2024-01-24 23:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-13 11:34 [PATCH] btrfs: fix infinite directory reads fdmanana
2023-08-13 18:23 ` Filipe Manana
2023-08-14 14:18 ` David Sterba
2024-01-24 22:55 ` Eugeniu Rosca [this message]
2024-01-25 12:04   ` Filipe Manana

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

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

  git send-email \
    --in-reply-to=20240124225522.GA2614102@lxhi-087 \
    --to=erosca@de.adit-jv.com \
    --cc=Dirk.Behme@de.bosch.com \
    --cc=Eugeniu.Rosca@bosch.com \
    --cc=Maksim.Paimushkin@se.bosch.com \
    --cc=Matthias.Thomae@de.bosch.com \
    --cc=Sebastian.Unger@bosch.com \
    --cc=fdmanana@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=roscaeugeniu@gmail.com \
    --cc=stable@vger.kernel.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 NNTP newsgroup(s).