[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240719110705.1508-1-hdanton@sina.com>
Date: Fri, 19 Jul 2024 19:07:05 +0800
From: Hillf Danton <hdanton@...a.com>
To: syzbot <syzbot+ec4b7d82bb051330f15a@...kaller.appspotmail.com>
Cc: linux-kernel@...r.kernel.org,
syzkaller-bugs@...glegroups.com
Subject: Re: [syzbot] [mm?] BUG: Bad page map (8)
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;
--
Powered by blists - more mailing lists