On Wed, Jan 24, 2024 at 10:55 PM Eugeniu Rosca <erosca@xxxxxxxxxxxxxx> wrote: > > Hello Greg, > Hello Filipe, > > On Sun, Aug 13, 2023 at 12:34:08PM +0100, fdmanana@xxxxxxxxxx wrote: > > From: Filipe Manana <fdmanana@xxxxxxxx> > > > > 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? As mentioned in another thread, here's the backport for 5.15 stable along with other needed patches: https://lore.kernel.org/linux-btrfs/cover.1706183427.git.fdmanana@xxxxxxxx/ > > [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