[v6.6] possible deadlock in mpol_rebind_mm

0 views
Skip to first unread message

syzbot

unread,
Oct 1, 2025, 11:59:29 AMOct 1
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 147338df3487 Linux 6.6.108
git tree: linux-6.6.y
console output: https://syzkaller.appspot.com/x/log.txt?x=1231a334580000
kernel config: https://syzkaller.appspot.com/x/.config?x=12606d4b8832c7e4
dashboard link: https://syzkaller.appspot.com/bug?extid=f7b8e56a630c4605770e
compiler: Debian clang version 20.1.8 (++20250708063551+0c9f909b7976-1~exp1~20250708183702.136), Debian LLD 20.1.8

Unfortunately, I don't have any reproducer for this issue yet.

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/23d0a7436789/disk-147338df.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/5658c8bd0cce/vmlinux-147338df.xz
kernel image: https://storage.googleapis.com/syzbot-assets/be243abccdbe/bzImage-147338df.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+f7b8e5...@syzkaller.appspotmail.com

======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Not tainted
------------------------------------------------------
syz.3.241/6837 is trying to acquire lock:
ffff88807df0e0a0 (&mm->mmap_lock){++++}-{3:3}, at: mmap_write_lock include/linux/mmap_lock.h:108 [inline]
ffff88807df0e0a0 (&mm->mmap_lock){++++}-{3:3}, at: mpol_rebind_mm+0xb9/0x6f0 mm/mempolicy.c:391

but task is already holding lock:
ffffffff8cd680e8 (cpuset_mutex){+.+.}-{3:3}, at: cpuset_write_resmask+0xfa/0x1eb0 kernel/cgroup/cpuset.c:2881

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #6 (cpuset_mutex){+.+.}-{3:3}:
__mutex_lock_common kernel/locking/mutex.c:603 [inline]
__mutex_lock+0x129/0xcc0 kernel/locking/mutex.c:747
cpuset_write_u64+0x56/0x250 kernel/cgroup/cpuset.c:2778
cgroup_file_write+0x575/0x660 kernel/cgroup/cgroup.c:4105
kernfs_fop_write_iter+0x3b6/0x520 fs/kernfs/file.c:352
call_write_iter include/linux/fs.h:2018 [inline]
new_sync_write fs/read_write.c:491 [inline]
vfs_write+0x43b/0x940 fs/read_write.c:584
ksys_write+0x147/0x250 fs/read_write.c:637
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x68/0xd2

-> #5 (cpu_hotplug_lock){++++}-{0:0}:
percpu_down_read include/linux/percpu-rwsem.h:51 [inline]
cpus_read_lock+0x42/0x150 kernel/cpu.c:489
alloc_and_link_pwqs kernel/workqueue.c:4614 [inline]
alloc_workqueue+0xbcf/0x13c0 kernel/workqueue.c:4747
__ext4_fill_super fs/ext4/super.c:5492 [inline]
ext4_fill_super+0x4a63/0x66c0 fs/ext4/super.c:5731
get_tree_bdev+0x3e4/0x510 fs/super.c:1591
vfs_get_tree+0x8c/0x280 fs/super.c:1764
do_new_mount+0x24b/0xa40 fs/namespace.c:3377
init_mount+0xd2/0x120 fs/init.c:25
do_mount_root+0x97/0x230 init/do_mounts.c:166
mount_root_generic+0x195/0x3c0 init/do_mounts.c:205
prepare_namespace+0xc2/0x100 init/do_mounts.c:489
kernel_init_freeable+0x413/0x570 init/main.c:1566
kernel_init+0x1d/0x1c0 init/main.c:1443
ret_from_fork+0x48/0x80 arch/x86/kernel/process.c:152
ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:293

-> #4 (&type->s_umount_key#32){++++}-{3:3}:
down_read+0x46/0x2e0 kernel/locking/rwsem.c:1520
__super_lock fs/super.c:58 [inline]
super_lock+0x167/0x360 fs/super.c:117
super_lock_shared fs/super.c:146 [inline]
super_lock_shared_active fs/super.c:1442 [inline]
fs_bdev_sync+0xa4/0x170 fs/super.c:1477
blkdev_flushbuf block/ioctl.c:375 [inline]
blkdev_common_ioctl+0x880/0x23d0 block/ioctl.c:505
blkdev_ioctl+0x4eb/0x6f0 block/ioctl.c:627
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:871 [inline]
__se_sys_ioctl+0xfd/0x170 fs/ioctl.c:857
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x68/0xd2

-> #3 (&bdev->bd_holder_lock){+.+.}-{3:3}:
__mutex_lock_common kernel/locking/mutex.c:603 [inline]
__mutex_lock+0x129/0xcc0 kernel/locking/mutex.c:747
bd_finish_claiming+0x22f/0x3f0 block/bdev.c:568
blkdev_get_by_dev+0x45c/0x600 block/bdev.c:801
bdev_open_by_dev+0x77/0x100 block/bdev.c:842
setup_bdev_super+0x59/0x660 fs/super.c:1496
mount_bdev+0x1dd/0x2d0 fs/super.c:1640
legacy_get_tree+0xea/0x180 fs/fs_context.c:662
vfs_get_tree+0x8c/0x280 fs/super.c:1764
do_new_mount+0x24b/0xa40 fs/namespace.c:3377
init_mount+0xd2/0x120 fs/init.c:25
do_mount_root+0x97/0x230 init/do_mounts.c:166
mount_root_generic+0x195/0x3c0 init/do_mounts.c:205
prepare_namespace+0xc2/0x100 init/do_mounts.c:489
kernel_init_freeable+0x413/0x570 init/main.c:1566
kernel_init+0x1d/0x1c0 init/main.c:1443
ret_from_fork+0x48/0x80 arch/x86/kernel/process.c:152
ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:293

-> #2 (bdev_lock){+.+.}-{3:3}:
__mutex_lock_common kernel/locking/mutex.c:603 [inline]
__mutex_lock+0x129/0xcc0 kernel/locking/mutex.c:747
bd_prepare_to_claim+0x1ba/0x480 block/bdev.c:510
truncate_bdev_range+0x4e/0x260 block/bdev.c:105
blkdev_fallocate+0x3ff/0x670 block/fops.c:792
vfs_fallocate+0x58e/0x700 fs/open.c:324
madvise_remove mm/madvise.c:1007 [inline]
madvise_vma_behavior mm/madvise.c:1031 [inline]
madvise_walk_vmas mm/madvise.c:1266 [inline]
do_madvise+0x15fe/0x3710 mm/madvise.c:1446
__do_sys_madvise mm/madvise.c:1459 [inline]
__se_sys_madvise mm/madvise.c:1457 [inline]
__x64_sys_madvise+0xa6/0xc0 mm/madvise.c:1457
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x68/0xd2

-> #1 (mapping.invalidate_lock#2){++++}-{3:3}:
down_read+0x46/0x2e0 kernel/locking/rwsem.c:1520
filemap_invalidate_lock_shared include/linux/fs.h:859 [inline]
filemap_fault+0x5db/0x15a0 mm/filemap.c:3330
__do_fault+0x13b/0x4e0 mm/memory.c:4243
do_read_fault mm/memory.c:4616 [inline]
do_fault mm/memory.c:4753 [inline]
do_pte_missing mm/memory.c:3688 [inline]
handle_pte_fault mm/memory.c:5025 [inline]
__handle_mm_fault mm/memory.c:5166 [inline]
handle_mm_fault+0x3886/0x4920 mm/memory.c:5331
faultin_page mm/gup.c:868 [inline]
__get_user_pages+0x5ea/0x1470 mm/gup.c:1167
populate_vma_page_range+0x2b6/0x370 mm/gup.c:1593
__mm_populate+0x24c/0x380 mm/gup.c:1696
mm_populate include/linux/mm.h:3328 [inline]
vm_mmap_pgoff+0x2e7/0x400 mm/util.c:561
ksys_mmap_pgoff+0x520/0x700 mm/mmap.c:1431
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x68/0xd2

-> #0 (&mm->mmap_lock){++++}-{3:3}:
check_prev_add kernel/locking/lockdep.c:3134 [inline]
check_prevs_add kernel/locking/lockdep.c:3253 [inline]
validate_chain kernel/locking/lockdep.c:3869 [inline]
__lock_acquire+0x2ddb/0x7c80 kernel/locking/lockdep.c:5137
lock_acquire+0x197/0x410 kernel/locking/lockdep.c:5754
down_write+0x97/0x1f0 kernel/locking/rwsem.c:1573
mmap_write_lock include/linux/mmap_lock.h:108 [inline]
mpol_rebind_mm+0xb9/0x6f0 mm/mempolicy.c:391
update_tasks_nodemask+0x203/0x300 kernel/cgroup/cpuset.c:2081
update_nodemasks_hier kernel/cgroup/cpuset.c:2146 [inline]
update_nodemask kernel/cgroup/cpuset.c:2216 [inline]
cpuset_write_resmask+0xf94/0x1eb0 kernel/cgroup/cpuset.c:2896
cgroup_file_write+0x2fc/0x660 kernel/cgroup/cgroup.c:4089
kernfs_fop_write_iter+0x3b6/0x520 fs/kernfs/file.c:352
call_write_iter include/linux/fs.h:2018 [inline]
new_sync_write fs/read_write.c:491 [inline]
vfs_write+0x43b/0x940 fs/read_write.c:584
ksys_write+0x147/0x250 fs/read_write.c:637
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x68/0xd2

other info that might help us debug this:

Chain exists of:
&mm->mmap_lock --> cpu_hotplug_lock --> cpuset_mutex

Possible unsafe locking scenario:

CPU0 CPU1
---- ----
lock(cpuset_mutex);
lock(cpu_hotplug_lock);
lock(cpuset_mutex);
lock(&mm->mmap_lock);

*** DEADLOCK ***

5 locks held by syz.3.241/6837:
#0: ffff88802d2a0ac8 (&f->f_pos_lock){+.+.}-{3:3}, at: __fdget_pos+0x2a3/0x330 fs/file.c:1040
#1: ffff88802f07e418 (sb_writers#11){.+.+}-{0:0}, at: vfs_write+0x20e/0x940 fs/read_write.c:580
#2: ffff88805ef0e488 (&of->mutex){+.+.}-{3:3}, at: kernfs_fop_write_iter+0x1e7/0x520 fs/kernfs/file.c:343
#3: ffffffff8cbcb210 (cpu_hotplug_lock){++++}-{0:0}, at: cpuset_write_resmask+0xec/0x1eb0 kernel/cgroup/cpuset.c:2880
#4: ffffffff8cd680e8 (cpuset_mutex){+.+.}-{3:3}, at: cpuset_write_resmask+0xfa/0x1eb0 kernel/cgroup/cpuset.c:2881

stack backtrace:
CPU: 1 PID: 6837 Comm: syz.3.241 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/18/2025
Call Trace:
<TASK>
dump_stack_lvl+0x16c/0x230 lib/dump_stack.c:106
check_noncircular+0x2bd/0x3c0 kernel/locking/lockdep.c:2187
check_prev_add kernel/locking/lockdep.c:3134 [inline]
check_prevs_add kernel/locking/lockdep.c:3253 [inline]
validate_chain kernel/locking/lockdep.c:3869 [inline]
__lock_acquire+0x2ddb/0x7c80 kernel/locking/lockdep.c:5137
lock_acquire+0x197/0x410 kernel/locking/lockdep.c:5754
down_write+0x97/0x1f0 kernel/locking/rwsem.c:1573
mmap_write_lock include/linux/mmap_lock.h:108 [inline]
mpol_rebind_mm+0xb9/0x6f0 mm/mempolicy.c:391
update_tasks_nodemask+0x203/0x300 kernel/cgroup/cpuset.c:2081
update_nodemasks_hier kernel/cgroup/cpuset.c:2146 [inline]
update_nodemask kernel/cgroup/cpuset.c:2216 [inline]
cpuset_write_resmask+0xf94/0x1eb0 kernel/cgroup/cpuset.c:2896
cgroup_file_write+0x2fc/0x660 kernel/cgroup/cgroup.c:4089
kernfs_fop_write_iter+0x3b6/0x520 fs/kernfs/file.c:352
call_write_iter include/linux/fs.h:2018 [inline]
new_sync_write fs/read_write.c:491 [inline]
vfs_write+0x43b/0x940 fs/read_write.c:584
ksys_write+0x147/0x250 fs/read_write.c:637
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7f7c8918eec9
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:00007f7c8a106038 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00007f7c893e5fa0 RCX: 00007f7c8918eec9
RDX: 0000000000000001 RSI: 0000200000000040 RDI: 0000000000000006
RBP: 00007f7c89211f91 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f7c893e6038 R14: 00007f7c893e5fa0 R15: 00007ffd92d59448
</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.

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

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
Reply all
Reply to author
Forward
0 new messages