public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Hillf Danton <hdanton@sina.com>
To: syzbot <syzbot+ec4b7d82bb051330f15a@syzkaller.appspotmail.com>
Cc: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] [mm?] BUG: Bad page map (8)
Date: Fri, 19 Jul 2024 19:07:05 +0800	[thread overview]
Message-ID: <20240719110705.1508-1-hdanton@sina.com> (raw)
In-Reply-To: <000000000000341f5f061d8d6bcb@google.com>

On Thu, 18 Jul 2024 15:51:26 -0700
> syzbot found the following issue on:
> 
> HEAD commit:    4d145e3f830b Merge tag 'i2c-for-6.10-rc8' of git://git.ker..
> git tree:       upstream
> C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=1366ab85980000

#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git  4d145e3f830b

--- x/include/linux/rmap.h
+++ y/include/linux/rmap.h
@@ -327,6 +327,7 @@ static __always_inline void __folio_dup_
 
 	switch (level) {
 	case RMAP_LEVEL_PTE:
+		BUG_ON(atomic_read(&page->_mapcount) < 0);
 		if (!folio_test_large(folio)) {
 			atomic_inc(&page->_mapcount);
 			break;
@@ -419,6 +420,7 @@ static __always_inline int __folio_try_d
 					return -EBUSY;
 		}
 
+		BUG_ON(atomic_read(&page->_mapcount) < 0);
 		if (!folio_test_large(folio)) {
 			if (PageAnonExclusive(page))
 				ClearPageAnonExclusive(page);
--- x/mm/rmap.c
+++ y/mm/rmap.c
@@ -1149,6 +1149,7 @@ static __always_inline unsigned int __fo
 
 	switch (level) {
 	case RMAP_LEVEL_PTE:
+		BUG_ON(atomic_read(&page->_mapcount) < 0);
 		if (!folio_test_large(folio)) {
 			nr = atomic_inc_and_test(&page->_mapcount);
 			break;
@@ -1503,6 +1504,7 @@ static __always_inline void __folio_remo
 
 	switch (level) {
 	case RMAP_LEVEL_PTE:
+		BUG_ON(atomic_read(&page->_mapcount) < 0);
 		if (!folio_test_large(folio)) {
 			nr = atomic_add_negative(-1, &page->_mapcount);
 			break;
--

  reply	other threads:[~2024-07-19 11:07 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-18 22:51 [syzbot] [mm?] BUG: Bad page map (8) syzbot
2024-07-19 11:07 ` Hillf Danton [this message]
2024-07-19 11:44   ` syzbot
2024-07-19 11:21 ` David Hildenbrand
2024-07-20  5:02   ` Hillf Danton
2024-07-20  6:30     ` Kasireddy, Vivek
2024-07-22 13:23     ` David Hildenbrand
2024-07-19 13:00 ` Hillf Danton
2024-07-19 13:14   ` syzbot
2024-07-19 23:08 ` Hillf Danton
2024-07-19 23:21   ` syzbot
2024-07-20  6:32 ` Kasireddy, Vivek
2024-07-20  7:01   ` syzbot
2024-07-23 10:37 ` Hillf Danton
2024-07-23 10:52   ` syzbot
2024-09-30  0:02 ` syzbot
2024-09-30 13:52   ` Matthew Wilcox
2024-12-27 17:02 ` 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=20240719110705.1508-1-hdanton@sina.com \
    --to=hdanton@sina.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzbot+ec4b7d82bb051330f15a@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