From: Joey Gouly <joey.gouly@arm.com>
To: Omar Sandoval <osandov@osandov.com>
Cc: linux-fsdevel@vger.kernel.org, Al Viro <viro@zeniv.linux.org.uk>,
Christian Brauner <brauner@kernel.org>,
kernel-team@fb.com, v9fs@lists.linux.dev,
David Howells <dhowells@redhat.com>,
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: Tue, 1 Oct 2024 10:47:47 +0100 [thread overview]
Message-ID: <20241001094747.GA1483717@e124191.cambridge.arm.com> (raw)
In-Reply-To: <cbaf141ba6c0e2e209717d02746584072844841a.1727722269.git.osandov@fb.com>
On Mon, Sep 30, 2024 at 11:55:00AM -0700, Omar Sandoval 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>
> ---
> lib/iov_iter.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/iov_iter.c b/lib/iov_iter.c
> index 97003155bfac..1abb32c0da50 100644
> --- a/lib/iov_iter.c
> +++ b/lib/iov_iter.c
> @@ -1033,7 +1033,7 @@ static ssize_t iter_folioq_get_pages(struct iov_iter *iter,
> if (maxpages == 0 || extracted >= maxsize)
> break;
>
> - if (offset >= fsize) {
> + if (iov_offset >= fsize) {
> iov_offset = 0;
> slot++;
> if (slot == folioq_nr_slots(folioq) && folioq->next) {
This fixes booting for me with my 9pfs rootfs. Tested on next-20241001+this patch.
Tested-by: Joey Gouly <joey.gouly@arm.com>
Thanks!
next prev parent reply other threads:[~2024-10-01 9:48 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
2024-10-01 9:47 ` Joey Gouly [this message]
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=20241001094747.GA1483717@e124191.cambridge.arm.com \
--to=joey.gouly@arm.com \
--cc=brauner@kernel.org \
--cc=chantr4@gmail.com \
--cc=dhowells@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.