The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: liuhuan01@kylinos.cn
Cc: cem@kernel.org, djwong@kernel.org, linux-xfs@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1] xfs: prevent readdir infinite loop with billions subdirs
Date: Mon, 11 Aug 2025 03:36:51 -0700	[thread overview]
Message-ID: <aJnHw78dwyEL4F7U@infradead.org> (raw)
In-Reply-To: <20250801084145.501276-1-liuhuan01@kylinos.cn>

On Fri, Aug 01, 2025 at 04:41:46PM +0800, liuhuan01@kylinos.cn wrote:
> From: liuh <liuhuan01@kylinos.cn>
> 
> When a directory contains billions subdirs, readdir() repeatedly
> got same data and goes to infinate loop.
> The root cause is that the pos gets truncated during assignment.
> Fix it.

This got added in:

15440319767942a363f282d6585303d3d75088ba
Author: Christoph Hellwig <hch@infradead.org>
Date:   Thu Jan 8 14:00:00 2009 -0500

    [XFS] truncate readdir offsets to signed 32 bit values

I promised to come up with something better back them, but I could for
the fear of my life not remember what that would be.

I guess the most compatible thing we could do would be to make the
truncation dependent on is_compat_task().  You'd still get the same
issue on 32-bit systems, but I don't really see what else we could
do for them.


  reply	other threads:[~2025-08-11 10:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-01  8:41 [PATCH v1] xfs: prevent readdir infinite loop with billions subdirs liuhuan01
2025-08-11 10:36 ` Christoph Hellwig [this message]
2025-08-12  0:22 ` Dave Chinner

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=aJnHw78dwyEL4F7U@infradead.org \
    --to=hch@infradead.org \
    --cc=cem@kernel.org \
    --cc=djwong@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=liuhuan01@kylinos.cn \
    /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