[syzbot] [mm?] WARNING: refcount bug in __vma_enter_locked

6 views
Skip to first unread message

syzbot

unread,
Nov 24, 2025, 10:20:25 PM (yesterday) Nov 24
to Liam.H...@oracle.com, ak...@linux-foundation.org, liam.h...@oracle.com, linux-...@vger.kernel.org, linu...@kvack.org, lorenzo...@oracle.com, shakee...@linux.dev, sur...@google.com, syzkall...@googlegroups.com, vba...@suse.cz, wi...@infradead.org
Hello,

syzbot found the following issue on:

HEAD commit: 88cbd8ac379c Add linux-next specific files for 20251120
git tree: linux-next
console output: https://syzkaller.appspot.com/x/log.txt?x=114d9a12580000
kernel config: https://syzkaller.appspot.com/x/.config?x=270004e181b25d45
dashboard link: https://syzkaller.appspot.com/bug?extid=5b19bad23ac7f44bf8b8
compiler: Debian clang version 20.1.8 (++20250708063551+0c9f909b7976-1~exp1~20250708183702.136), Debian LLD 20.1.8
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=147e7a12580000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=11b3d658580000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/7d546d2103e3/disk-88cbd8ac.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/af9601889c35/vmlinux-88cbd8ac.xz
kernel image: https://storage.googleapis.com/syzbot-assets/7747417abb8f/bzImage-88cbd8ac.xz

The issue was bisected to:

commit c52a4e7b13eaa55a2c4bb08488b2cf9bd188ea85
Author: Matthew Wilcox (Oracle) <wi...@infradead.org>
Date: Mon Nov 10 20:32:02 2025 +0000

mm: use vma_start_write_killable() in dup_mmap()

bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=13e9da12580000
final oops: https://syzkaller.appspot.com/x/report.txt?x=1019da12580000
console output: https://syzkaller.appspot.com/x/log.txt?x=17e9da12580000

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+5b19ba...@syzkaller.appspotmail.com
Fixes: c52a4e7b13ea ("mm: use vma_start_write_killable() in dup_mmap()")

------------[ cut here ]------------
refcount_t: saturated; leaking memory.
WARNING: lib/refcount.c:19 at refcount_warn_saturate+0x13a/0x1d0 lib/refcount.c:19, CPU#1: syz.0.48/6130
Modules linked in:
CPU: 1 UID: 0 PID: 6130 Comm: syz.0.48 Not tainted syzkaller #0 PREEMPT(full)
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/25/2025
RIP: 0010:refcount_warn_saturate+0x13a/0x1d0 lib/refcount.c:19
Code: e0 cd be 8b e8 17 da f3 fc 90 0f 0b 90 90 eb b7 e8 fb be 31 fd c6 05 39 0d d8 0a 01 90 48 c7 c7 20 cd be 8b e8 f7 d9 f3 fc 90 <0f> 0b 90 90 eb 97 e8 db be 31 fd c6 05 1d 0d d8 0a 01 90 48 c7 c7
RSP: 0018:ffffc9000411f568 EFLAGS: 00010246
RAX: df83eb6d8e87c500 RBX: 0000000000000000 RCX: ffff8880790bbd00
RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000002
RBP: ffffc9000411f690 R08: ffff8880b87247d3 R09: 1ffff110170e48fa
R10: dffffc0000000000 R11: ffffed10170e48fb R12: ffff888025562a80
R13: 1ffff92000823ec0 R14: ffff888025562a80 R15: 0000000000000000
FS: 00007fdb5cf9a6c0(0000) GS:ffff888125fb9000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fdb5cf99f98 CR3: 00000000289ea000 CR4: 00000000003526f0
Call Trace:
<TASK>
__refcount_add_not_zero include/linux/refcount.h:187 [inline]
refcount_add_not_zero include/linux/refcount.h:212 [inline]
__vma_enter_locked+0x593/0x5d0 mm/mmap_lock.c:67
__vma_start_write+0x23/0x140 mm/mmap_lock.c:99
vma_start_write include/linux/mmap_lock.h:213 [inline]
vma_merge_existing_range mm/vma.c:900 [inline]
vma_modify+0xf62/0x1a70 mm/vma.c:1611
vma_modify_flags_uffd+0x204/0x250 mm/vma.c:1704
userfaultfd_clear_vma mm/userfaultfd.c:1997 [inline]
userfaultfd_release_all+0x34c/0x5d0 mm/userfaultfd.c:2116
userfaultfd_release+0xe7/0x1b0 fs/userfaultfd.c:887
__fput+0x44c/0xa70 fs/file_table.c:468
task_work_run+0x1d4/0x260 kernel/task_work.c:233
get_signal+0x11ec/0x1340 kernel/signal.c:2807
arch_do_signal_or_restart+0x9a/0x7a0 arch/x86/kernel/signal.c:337
__exit_to_user_mode_loop kernel/entry/common.c:41 [inline]
exit_to_user_mode_loop+0x87/0x4f0 kernel/entry/common.c:75
__exit_to_user_mode_prepare include/linux/irq-entry-common.h:226 [inline]
syscall_exit_to_user_mode_prepare include/linux/irq-entry-common.h:256 [inline]
syscall_exit_to_user_mode_work include/linux/entry-common.h:159 [inline]
syscall_exit_to_user_mode include/linux/entry-common.h:194 [inline]
do_syscall_64+0x2e9/0xfa0 arch/x86/entry/syscall_64.c:100
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fdb5c18f749
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fdb5cf9a038 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: fffffffffffffffc RBX: 00007fdb5c3e5fa0 RCX: 00007fdb5c18f749
RDX: 0000200000000100 RSI: 00000000c028aa05 RDI: 0000000000000003
RBP: 00007fdb5c213f91 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fdb5c3e6038 R14: 00007fdb5c3e5fa0 R15: 00007fff2e39e5c8
</TASK>


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
For information about bisection process see: https://goo.gl/tpsmEJ#bisection

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup

Matthew Wilcox

unread,
Nov 24, 2025, 11:27:31 PM (23 hours ago) Nov 24
to syzbot, Liam.H...@oracle.com, ak...@linux-foundation.org, linux-...@vger.kernel.org, linu...@kvack.org, lorenzo...@oracle.com, shakee...@linux.dev, sur...@google.com, syzkall...@googlegroups.com, vba...@suse.cz
On Mon, Nov 24, 2025 at 07:20:22PM -0800, syzbot wrote:
> refcount_t: saturated; leaking memory.

Umm. Something like this?

#syz test

diff --git a/mm/mmap_lock.c b/mm/mmap_lock.c
index e6e5570d1ec7..71af7f0a5fe1 100644
--- a/mm/mmap_lock.c
+++ b/mm/mmap_lock.c
@@ -74,9 +74,18 @@ static inline int __vma_enter_locked(struct vm_area_struct *vma,
refcount_read(&vma->vm_refcnt) == tgt_refcnt,
state);
if (err) {
+ if (refcount_sub_and_test(VMA_LOCK_OFFSET, &vma->vm_refcnt)) {
+ /* Oh cobblers. While we got a fatal signal, we
+ * raced with the last user. Pretend we didn't notice
+ * the signal
+ */
+ refcount_set(&vma->vm_refcnt, VMA_LOCK_OFFSET);
+ goto acquired;
+ }
rwsem_release(&vma->vmlock_dep_map, _RET_IP_);
return err;
}
+acquired:
lock_acquired(&vma->vmlock_dep_map, _RET_IP_);

return 1;

syzbot

unread,
Nov 24, 2025, 11:55:07 PM (23 hours ago) Nov 24
to ak...@linux-foundation.org, liam.h...@oracle.com, linux-...@vger.kernel.org, linu...@kvack.org, lorenzo...@oracle.com, shakee...@linux.dev, sur...@google.com, syzkall...@googlegroups.com, vba...@suse.cz, wi...@infradead.org
Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Reported-by: syzbot+5b19ba...@syzkaller.appspotmail.com
Tested-by: syzbot+5b19ba...@syzkaller.appspotmail.com

Tested on:

commit: 422f3140 Add linux-next specific files for 20251124
git tree: linux-next
console output: https://syzkaller.appspot.com/x/log.txt?x=167eae92580000
kernel config: https://syzkaller.appspot.com/x/.config?x=d488adfa0c950abc
dashboard link: https://syzkaller.appspot.com/bug?extid=5b19bad23ac7f44bf8b8
compiler: Debian clang version 20.1.8 (++20250708063551+0c9f909b7976-1~exp1~20250708183702.136), Debian LLD 20.1.8
patch: https://syzkaller.appspot.com/x/patch.diff?x=126d457c580000

Note: testing is done by a robot and is best-effort only.
Reply all
Reply to author
Forward
0 new messages