mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: John Hubbard <jhubbard@nvidia.com>
Cc: dhowells@redhat.com, David Hildenbrand <david@redhat.com>,
	syzbot <syzbot+a440341a59e3b7142895@syzkaller.appspotmail.com>,
	hch@lst.de, linux-kernel@vger.kernel.org,
	syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] general protection fault in skb_dequeue (3)
Date: Fri, 03 Feb 2023 16:23:59 +0000	[thread overview]
Message-ID: <2112099.1675441439@warthog.procyon.org.uk> (raw)
In-Reply-To: <2076817.1675434996@warthog.procyon.org.uk>

David Howells <dhowells@redhat.com> wrote:

> I think I have managed to isolate the bug to the read side of sendfile() or
> the pipe in the middle by the following:

I did something similar in iov_iter_extract_pipe_pages(), allocating a
permanent page there:

+	mutex_lock(&extract_tmp_lock);
+	if (!extract_tmp) {
+		pr_notice("alloc extract_tmp\n");
+		extract_tmp = alloc_page(GFP_USER);
+		if (extract_tmp) {
+			SetPageDebugMark(extract_tmp);
+			page_ref_add(extract_tmp, 200);
+		}
+	}
+	mutex_unlock(&extract_tmp_lock);
+	if (!extract_tmp)
+		return -ENOMEM;

and then subbing that for the returned page:

 		chunk = min_t(size_t, left, PAGE_SIZE - offset);
 		left -= chunk;
-		*p++ = page;
+		//*p++ = page;
+		*p++ = extract_tmp;

That makes the oopses stop happening.  Pages are still being added to the pipe
at one end and being removed at the other.

So I'm guessing a DMA happens to the destination buffer for the DIO read after
it has been released.

David


  parent reply	other threads:[~2023-02-03 16:25 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
2023-02-03  8:36     ` David Howells
2023-02-03 14:36     ` David Howells
2023-02-03 16:23     ` David Howells [this message]
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=2112099.1675441439@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=david@redhat.com \
    --cc=hch@lst.de \
    --cc=jhubbard@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --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

Powered by JetHome