From: Hillf Danton <hdanton@sina.com>
To: syzbot <syzbot+b165fc2e11771c66d8ba@syzkaller.appspotmail.com>
Cc: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] [mm?] WARNING in folio_remove_rmap_ptes
Date: Tue, 23 Dec 2025 17:42:26 +0800 [thread overview]
Message-ID: <20251223094227.1771-1-hdanton@sina.com> (raw)
In-Reply-To: <694a2745.050a0220.19928e.0017.GAE@google.com>
> Date: Mon, 22 Dec 2025 21:23:17 -0800
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit: 9094662f6707 Merge tag 'ata-6.19-rc2' of git://git.kernel...
> git tree: upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=1411f77c580000
> kernel config: https://syzkaller.appspot.com/x/.config?x=a11e0f726bfb6765
> dashboard link: https://syzkaller.appspot.com/bug?extid=b165fc2e11771c66d8ba
> compiler: gcc (Debian 12.2.0-14+deb12u1) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=11998b1a580000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=128cdb1a580000
#syz test
--- x/include/linux/mm.h
+++ y/include/linux/mm.h
@@ -2626,6 +2626,9 @@ static inline void zap_vma_pages(struct
void unmap_vmas(struct mmu_gather *tlb, struct ma_state *mas,
struct vm_area_struct *start_vma, unsigned long start,
unsigned long end, unsigned long tree_end);
+void lock_unmap_vmas(struct mmu_gather *tlb, struct ma_state *mas,
+ struct vm_area_struct *start_vma, unsigned long start,
+ unsigned long end, unsigned long tree_end);
struct mmu_notifier_range;
--- x/mm/memory.c
+++ y/mm/memory.c
@@ -2104,7 +2104,31 @@ void unmap_vmas(struct mmu_gather *tlb,
} while (vma && likely(!xa_is_zero(vma)));
mmu_notifier_invalidate_range_end(&range);
}
+void lock_unmap_vmas(struct mmu_gather *tlb, struct ma_state *mas,
+ struct vm_area_struct *vma, unsigned long start_addr,
+ unsigned long end_addr, unsigned long tree_end)
+{
+ struct mmu_notifier_range range;
+ struct zap_details details = {
+ .zap_flags = ZAP_FLAG_DROP_MARKER | ZAP_FLAG_UNMAP,
+ /* Careful - we need to zap private pages too! */
+ .even_cows = true,
+ };
+ mmu_notifier_range_init(&range, MMU_NOTIFY_UNMAP, 0, vma->vm_mm,
+ start_addr, end_addr);
+ mmu_notifier_invalidate_range_start(&range);
+ do {
+ unsigned long start = start_addr;
+ unsigned long end = end_addr;
+ hugetlb_zap_begin(vma, &start, &end);
+ vma_start_write(vma);
+ unmap_single_vma(tlb, vma, start, end, &details);
+ hugetlb_zap_end(vma, &details);
+ vma = mas_find(mas, tree_end - 1);
+ } while (vma && likely(!xa_is_zero(vma)));
+ mmu_notifier_invalidate_range_end(&range);
+}
/**
* zap_page_range_single_batched - remove user pages in a given range
* @tlb: pointer to the caller's struct mmu_gather
--- x/mm/vma.c
+++ y/mm/vma.c
@@ -1228,7 +1228,7 @@ static inline void vms_clear_ptes(struct
mas_set(mas_detach, 1);
tlb_gather_mmu(&tlb, vms->vma->vm_mm);
update_hiwater_rss(vms->vma->vm_mm);
- unmap_vmas(&tlb, mas_detach, vms->vma, vms->start, vms->end,
+ lock_unmap_vmas(&tlb, mas_detach, vms->vma, vms->start, vms->end,
vms->vma_count);
mas_set(mas_detach, 1);
@@ -1271,8 +1271,6 @@ static void vms_complete_munmap_vmas(str
mm = current->mm;
mm->map_count -= vms->vma_count;
mm->locked_vm -= vms->locked_vm;
- if (vms->unlock)
- mmap_write_downgrade(mm);
if (!vms->nr_pages)
return;
@@ -1298,7 +1296,7 @@ static void vms_complete_munmap_vmas(str
vm_unacct_memory(vms->nr_accounted);
validate_mm(mm);
if (vms->unlock)
- mmap_read_unlock(mm);
+ mmap_write_unlock(mm);
__mt_destroy(mas_detach->tree);
}
--
next prev parent reply other threads:[~2025-12-23 9:52 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-23 5:23 [syzbot] [mm?] WARNING in folio_remove_rmap_ptes syzbot
2025-12-23 8:24 ` David Hildenbrand (Red Hat)
2025-12-24 2:48 ` Hillf Danton
2025-12-23 9:42 ` Hillf Danton [this message]
2025-12-23 10:10 ` syzbot
2025-12-24 5:35 ` Harry Yoo
2025-12-30 22:02 ` David Hildenbrand (Red Hat)
2025-12-31 6:59 ` Harry Yoo
2026-01-01 13:09 ` Jeongjun Park
2026-01-01 13:45 ` Harry Yoo
2026-01-01 14:30 ` Jeongjun Park
2026-01-01 16:32 ` Lorenzo Stoakes
2026-01-01 17:06 ` David Hildenbrand (Red Hat)
2026-01-01 21:28 ` Lorenzo Stoakes
2026-01-02 8:14 ` Harry Yoo
2026-01-02 11:31 ` Lorenzo Stoakes
2026-01-02 15:49 ` Lorenzo Stoakes
2026-01-02 16:30 ` Lorenzo Stoakes
2026-01-02 17:46 ` Lorenzo Stoakes
2026-01-01 16:54 ` Lorenzo Stoakes
2026-01-01 8:33 ` Jeongjun Park
2026-01-01 8:53 ` syzbot
2026-01-01 17:43 ` Lorenzo Stoakes
2026-01-03 3:13 ` Jeongjun Park
2026-01-03 3:35 ` syzbot
2026-01-06 14:39 ` Jeongjun Park
2026-01-06 15:00 ` 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=20251223094227.1771-1-hdanton@sina.com \
--to=hdanton@sina.com \
--cc=linux-kernel@vger.kernel.org \
--cc=syzbot+b165fc2e11771c66d8ba@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