Linux 9p file system development
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: Omar Sandoval <osandov@osandov.com>,
	Christian Brauner <brauner@kernel.org>
Cc: dhowells@redhat.com, linux-fsdevel@vger.kernel.org,
	Al Viro <viro@zeniv.linux.org.uk>,
	kernel-team@fb.com, v9fs@lists.linux.dev,
	Manu Bretelle <chantr4@gmail.com>,
	Eduard Zingerman <eddyz87@gmail.com>,
	Leon Romanovsky <leon@kernel.org>
Subject: Re: [PATCH] iov_iter: fix advancing slot in iter_folioq_get_pages()
Date: Mon, 30 Sep 2024 21:10:02 +0100	[thread overview]
Message-ID: <3011076.1727727002@warthog.procyon.org.uk> (raw)
In-Reply-To: <cbaf141ba6c0e2e209717d02746584072844841a.1727722269.git.osandov@fb.com>

Omar Sandoval <osandov@osandov.com> wrote:

> From: Omar Sandoval <osandov@fb.com>
> 
> iter_folioq_get_pages() decides to advance to the next folioq slot when
> it has reached the end of the current folio. However, it is checking
> offset, which is the beginning of the current part, instead of
> iov_offset, which is adjusted to the end of the current part, so it
> doesn't advance the slot when it's supposed to. As a result, on the next
> iteration, we'll use the same folio with an out-of-bounds offset and
> return an unrelated page.
> 
> This manifested as various crashes and other failures in 9pfs in drgn's
> VM testing setup and BPF CI.
> 
> Fixes: db0aa2e9566f ("mm: Define struct folio_queue and ITER_FOLIOQ to handle a sequence of folios")
> Link: https://lore.kernel.org/linux-fsdevel/20240923183432.1876750-1-chantr4@gmail.com/
> Tested-by: Manu Bretelle <chantr4@gmail.com>
> Signed-off-by: Omar Sandoval <osandov@fb.com>

Thanks for finding that!  That would explain why I didn't see it with afs or
cifs - both of those pass the iterator directly to the socket rather than
pulling the pages out of it.  I'm not sure how I managed to do things like run
xfstests to completion and git clone and build a kernel without encountering
the bug.

Christian: Can you add this to vfs.fixes and tag it:

Acked-by: David Howells <dhowells@redhat.com>
Tested-by: Eduard Zingerman <eddyz87@gmail.com>


  parent reply	other threads:[~2024-09-30 20:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-30 18:55 [PATCH] iov_iter: fix advancing slot in iter_folioq_get_pages() Omar Sandoval
2024-09-30 19:27 ` Eduard Zingerman
2024-09-30 20:10 ` David Howells [this message]
2024-10-01  5:52   ` Leon Romanovsky
2024-10-01  9:47 ` Joey Gouly
2024-10-01  9:50 ` Christian Brauner

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=3011076.1727727002@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=brauner@kernel.org \
    --cc=chantr4@gmail.com \
    --cc=eddyz87@gmail.com \
    --cc=kernel-team@fb.com \
    --cc=leon@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=osandov@osandov.com \
    --cc=v9fs@lists.linux.dev \
    --cc=viro@zeniv.linux.org.uk \
    /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