From: John Hubbard <jhubbard@nvidia.com>
To: David Howells <dhowells@redhat.com>,
David Hildenbrand <david@redhat.com>
Cc: syzbot <syzbot+a440341a59e3b7142895@syzkaller.appspotmail.com>,
<davem@davemloft.net>, <edumazet@google.com>, <hch@lst.de>,
<johannes@sipsolutions.net>, <kuba@kernel.org>,
<linux-kernel@vger.kernel.org>, <linux-wireless@vger.kernel.org>,
<netdev@vger.kernel.org>, <pabeni@redhat.com>,
<syzkaller-bugs@googlegroups.com>
Subject: Re: [syzbot] general protection fault in skb_dequeue (3)
Date: Thu, 2 Feb 2023 18:54:54 -0800 [thread overview]
Message-ID: <72029a93-1150-1994-916f-b15ef0befd49@nvidia.com> (raw)
In-Reply-To: <1265629.1675350909@warthog.procyon.org.uk>
On 2/2/23 07:15, David Howells wrote:
> David Hildenbrand <david@redhat.com> wrote:
>
>> At first, I wondered if that's related to shared anonymous pages getting
>> pinned R/O that would trigger COW-unsharing ... but I don't even see where we
>> are supposed to use FOLL_PIN vs. FOLL_GET here? IOW, we're not even supposed
>> to access user space memory (neither FOLL_GET nor FOLL_PIN) but still end up
>> with a change in behavior.
>
> I'm not sure that using FOLL_PIN is part of the problem here.
I agree. It's really not.
>
> sendfile() is creating a transient buffer attached to a pipe, doing a DIO read
> into it (which uses iov_iter_extract_pages() to populate a bio) and then feeds
> the pages from the pipe one at a time using a BVEC-type iterator to a buffered
> write.
>
> Note that iov_iter_extract_pages() does not pin/get pages when accessing a
> BVEC, KVEC, XARRAY or PIPE iterator. However, in this case, this should not
> matter as the pipe is holding refs on the pages in the buffer.
>
> I have found that the issue goes away if I add an extra get_page() into
> iov_iter_extract_pipe_pages() and don't release it (the page is then leaked).
>
> This makes me think that the problem might be due to the pages getting
> recycled from the pipe before DIO has finished writing to them - but that
> shouldn't be the case as the splice has to be synchronous - we can't mark data
> in the pipe as 'produced' until we've finished reading it.
So I thought about this for a while, and one really big glaring point
that stands out for me is: before this commit, we had this:
iov_iter_get_pages()
__iov_iter_get_pages_alloc()
pipe_get_pages()
get_page()
But now, based on the claim from various folks that "pipe cases don't
require a get_page()", we have boldly--too boldy, I believe-- moved
directly into case that doesn't do a get_page():
iov_iter_extract_pipe_pages()
...(nothing)
And your testing backs this up: adding the get_page() back hides the
failure.
So that's as far as I've got, but I am really suspecting that this is
where the root cause is: pipe references are not as locked down as we
think they are. At least in this case.
thanks,
--
John Hubbard
NVIDIA
next prev parent reply other threads:[~2023-02-03 2:55 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-01 10:04 syzbot
2023-02-02 8:52 ` David Howells
2023-02-02 9:02 ` David Hildenbrand
2023-02-02 15:15 ` David Howells
2023-02-03 2:54 ` John Hubbard [this message]
2023-02-03 8:36 ` David Howells
2023-02-03 14:36 ` David Howells
2023-02-03 16:23 ` David Howells
2023-02-03 16:27 ` How does ftruncate() interact with DIO read? David Howells
2023-02-03 16:31 ` Christoph Hellwig
2023-02-03 16:30 ` [syzbot] general protection fault in skb_dequeue (3) David Howells
2023-02-02 23:10 ` John Hubbard
2023-02-07 11:22 ` David Howells
2023-02-07 12:29 ` syzbot
[not found] <20230201115301.463-1-hdanton@sina.com>
2023-02-01 15:15 ` syzbot
[not found] <20230201233913.650-1-hdanton@sina.com>
2023-02-02 5:53 ` syzbot
[not found] <20230207095807.1448-1-hdanton@sina.com>
2023-02-07 10:24 ` syzbot
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=72029a93-1150-1994-916f-b15ef0befd49@nvidia.com \
--to=jhubbard@nvidia.com \
--cc=davem@davemloft.net \
--cc=david@redhat.com \
--cc=dhowells@redhat.com \
--cc=edumazet@google.com \
--cc=hch@lst.de \
--cc=johannes@sipsolutions.net \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=syzbot+a440341a59e3b7142895@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.com \
/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
all inboxes | Powered by JetHome®