[moderation] [fs?] possible deadlock in map_mft_record (2)

0 views
Skip to first unread message

syzbot

unread,
Apr 9, 2024, 12:58:24 AMApr 9
to syzkaller-upst...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 707081b61156 Merge branch 'for-next/core', remote-tracking..
git tree: git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci
console output: https://syzkaller.appspot.com/x/log.txt?x=11d3cca9180000
kernel config: https://syzkaller.appspot.com/x/.config?x=caeac3f3565b057a
dashboard link: https://syzkaller.appspot.com/bug?extid=7e5585816225fc542ecc
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
userspace arch: arm64
CC: [an...@tuxera.com linki...@kernel.org linux-...@vger.kernel.org linux-...@vger.kernel.org linux-n...@lists.sourceforge.net]

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

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/6cad68bf7532/disk-707081b6.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/1a27e5400778/vmlinux-707081b6.xz
kernel image: https://storage.googleapis.com/syzbot-assets/67dfc53755d0/Image-707081b6.gz.xz

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

======================================================
WARNING: possible circular locking dependency detected
6.8.0-rc7-syzkaller-g707081b61156 #0 Not tainted
------------------------------------------------------
syz-executor.1/9099 is trying to acquire lock:
ffff0000c179f510 (&ni->mrec_lock){+.+.}-{3:3}, at: map_mft_record+0x64/0x7b4 fs/ntfs/mft.c:154

but task is already holding lock:
ffff0000c179f480 (&rl->lock){++++}-{3:3}, at: ntfs_truncate+0x170/0x2130 fs/ntfs/inode.c:2378

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (&rl->lock){++++}-{3:3}:
down_read+0x58/0x2fc kernel/locking/rwsem.c:1526
ntfs_read_block fs/ntfs/aops.c:242 [inline]
ntfs_read_folio+0xd84/0x1c08 fs/ntfs/aops.c:430
filemap_read_folio+0x14c/0x39c mm/filemap.c:2324
do_read_cache_folio+0x114/0x548 mm/filemap.c:3703
do_read_cache_page mm/filemap.c:3769 [inline]
read_cache_page+0x6c/0x15c mm/filemap.c:3778
read_mapping_page include/linux/pagemap.h:888 [inline]
ntfs_map_page fs/ntfs/aops.h:75 [inline]
ntfs_sync_mft_mirror+0x1cc/0x1894 fs/ntfs/mft.c:480
write_mft_record_nolock+0x100c/0x1630 fs/ntfs/mft.c:787
write_mft_record+0x144/0x1bc fs/ntfs/mft.h:95
__ntfs_write_inode+0x5cc/0xa78 fs/ntfs/inode.c:3052
ntfs_write_inode+0x68/0x90 fs/ntfs/super.c:2664
write_inode fs/fs-writeback.c:1473 [inline]
__writeback_single_inode+0x5a8/0x146c fs/fs-writeback.c:1690
writeback_sb_inodes+0x718/0x1010 fs/fs-writeback.c:1916
wb_writeback+0x3f4/0xfc0 fs/fs-writeback.c:2092
wb_do_writeback fs/fs-writeback.c:2239 [inline]
wb_workfn+0x37c/0xf9c fs/fs-writeback.c:2279
process_one_work+0x694/0x1204 kernel/workqueue.c:2633
process_scheduled_works kernel/workqueue.c:2706 [inline]
worker_thread+0x938/0xef4 kernel/workqueue.c:2787
kthread+0x288/0x310 kernel/kthread.c:388
ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:860

-> #0 (&ni->mrec_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+0x3384/0x763c kernel/locking/lockdep.c:5137
lock_acquire+0x23c/0x71c kernel/locking/lockdep.c:5754
__mutex_lock_common+0x190/0x21a0 kernel/locking/mutex.c:608
__mutex_lock kernel/locking/mutex.c:752 [inline]
mutex_lock_nested+0x2c/0x38 kernel/locking/mutex.c:804
map_mft_record+0x64/0x7b4 fs/ntfs/mft.c:154
ntfs_truncate+0x1d0/0x2130 fs/ntfs/inode.c:2383
ntfs_truncate_vfs fs/ntfs/inode.c:2864 [inline]
ntfs_setattr+0x368/0x428 fs/ntfs/inode.c:2916
notify_change+0x9d4/0xc8c fs/attr.c:499
do_truncate+0x1c0/0x28c fs/open.c:66
vfs_truncate+0x2b8/0x360 fs/open.c:112
do_sys_truncate+0xec/0x1b4 fs/open.c:135
__do_sys_truncate fs/open.c:147 [inline]
__se_sys_truncate fs/open.c:145 [inline]
__arm64_sys_truncate+0x5c/0x70 fs/open.c:145
__invoke_syscall arch/arm64/kernel/syscall.c:34 [inline]
invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:48
el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:133
do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:152
el0_svc+0x54/0x168 arch/arm64/kernel/entry-common.c:712
el0t_64_sync_handler+0x84/0xfc arch/arm64/kernel/entry-common.c:730
el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:598

other info that might help us debug this:

Possible unsafe locking scenario:

CPU0 CPU1
---- ----
lock(&rl->lock);
lock(&ni->mrec_lock);
lock(&rl->lock);
lock(&ni->mrec_lock);

*** DEADLOCK ***

3 locks held by syz-executor.1/9099:
#0: ffff0000ed7c6420 (sb_writers#31){.+.+}-{0:0}, at: mnt_want_write+0x44/0x9c fs/namespace.c:409
#1: ffff0000c179f7f0 (&sb->s_type->i_mutex_key#36){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:804 [inline]
#1: ffff0000c179f7f0 (&sb->s_type->i_mutex_key#36){+.+.}-{3:3}, at: do_truncate+0x1ac/0x28c fs/open.c:64
#2: ffff0000c179f480 (&rl->lock){++++}-{3:3}, at: ntfs_truncate+0x170/0x2130 fs/ntfs/inode.c:2378

stack backtrace:
CPU: 1 PID: 9099 Comm: syz-executor.1 Not tainted 6.8.0-rc7-syzkaller-g707081b61156 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
Call trace:
dump_backtrace+0x1b8/0x1e4 arch/arm64/kernel/stacktrace.c:291
show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:298
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0xd0/0x124 lib/dump_stack.c:106
dump_stack+0x1c/0x28 lib/dump_stack.c:113
print_circular_bug+0x150/0x1b8 kernel/locking/lockdep.c:2060
check_noncircular+0x310/0x404 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+0x3384/0x763c kernel/locking/lockdep.c:5137
lock_acquire+0x23c/0x71c kernel/locking/lockdep.c:5754
__mutex_lock_common+0x190/0x21a0 kernel/locking/mutex.c:608
__mutex_lock kernel/locking/mutex.c:752 [inline]
mutex_lock_nested+0x2c/0x38 kernel/locking/mutex.c:804
map_mft_record+0x64/0x7b4 fs/ntfs/mft.c:154
ntfs_truncate+0x1d0/0x2130 fs/ntfs/inode.c:2383
ntfs_truncate_vfs fs/ntfs/inode.c:2864 [inline]
ntfs_setattr+0x368/0x428 fs/ntfs/inode.c:2916
notify_change+0x9d4/0xc8c fs/attr.c:499
do_truncate+0x1c0/0x28c fs/open.c:66
vfs_truncate+0x2b8/0x360 fs/open.c:112
do_sys_truncate+0xec/0x1b4 fs/open.c:135
__do_sys_truncate fs/open.c:147 [inline]
__se_sys_truncate fs/open.c:145 [inline]
__arm64_sys_truncate+0x5c/0x70 fs/open.c:145
__invoke_syscall arch/arm64/kernel/syscall.c:34 [inline]
invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:48
el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:133
do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:152
el0_svc+0x54/0x168 arch/arm64/kernel/entry-common.c:712
el0t_64_sync_handler+0x84/0xfc arch/arm64/kernel/entry-common.c:730
el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:598


---
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