mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hillf Danton <hdanton@sina.com>
To: syzbot <syzbot+9f9a7f73fb079b2387a6@syzkaller.appspotmail.com>
Cc: David Hildenbrand <david@redhat.com>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	syzkaller-bugs@googlegroups.com,
	Matthew Wilcox <willy@infradead.org>
Subject: Re: [syzbot] [mm?] kernel BUG in const_folio_flags (2)
Date: Thu, 28 Nov 2024 21:03:40 +0800	[thread overview]
Message-ID: <20241128130340.2021-1-hdanton@sina.com> (raw)
In-Reply-To: <27bc1008-dce1-4fad-9142-0b74069da4d9@redhat.com>

On Thu, 28 Nov 2024 13:23:15 +0100 David Hildenbrand <david@redhat.com>
> 
> Ah, now I get it; at the point int time we check it actually isn't in 
> the pagecache anymore. We perform a folio_test_locked() check before the 
> folio_try_get(), which is wrong as the folio can get freed+reallocated 
> in the meantime.
> 
> The easy fix would be:

#syz test

--- x/mm/filemap.c
+++ y/mm/filemap.c
@@ -3502,10 +3502,10 @@ static struct folio *next_uptodate_folio
 			continue;
 		if (xa_is_value(folio))
 			continue;
-		if (folio_test_locked(folio))
-			continue;
 		if (!folio_try_get(folio))
 			continue;
+		if (folio_test_locked(folio))
+			goto skip;
 		/* Has the page moved or been split? */
 		if (unlikely(folio != xas_reload(xas)))
 			goto skip;
--

  reply	other threads:[~2024-11-28 13:03 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-23  7:31 syzbot
2024-11-25  6:56 ` Suraj Sonawane
2024-11-25  6:58   ` syzbot
2024-11-25  7:16 ` Suraj Sonawane
2024-11-25  7:18   ` syzbot
2024-11-25  7:37 ` Suraj Sonawane
2024-11-25  7:39   ` syzbot
2024-11-25  7:53 ` Suraj Sonawane
2024-11-25  7:55   ` syzbot
2024-11-25  7:57 ` Suraj Sonawane
2024-11-25  7:59   ` syzbot
2024-11-25 13:12 ` Suraj Sonawane
2024-11-25 13:43   ` syzbot
2024-11-28 10:52 ` David Hildenbrand
2024-11-28 11:42   ` Hillf Danton
2024-11-28 12:02     ` David Hildenbrand
2024-11-28 12:23       ` David Hildenbrand
2024-11-28 13:03         ` Hillf Danton [this message]
2024-11-28 13:37           ` syzbot
2024-11-28 12:57 ` David Hildenbrand
2024-11-28 13:18   ` 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=20241128130340.2021-1-hdanton@sina.com \
    --to=hdanton@sina.com \
    --cc=david@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=syzbot+9f9a7f73fb079b2387a6@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    --cc=willy@infradead.org \
    /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®