[syzbot] [ntfs3?] possible deadlock in ntfs_unlink_inode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

syzbot found the following issue on:

HEAD commit:    47ac09b91bef Linux 6.11-rc4
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=1515fe05980000
kernel config:  https://syzkaller.appspot.com/x/.config?x=df2f0ed7e30a639d
dashboard link: https://syzkaller.appspot.com/bug?extid=cccc70d683efa1c3f6a3
compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40

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

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/56a2cea5e963/disk-47ac09b9.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/6114ba34ec85/vmlinux-47ac09b9.xz
kernel image: https://storage.googleapis.com/syzbot-assets/1aef645f1270/bzImage-47ac09b9.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+cccc70d683efa1c3f6a3@xxxxxxxxxxxxxxxxxxxxxxxxx

======================================================
WARNING: possible circular locking dependency detected
6.11.0-rc4-syzkaller #0 Not tainted
------------------------------------------------------
syz.2.4556/17158 is trying to acquire lock:
ffff88805f0ebbc0 (&ni->ni_lock/4){+.+.}-{3:3}, at: ni_lock fs/ntfs3/ntfs_fs.h:1110 [inline]
ffff88805f0ebbc0 (&ni->ni_lock/4){+.+.}-{3:3}, at: ntfs_unlink_inode+0x32b/0x840 fs/ntfs3/inode.c:1798

but task is already holding lock:
ffff88805f0ec318 (&ni->ni_lock/5){+.+.}-{3:3}, at: ni_lock_dir fs/ntfs3/ntfs_fs.h:1115 [inline]
ffff88805f0ec318 (&ni->ni_lock/5){+.+.}-{3:3}, at: ntfs_rmdir+0xb1/0xf0 fs/ntfs3/namei.c:222

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #3 (&ni->ni_lock/5){+.+.}-{3:3}:
       lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5759
       __mutex_lock_common kernel/locking/mutex.c:608 [inline]
       __mutex_lock+0x136/0xd70 kernel/locking/mutex.c:752
       ni_lock_dir fs/ntfs3/ntfs_fs.h:1115 [inline]
       ntfs_link+0xd9/0x270 fs/ntfs3/namei.c:139
       vfs_link+0x4f7/0x690 fs/namei.c:4692
       do_linkat+0x555/0x6f0 fs/namei.c:4762
       __do_sys_link fs/namei.c:4796 [inline]
       __se_sys_link fs/namei.c:4794 [inline]
       __x64_sys_link+0x82/0x90 fs/namei.c:4794
       do_syscall_x64 arch/x86/entry/common.c:52 [inline]
       do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #2 (&sb->s_type->i_mutex_key#26){+.+.}-{3:3}:
       lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5759
       down_write+0x99/0x220 kernel/locking/rwsem.c:1579
       inode_lock include/linux/fs.h:799 [inline]
       ntfs_file_mmap+0x5bf/0x850 fs/ntfs3/file.c:368
       call_mmap include/linux/fs.h:2129 [inline]
       mmap_region+0xe91/0x2090 mm/mmap.c:2957
       do_mmap+0x8f9/0x1010 mm/mmap.c:1468
       vm_mmap_pgoff+0x1dd/0x3d0 mm/util.c:588
       ksys_mmap_pgoff+0x4f1/0x720 mm/mmap.c:1514
       do_syscall_x64 arch/x86/entry/common.c:52 [inline]
       do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #1 (&mm->mmap_lock){++++}-{3:3}:
       lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5759
       __might_fault+0xc6/0x120 mm/memory.c:6387
       _inline_copy_to_user include/linux/uaccess.h:176 [inline]
       _copy_to_user+0x2a/0xb0 lib/usercopy.c:26
       copy_to_user include/linux/uaccess.h:209 [inline]
       ni_fiemap+0x5b4/0x1910 fs/ntfs3/frecord.c:2140
       ntfs_fiemap+0x132/0x180 fs/ntfs3/file.c:1279
       ioctl_fiemap fs/ioctl.c:220 [inline]
       do_vfs_ioctl+0x1c09/0x2e50 fs/ioctl.c:841
       __do_sys_ioctl fs/ioctl.c:905 [inline]
       __se_sys_ioctl+0x81/0x170 fs/ioctl.c:893
       do_syscall_x64 arch/x86/entry/common.c:52 [inline]
       do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #0 (&ni->ni_lock/4){+.+.}-{3:3}:
       check_prev_add kernel/locking/lockdep.c:3133 [inline]
       check_prevs_add kernel/locking/lockdep.c:3252 [inline]
       validate_chain+0x18e0/0x5900 kernel/locking/lockdep.c:3868
       __lock_acquire+0x137a/0x2040 kernel/locking/lockdep.c:5142
       lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5759
       __mutex_lock_common kernel/locking/mutex.c:608 [inline]
       __mutex_lock+0x136/0xd70 kernel/locking/mutex.c:752
       ni_lock fs/ntfs3/ntfs_fs.h:1110 [inline]
       ntfs_unlink_inode+0x32b/0x840 fs/ntfs3/inode.c:1798
       ntfs_rmdir+0xbc/0xf0 fs/ntfs3/namei.c:224
       vfs_rmdir+0x3a5/0x510 fs/namei.c:4293
       do_rmdir+0x3b5/0x580 fs/namei.c:4352
       __do_sys_unlinkat fs/namei.c:4528 [inline]
       __se_sys_unlinkat fs/namei.c:4522 [inline]
       __x64_sys_unlinkat+0xde/0xf0 fs/namei.c:4522
       do_syscall_x64 arch/x86/entry/common.c:52 [inline]
       do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

other info that might help us debug this:

Chain exists of:
  &ni->ni_lock/4 --> &sb->s_type->i_mutex_key#26 --> &ni->ni_lock/5

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&ni->ni_lock/5);
                               lock(&sb->s_type->i_mutex_key#26);
                               lock(&ni->ni_lock/5);
  lock(&ni->ni_lock/4);

 *** DEADLOCK ***

4 locks held by syz.2.4556/17158:
 #0: ffff8880696b8420 (sb_writers#14){.+.+}-{0:0}, at: mnt_want_write+0x3f/0x90 fs/namespace.c:515
 #1: ffff88805f0ec5b0 (&type->i_mutex_dir_key#10/1){+.+.}-{3:3}, at: inode_lock_nested include/linux/fs.h:834 [inline]
 #1: ffff88805f0ec5b0 (&type->i_mutex_dir_key#10/1){+.+.}-{3:3}, at: do_rmdir+0x263/0x580 fs/namei.c:4340
 #2: ffff88805f0ebe58 (&type->i_mutex_dir_key#10){++++}-{3:3}, at: inode_lock include/linux/fs.h:799 [inline]
 #2: ffff88805f0ebe58 (&type->i_mutex_dir_key#10){++++}-{3:3}, at: vfs_rmdir+0x101/0x510 fs/namei.c:4282
 #3: ffff88805f0ec318 (&ni->ni_lock/5){+.+.}-{3:3}, at: ni_lock_dir fs/ntfs3/ntfs_fs.h:1115 [inline]
 #3: ffff88805f0ec318 (&ni->ni_lock/5){+.+.}-{3:3}, at: ntfs_rmdir+0xb1/0xf0 fs/ntfs3/namei.c:222

stack backtrace:
CPU: 0 UID: 0 PID: 17158 Comm: syz.2.4556 Not tainted 6.11.0-rc4-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:93 [inline]
 dump_stack_lvl+0x241/0x360 lib/dump_stack.c:119
 check_noncircular+0x36a/0x4a0 kernel/locking/lockdep.c:2186
 check_prev_add kernel/locking/lockdep.c:3133 [inline]
 check_prevs_add kernel/locking/lockdep.c:3252 [inline]
 validate_chain+0x18e0/0x5900 kernel/locking/lockdep.c:3868
 __lock_acquire+0x137a/0x2040 kernel/locking/lockdep.c:5142
 lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5759
 __mutex_lock_common kernel/locking/mutex.c:608 [inline]
 __mutex_lock+0x136/0xd70 kernel/locking/mutex.c:752
 ni_lock fs/ntfs3/ntfs_fs.h:1110 [inline]
 ntfs_unlink_inode+0x32b/0x840 fs/ntfs3/inode.c:1798
 ntfs_rmdir+0xbc/0xf0 fs/ntfs3/namei.c:224
 vfs_rmdir+0x3a5/0x510 fs/namei.c:4293
 do_rmdir+0x3b5/0x580 fs/namei.c:4352
 __do_sys_unlinkat fs/namei.c:4528 [inline]
 __se_sys_unlinkat fs/namei.c:4522 [inline]
 __x64_sys_unlinkat+0xde/0xf0 fs/namei.c:4522
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f13b3979e79
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:00007f13b4729038 EFLAGS: 00000246 ORIG_RAX: 0000000000000107
RAX: ffffffffffffffda RBX: 00007f13b3b15f80 RCX: 00007f13b3979e79
RDX: 0000000000000200 RSI: 0000000020000000 RDI: ffffffffffffff9c
RBP: 00007f13b39e7916 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007f13b3b15f80 R15: 00007ffd9e06fb08
 </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 syzkaller@xxxxxxxxxxxxxxxx.

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




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux