public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Hillf Danton <hdanton@sina.com>
To: syzbot <syzbot+63859a31071a369082b1@syzkaller.appspotmail.com>
Cc: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] [mm?] WARNING in try_to_migrate_one (3)
Date: Sun, 10 Aug 2025 14:04:43 +0800	[thread overview]
Message-ID: <20250810060545.4177-1-hdanton@sina.com> (raw)
In-Reply-To: <6897b156.050a0220.51d73.0082.GAE@google.com>

> Date: Sat, 09 Aug 2025 13:36:38 -0700	[thread overview]
> Hello,
> 
> syzbot found the following issue on:
> 
> HEAD commit:    0227b49b5027 Merge tag 'gpio-updates-for-v6.17-rc1-part2' ..
> git tree:       upstream
> console+strace: https://syzkaller.appspot.com/x/log.txt?x=1422d434580000
> kernel config:  https://syzkaller.appspot.com/x/.config?x=2ae1da3a7f4a6ba4
> dashboard link: https://syzkaller.appspot.com/bug?extid=63859a31071a369082b1
> syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=117c72f0580000
> C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=17ab7ea2580000

#syz test

--- x/mm/rmap.c
+++ y/mm/rmap.c
@@ -2283,6 +2283,7 @@ static bool try_to_migrate_one(struct fo
 	struct mm_struct *mm = vma->vm_mm;
 	DEFINE_FOLIO_VMA_WALK(pvmw, folio, vma, address, 0);
 	bool anon_exclusive, writable, ret = true;
+	int check_excl = 1;
 	pte_t pteval;
 	struct page *subpage;
 	struct mmu_notifier_range range;
@@ -2422,6 +2423,7 @@ static bool try_to_migrate_one(struct fo
 			if (pte_dirty(pteval))
 				folio_mark_dirty(folio);
 			writable = pte_write(pteval);
+			check_excl = 0;
 		} else if (likely(pte_present(pteval))) {
 			flush_cache_page(vma, address, pfn);
 			/* Nuke the page table entry. */
@@ -2446,10 +2448,17 @@ static bool try_to_migrate_one(struct fo
 		} else {
 			pte_clear(mm, address, pvmw.pte);
 			writable = is_writable_device_private_entry(pte_to_swp_entry(pteval));
+			check_excl = 0;
 		}
 
-		VM_WARN_ON_FOLIO(writable && folio_test_anon(folio) &&
-				!anon_exclusive, folio);
+		if (check_excl) {
+			pfn = pte_pfn(pteval);
+			subpage = folio_page(folio, pfn - folio_pfn(folio));
+			anon_exclusive = folio_test_anon(folio) &&
+					PageAnonExclusive(subpage);
+			VM_WARN_ON_FOLIO(writable && folio_test_anon(folio) &&
+					!anon_exclusive, folio);
+		}
 
 		/* Update high watermark before we lower rss */
 		update_hiwater_rss(mm);
--

  parent reply	other threads:[~2025-08-10  6:06 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-09 20:36 [syzbot] [mm?] WARNING in try_to_migrate_one (3) syzbot
2025-08-10  1:35 ` Hillf Danton
2025-08-10  1:55   ` syzbot
2025-08-10  2:02 ` Hillf Danton
2025-08-10  2:56   ` syzbot
2025-08-10  6:04 ` Hillf Danton [this message]
2025-08-10  7:16   ` syzbot
2025-08-10 14:50 ` syzbot
2025-08-11  5:12 ` Lorenzo Stoakes
2025-08-11  6:34   ` syzbot
2025-10-09  4:37 ` syzbot
2025-10-13 10:58   ` Lorenzo Stoakes

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=20250810060545.4177-1-hdanton@sina.com \
    --to=hdanton@sina.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzbot+63859a31071a369082b1@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