syzbot


possible deadlock in sys_mbind

Status: auto-obsoleted due to no activity on 2024/11/16 19:34
Reported-by: syzbot+b53752ff2a852b0d82d6@syzkaller.appspotmail.com
First crash: 122d, last: 106d
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-6.1 possible deadlock in sys_mbind 1 109d 109d 0/3 auto-obsoleted due to no activity on 2024/11/13 14:21

Sample crash report:
REISERFS (device loop1): checking transaction log (loop1)
REISERFS (device loop1): Using r5 hash to sort names
REISERFS (device loop1): Created .reiserfs_priv - reserved for xattr storage.
======================================================
WARNING: possible circular locking dependency detected
5.15.164-syzkaller #0 Not tainted
------------------------------------------------------
syz.1.140/4266 is trying to acquire lock:
ffff88807896c090 (&sbi->lock){+.+.}-{3:3}, at: reiserfs_write_lock+0x76/0xd0 fs/reiserfs/lock.c:27

but task is already holding lock:
ffff888019e07128 (&mm->mmap_lock){++++}-{3:3}, at: mmap_write_lock include/linux/mmap_lock.h:71 [inline]
ffff888019e07128 (&mm->mmap_lock){++++}-{3:3}, at: do_mbind mm/mempolicy.c:1299 [inline]
ffff888019e07128 (&mm->mmap_lock){++++}-{3:3}, at: kernel_mbind mm/mempolicy.c:1472 [inline]
ffff888019e07128 (&mm->mmap_lock){++++}-{3:3}, at: __do_sys_mbind mm/mempolicy.c:1479 [inline]
ffff888019e07128 (&mm->mmap_lock){++++}-{3:3}, at: __se_sys_mbind+0x4a4/0x1400 mm/mempolicy.c:1475

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (&mm->mmap_lock){++++}-{3:3}:
       lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623
       __might_fault+0xb4/0x110 mm/memory.c:5328
       reiserfs_ioctl+0x11d/0x340 fs/reiserfs/ioctl.c:96
       vfs_ioctl fs/ioctl.c:51 [inline]
       __do_sys_ioctl fs/ioctl.c:874 [inline]
       __se_sys_ioctl+0xf1/0x160 fs/ioctl.c:860
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x66/0xd0

-> #0 (&sbi->lock){+.+.}-{3:3}:
       check_prev_add kernel/locking/lockdep.c:3053 [inline]
       check_prevs_add kernel/locking/lockdep.c:3172 [inline]
       validate_chain+0x1649/0x5930 kernel/locking/lockdep.c:3788
       __lock_acquire+0x1295/0x1ff0 kernel/locking/lockdep.c:5012
       lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623
       __mutex_lock_common+0x1da/0x25a0 kernel/locking/mutex.c:596
       __mutex_lock kernel/locking/mutex.c:729 [inline]
       mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743
       reiserfs_write_lock+0x76/0xd0 fs/reiserfs/lock.c:27
       map_block_for_writepage fs/reiserfs/inode.c:2396 [inline]
       reiserfs_write_full_page fs/reiserfs/inode.c:2593 [inline]
       reiserfs_writepage+0xaa5/0x35e0 fs/reiserfs/inode.c:2745
       writeout mm/migrate.c:837 [inline]
       fallback_migrate_page mm/migrate.c:861 [inline]
       move_to_new_page+0x8bc/0xde0 mm/migrate.c:912
       __unmap_and_move mm/migrate.c:1077 [inline]
       unmap_and_move mm/migrate.c:1218 [inline]
       migrate_pages+0x1fa1/0x3470 mm/migrate.c:1495
       do_mbind mm/mempolicy.c:1325 [inline]
       kernel_mbind mm/mempolicy.c:1472 [inline]
       __do_sys_mbind mm/mempolicy.c:1479 [inline]
       __se_sys_mbind+0x10d0/0x1400 mm/mempolicy.c:1475
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x66/0xd0

other info that might help us debug this:

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&mm->mmap_lock);
                               lock(&sbi->lock);
                               lock(&mm->mmap_lock);
  lock(&sbi->lock);

 *** DEADLOCK ***

1 lock held by syz.1.140/4266:
 #0: ffff888019e07128 (&mm->mmap_lock){++++}-{3:3}, at: mmap_write_lock include/linux/mmap_lock.h:71 [inline]
 #0: ffff888019e07128 (&mm->mmap_lock){++++}-{3:3}, at: do_mbind mm/mempolicy.c:1299 [inline]
 #0: ffff888019e07128 (&mm->mmap_lock){++++}-{3:3}, at: kernel_mbind mm/mempolicy.c:1472 [inline]
 #0: ffff888019e07128 (&mm->mmap_lock){++++}-{3:3}, at: __do_sys_mbind mm/mempolicy.c:1479 [inline]
 #0: ffff888019e07128 (&mm->mmap_lock){++++}-{3:3}, at: __se_sys_mbind+0x4a4/0x1400 mm/mempolicy.c:1475

stack backtrace:
CPU: 0 PID: 4266 Comm: syz.1.140 Not tainted 5.15.164-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/27/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2d0 lib/dump_stack.c:106
 check_noncircular+0x2f8/0x3b0 kernel/locking/lockdep.c:2133
 check_prev_add kernel/locking/lockdep.c:3053 [inline]
 check_prevs_add kernel/locking/lockdep.c:3172 [inline]
 validate_chain+0x1649/0x5930 kernel/locking/lockdep.c:3788
 __lock_acquire+0x1295/0x1ff0 kernel/locking/lockdep.c:5012
 lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623
 __mutex_lock_common+0x1da/0x25a0 kernel/locking/mutex.c:596
 __mutex_lock kernel/locking/mutex.c:729 [inline]
 mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743
 reiserfs_write_lock+0x76/0xd0 fs/reiserfs/lock.c:27
 map_block_for_writepage fs/reiserfs/inode.c:2396 [inline]
 reiserfs_write_full_page fs/reiserfs/inode.c:2593 [inline]
 reiserfs_writepage+0xaa5/0x35e0 fs/reiserfs/inode.c:2745
 writeout mm/migrate.c:837 [inline]
 fallback_migrate_page mm/migrate.c:861 [inline]
 move_to_new_page+0x8bc/0xde0 mm/migrate.c:912
 __unmap_and_move mm/migrate.c:1077 [inline]
 unmap_and_move mm/migrate.c:1218 [inline]
 migrate_pages+0x1fa1/0x3470 mm/migrate.c:1495
 do_mbind mm/mempolicy.c:1325 [inline]
 kernel_mbind mm/mempolicy.c:1472 [inline]
 __do_sys_mbind mm/mempolicy.c:1479 [inline]
 __se_sys_mbind+0x10d0/0x1400 mm/mempolicy.c:1475
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0
RIP: 0033:0x7f67727559f9
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:00007f6770bd4038 EFLAGS: 00000246 ORIG_RAX: 00000000000000ed
RAX: ffffffffffffffda RBX: 00007f67728e3f80 RCX: 00007f67727559f9
RDX: 0000000000000000 RSI: 0000000000800000 RDI: 0000000020001000
RBP: 00007f67727c38ee R08: 0000000000000000 R09: 0000000000000002
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007f67728e3f80 R15: 00007fff6d0bfc68
 </TASK>

Crashes (7):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/08/08 19:24 linux-5.15.y 7e89efd3ae1c 61405512 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in sys_mbind
2024/08/08 19:33 linux-5.15.y 7e89efd3ae1c 61405512 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in sys_mbind
2024/08/06 07:17 linux-5.15.y 7e89efd3ae1c e1bdb00a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in sys_mbind
2024/08/06 07:16 linux-5.15.y 7e89efd3ae1c e1bdb00a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in sys_mbind
2024/07/27 13:39 linux-5.15.y 7e89efd3ae1c 46eb10b7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in sys_mbind
2024/07/27 13:39 linux-5.15.y 7e89efd3ae1c 46eb10b7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in sys_mbind
2024/07/24 01:48 linux-5.15.y 7c6d66f0266f e50e8da5 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in sys_mbind
* Struck through repros no longer work on HEAD.