From: Leon Romanovsky <leon@kernel.org>
To: David Howells <dhowells@redhat.com>,
Christian Brauner <brauner@kernel.org>
Cc: Omar Sandoval <osandov@osandov.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>
Subject: Re: [PATCH] iov_iter: fix advancing slot in iter_folioq_get_pages()
Date: Tue, 1 Oct 2024 08:52:54 +0300 [thread overview]
Message-ID: <20241001055254.GC459313@unreal> (raw)
In-Reply-To: <3011076.1727727002@warthog.procyon.org.uk>
On Mon, Sep 30, 2024 at 09:10:02PM +0100, David Howells wrote:
> 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>
It worked for me too.
Tested-by: Leon Romanovsky <leon@kernel.org>
Thanks
next prev parent reply other threads:[~2024-10-01 5:52 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
2024-10-01 5:52 ` Leon Romanovsky [this message]
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=20241001055254.GC459313@unreal \
--to=leon@kernel.org \
--cc=brauner@kernel.org \
--cc=chantr4@gmail.com \
--cc=dhowells@redhat.com \
--cc=eddyz87@gmail.com \
--cc=kernel-team@fb.com \
--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