* [syzbot] possible deadlock in ni_fiemap
@ 2022-10-18 5:47 syzbot
2022-11-30 17:25 ` syzbot
` (4 more replies)
0 siblings, 5 replies; 8+ messages in thread
From: syzbot @ 2022-10-18 5:47 UTC (permalink / raw)
To: almaz.alexandrovich, linux-kernel, ntfs3, syzkaller-bugs
Hello,
syzbot found the following issue on:
HEAD commit: bbed346d5a96 Merge branch 'for-next/core' into for-kernelci
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=131e9506880000
kernel config: https://syzkaller.appspot.com/x/.config?x=3a4a45d2d827c1e
dashboard link: https://syzkaller.appspot.com/bug?extid=c300ab283ba3bc072439
compiler: Debian clang version 13.0.1-++20220126092033+75e33f71c2da-1~exp1~20220126212112.63, GNU ld (GNU Binutils for Debian) 2.35.2
userspace arch: arm64
Unfortunately, I don't have any reproducer for this issue yet.
Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/e8e91bc79312/disk-bbed346d.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/c1cb3fb3b77e/vmlinux-bbed346d.xz
IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+c300ab283ba3bc072439@syzkaller.appspotmail.com
ntfs3: loop2: Different NTFS' sector size (1024) and media sector size (512)
ntfs3: loop2: Mark volume as dirty due to NTFS errors
======================================================
WARNING: possible circular locking dependency detected
6.0.0-rc7-syzkaller-18095-gbbed346d5a96 #0 Not tainted
------------------------------------------------------
syz-executor.2/17350 is trying to acquire lock:
ffff0000c79fb598 (&mm->mmap_lock){++++}-{3:3}, at: __might_fault+0x54/0xb4 mm/memory.c:5576
but task is already holding lock:
ffff000113418898 (&ni->file.run_lock#3){++++}-{3:3}, at: ni_fiemap+0x158/0x620 fs/ntfs3/frecord.c:1947
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #1 (&ni->file.run_lock#3){++++}-{3:3}:
down_read+0x5c/0x78 kernel/locking/rwsem.c:1499
attr_data_get_block+0x84/0xa54 fs/ntfs3/attrib.c:899
ntfs_extend_initialized_size+0x108/0x334 fs/ntfs3/file.c:125
ntfs_file_mmap+0x290/0x2e4 fs/ntfs3/file.c:403
call_mmap include/linux/fs.h:2192 [inline]
mmap_region+0x7fc/0xc14 mm/mmap.c:1752
do_mmap+0x644/0x97c mm/mmap.c:1540
vm_mmap_pgoff+0xe8/0x1d0 mm/util.c:552
ksys_mmap_pgoff+0x1cc/0x278 mm/mmap.c:1586
__do_sys_mmap arch/arm64/kernel/sys.c:28 [inline]
__se_sys_mmap arch/arm64/kernel/sys.c:21 [inline]
__arm64_sys_mmap+0x58/0x6c arch/arm64/kernel/sys.c:21
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall arch/arm64/kernel/syscall.c:52 [inline]
el0_svc_common+0x138/0x220 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x48/0x164 arch/arm64/kernel/syscall.c:206
el0_svc+0x58/0x150 arch/arm64/kernel/entry-common.c:636
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:654
el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:581
-> #0 (&mm->mmap_lock){++++}-{3:3}:
check_prev_add kernel/locking/lockdep.c:3095 [inline]
check_prevs_add kernel/locking/lockdep.c:3214 [inline]
validate_chain kernel/locking/lockdep.c:3829 [inline]
__lock_acquire+0x1530/0x30a4 kernel/locking/lockdep.c:5053
lock_acquire+0x100/0x1f8 kernel/locking/lockdep.c:5666
__might_fault+0x7c/0xb4 mm/memory.c:5577
_copy_to_user include/linux/uaccess.h:134 [inline]
copy_to_user include/linux/uaccess.h:160 [inline]
fiemap_fill_next_extent+0xc4/0x1f8 fs/ioctl.c:144
ni_fiemap+0x4cc/0x620 fs/ntfs3/frecord.c:2051
ntfs_fiemap+0x9c/0xdc fs/ntfs3/file.c:1245
ioctl_fiemap fs/ioctl.c:219 [inline]
do_vfs_ioctl+0x10f0/0x16a4 fs/ioctl.c:810
__do_sys_ioctl fs/ioctl.c:868 [inline]
__se_sys_ioctl fs/ioctl.c:856 [inline]
__arm64_sys_ioctl+0x98/0x140 fs/ioctl.c:856
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall arch/arm64/kernel/syscall.c:52 [inline]
el0_svc_common+0x138/0x220 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x48/0x164 arch/arm64/kernel/syscall.c:206
el0_svc+0x58/0x150 arch/arm64/kernel/entry-common.c:636
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:654
el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:581
other info that might help us debug this:
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(&ni->file.run_lock#3);
lock(&mm->mmap_lock);
lock(&ni->file.run_lock#3);
lock(&mm->mmap_lock);
*** DEADLOCK ***
2 locks held by syz-executor.2/17350:
#0: ffff0001134187e8 (&ni->ni_lock/4){+.+.}-{3:3}, at: ni_lock fs/ntfs3/ntfs_fs.h:1108 [inline]
#0: ffff0001134187e8 (&ni->ni_lock/4){+.+.}-{3:3}, at: ntfs_fiemap+0x88/0xdc fs/ntfs3/file.c:1243
#1: ffff000113418898 (&ni->file.run_lock#3){++++}-{3:3}, at: ni_fiemap+0x158/0x620 fs/ntfs3/frecord.c:1947
stack backtrace:
CPU: 1 PID: 17350 Comm: syz-executor.2 Not tainted 6.0.0-rc7-syzkaller-18095-gbbed346d5a96 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/30/2022
Call trace:
dump_backtrace+0x1c4/0x1f0 arch/arm64/kernel/stacktrace.c:156
show_stack+0x2c/0x54 arch/arm64/kernel/stacktrace.c:163
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x104/0x16c lib/dump_stack.c:106
dump_stack+0x1c/0x58 lib/dump_stack.c:113
print_circular_bug+0x2c4/0x2c8 kernel/locking/lockdep.c:2053
check_noncircular+0x14c/0x154 kernel/locking/lockdep.c:2175
check_prev_add kernel/locking/lockdep.c:3095 [inline]
check_prevs_add kernel/locking/lockdep.c:3214 [inline]
validate_chain kernel/locking/lockdep.c:3829 [inline]
__lock_acquire+0x1530/0x30a4 kernel/locking/lockdep.c:5053
lock_acquire+0x100/0x1f8 kernel/locking/lockdep.c:5666
__might_fault+0x7c/0xb4 mm/memory.c:5577
_copy_to_user include/linux/uaccess.h:134 [inline]
copy_to_user include/linux/uaccess.h:160 [inline]
fiemap_fill_next_extent+0xc4/0x1f8 fs/ioctl.c:144
ni_fiemap+0x4cc/0x620 fs/ntfs3/frecord.c:2051
ntfs_fiemap+0x9c/0xdc fs/ntfs3/file.c:1245
ioctl_fiemap fs/ioctl.c:219 [inline]
do_vfs_ioctl+0x10f0/0x16a4 fs/ioctl.c:810
__do_sys_ioctl fs/ioctl.c:868 [inline]
__se_sys_ioctl fs/ioctl.c:856 [inline]
__arm64_sys_ioctl+0x98/0x140 fs/ioctl.c:856
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall arch/arm64/kernel/syscall.c:52 [inline]
el0_svc_common+0x138/0x220 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x48/0x164 arch/arm64/kernel/syscall.c:206
el0_svc+0x58/0x150 arch/arm64/kernel/entry-common.c:636
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:654
el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:581
---
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@googlegroups.com.
syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [syzbot] possible deadlock in ni_fiemap
2022-10-18 5:47 [syzbot] possible deadlock in ni_fiemap syzbot
@ 2022-11-30 17:25 ` syzbot
2024-07-20 7:43 ` [syzbot] possible fix syzbot
` (3 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: syzbot @ 2022-11-30 17:25 UTC (permalink / raw)
To: almaz.alexandrovich, linux-kernel, ntfs3, syzkaller-bugs
syzbot has found a reproducer for the following issue on:
HEAD commit: 01f856ae6d0c Merge tag 'net-6.1-rc8-2' of git://git.kernel..
git tree: upstream
console+strace: https://syzkaller.appspot.com/x/log.txt?x=15502883880000
kernel config: https://syzkaller.appspot.com/x/.config?x=2325e409a9a893e1
dashboard link: https://syzkaller.appspot.com/bug?extid=c300ab283ba3bc072439
compiler: Debian clang version 13.0.1-++20220126092033+75e33f71c2da-1~exp1~20220126212112.63, GNU ld (GNU Binutils for Debian) 2.35.2
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=161b2cf5880000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=125b2cbd880000
Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/5428d604f56a/disk-01f856ae.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/e953d290d254/vmlinux-01f856ae.xz
kernel image: https://storage.googleapis.com/syzbot-assets/3f71610a4904/bzImage-01f856ae.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/073a0bd8a341/mount_0.gz
IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+c300ab283ba3bc072439@syzkaller.appspotmail.com
loop0: detected capacity change from 0 to 4096
======================================================
WARNING: possible circular locking dependency detected
6.1.0-rc7-syzkaller-00101-g01f856ae6d0c #0 Not tainted
------------------------------------------------------
syz-executor911/3632 is trying to acquire lock:
ffff888021991718 (&mm->mmap_lock#2){++++}-{3:3}, at: __might_fault+0x8f/0x110 mm/memory.c:5645
but task is already holding lock:
ffff8880741101b0 (&ni->file.run_lock#3){++++}-{3:3}, at: ni_fiemap+0x32b/0x1130 fs/ntfs3/frecord.c:1947
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #1 (&ni->file.run_lock#3){++++}-{3:3}:
lock_acquire+0x182/0x3c0 kernel/locking/lockdep.c:5668
down_read+0x39/0x50 kernel/locking/rwsem.c:1509
attr_data_get_block+0x158/0x2370 fs/ntfs3/attrib.c:899
ntfs_file_mmap+0x48c/0x730 fs/ntfs3/file.c:387
call_mmap include/linux/fs.h:2204 [inline]
mmap_region+0xfe6/0x1e20 mm/mmap.c:2625
do_mmap+0x8d9/0xf30 mm/mmap.c:1412
vm_mmap_pgoff+0x19e/0x2b0 mm/util.c:520
ksys_mmap_pgoff+0x48c/0x6d0 mm/mmap.c:1458
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
-> #0 (&mm->mmap_lock#2){++++}-{3:3}:
check_prev_add kernel/locking/lockdep.c:3097 [inline]
check_prevs_add kernel/locking/lockdep.c:3216 [inline]
validate_chain+0x1898/0x6ae0 kernel/locking/lockdep.c:3831
__lock_acquire+0x1292/0x1f60 kernel/locking/lockdep.c:5055
lock_acquire+0x182/0x3c0 kernel/locking/lockdep.c:5668
__might_fault+0xb2/0x110 mm/memory.c:5646
_copy_to_user+0x26/0x130 lib/usercopy.c:29
copy_to_user include/linux/uaccess.h:169 [inline]
fiemap_fill_next_extent+0x22e/0x410 fs/ioctl.c:144
ni_fiemap+0xa11/0x1130 fs/ntfs3/frecord.c:2051
ntfs_fiemap+0x134/0x180 fs/ntfs3/file.c:1245
ioctl_fiemap fs/ioctl.c:219 [inline]
do_vfs_ioctl+0x187f/0x29a0 fs/ioctl.c:810
__do_sys_ioctl fs/ioctl.c:868 [inline]
__se_sys_ioctl+0x83/0x170 fs/ioctl.c:856
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
other info that might help us debug this:
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(&ni->file.run_lock#3);
lock(&mm->mmap_lock#2);
lock(&ni->file.run_lock#3);
lock(&mm->mmap_lock#2);
*** DEADLOCK ***
2 locks held by syz-executor911/3632:
#0: ffff888074110100 (&ni->ni_lock/4){+.+.}-{3:3}, at: ni_lock fs/ntfs3/ntfs_fs.h:1108 [inline]
#0: ffff888074110100 (&ni->ni_lock/4){+.+.}-{3:3}, at: ntfs_fiemap+0x101/0x180 fs/ntfs3/file.c:1243
#1: ffff8880741101b0 (&ni->file.run_lock#3){++++}-{3:3}, at: ni_fiemap+0x32b/0x1130 fs/ntfs3/frecord.c:1947
stack backtrace:
CPU: 0 PID: 3632 Comm: syz-executor911 Not tainted 6.1.0-rc7-syzkaller-00101-g01f856ae6d0c #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1b1/0x28e lib/dump_stack.c:106
check_noncircular+0x2cc/0x390 kernel/locking/lockdep.c:2177
check_prev_add kernel/locking/lockdep.c:3097 [inline]
check_prevs_add kernel/locking/lockdep.c:3216 [inline]
validate_chain+0x1898/0x6ae0 kernel/locking/lockdep.c:3831
__lock_acquire+0x1292/0x1f60 kernel/locking/lockdep.c:5055
lock_acquire+0x182/0x3c0 kernel/locking/lockdep.c:5668
__might_fault+0xb2/0x110 mm/memory.c:5646
_copy_to_user+0x26/0x130 lib/usercopy.c:29
copy_to_user include/linux/uaccess.h:169 [inline]
fiemap_fill_next_extent+0x22e/0x410 fs/ioctl.c:144
ni_fiemap+0xa11/0x1130 fs/ntfs3/frecord.c:2051
ntfs_fiemap+0x134/0x180 fs/ntfs3/file.c:1245
ioctl_fiemap fs/ioctl.c:219 [inline]
do_vfs_ioctl+0x187f/0x29a0 fs/ioctl.c:810
__do_sys_ioctl fs/ioctl.c:868 [inline]
__se_sys_ioctl+0x83/0x170 fs/ioctl.c:856
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7febc4d60d69
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 51 14 00 00 90 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 c0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fffe05c24d8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007febc4d60d69
RDX: 00000000200001c0 RSI: 00000000c020660b RDI: 00000000
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [syzbot] possible fix
2022-10-18 5:47 [syzbot] possible deadlock in ni_fiemap syzbot
2022-11-30 17:25 ` syzbot
@ 2024-07-20 7:43 ` syzbot
2024-08-23 16:03 ` [syzbot] possible deadlock in ni_fiemap syzbot
` (2 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: syzbot @ 2024-07-20 7:43 UTC (permalink / raw)
To: linux-kernel, syzkaller-bugs
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com.
***
Subject: possible fix
Author: almaz.alexandrovich@paragon-software.com
#syz test: https://github.com/Paragon-Software-Group/linux-ntfs3.git
d57431c6f511bf020e474026d9f3123d7bfbea8c
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [syzbot] possible deadlock in ni_fiemap
2022-10-18 5:47 [syzbot] possible deadlock in ni_fiemap syzbot
2022-11-30 17:25 ` syzbot
2024-07-20 7:43 ` [syzbot] possible fix syzbot
@ 2024-08-23 16:03 ` syzbot
2024-11-18 6:58 ` [syzbot] [ntfs3?] " syzbot
2024-11-18 11:05 ` [syzbot] " syzbot
4 siblings, 0 replies; 8+ messages in thread
From: syzbot @ 2024-08-23 16:03 UTC (permalink / raw)
To: linux-kernel, syzkaller-bugs
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com.
***
Subject: possible deadlock in ni_fiemap
Author: almaz.alexandrovich@paragon-software.com
#syz test: https://github.com/Paragon-Software-Group/linux-ntfs3.git master
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [syzbot] [ntfs3?] possible deadlock in ni_fiemap
2022-10-18 5:47 [syzbot] possible deadlock in ni_fiemap syzbot
` (2 preceding siblings ...)
2024-08-23 16:03 ` [syzbot] possible deadlock in ni_fiemap syzbot
@ 2024-11-18 6:58 ` syzbot
2024-11-18 11:05 ` [syzbot] " syzbot
4 siblings, 0 replies; 8+ messages in thread
From: syzbot @ 2024-11-18 6:58 UTC (permalink / raw)
To: almaz.alexandrovich, axboe, brauner, jack, linux-kernel, ntfs3,
syzkaller-bugs
syzbot suspects this issue was fixed by commit:
commit 6f861765464f43a71462d52026fbddfc858239a5
Author: Jan Kara <jack@suse.cz>
Date: Wed Nov 1 17:43:10 2023 +0000
fs: Block writes to mounted block devices
bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=120c0ac0580000
start commit: d537ae43f8a1 Merge tag 'gpio-fixes-for-v6.6-rc7' of git://..
git tree: upstream
kernel config: https://syzkaller.appspot.com/x/.config?x=849fe52ba7c6d78a
dashboard link: https://syzkaller.appspot.com/bug?extid=c300ab283ba3bc072439
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1056076d680000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=17093269680000
If the result looks correct, please mark the issue as fixed by replying with:
#syz fix: fs: Block writes to mounted block devices
For information about bisection process see: https://goo.gl/tpsmEJ#bisection
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [syzbot] Re: [syzbot] [ntfs3?] possible deadlock in ni_fiemap
2022-10-18 5:47 [syzbot] possible deadlock in ni_fiemap syzbot
` (3 preceding siblings ...)
2024-11-18 6:58 ` [syzbot] [ntfs3?] " syzbot
@ 2024-11-18 11:05 ` syzbot
4 siblings, 0 replies; 8+ messages in thread
From: syzbot @ 2024-11-18 11:05 UTC (permalink / raw)
To: linux-kernel, syzkaller-bugs
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com.
***
Subject: Re: [syzbot] [ntfs3?] possible deadlock in ni_fiemap
Author: jack@suse.cz
On Sun 17-11-24 22:58:02, syzbot wrote:
> syzbot suspects this issue was fixed by commit:
>
> commit 6f861765464f43a71462d52026fbddfc858239a5
> Author: Jan Kara <jack@suse.cz>
> Date: Wed Nov 1 17:43:10 2023 +0000
>
> fs: Block writes to mounted block devices
>
> bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=120c0ac0580000
> start commit: d537ae43f8a1 Merge tag 'gpio-fixes-for-v6.6-rc7' of git://..
> git tree: upstream
> kernel config: https://syzkaller.appspot.com/x/.config?x=849fe52ba7c6d78a
> dashboard link: https://syzkaller.appspot.com/bug?extid=c300ab283ba3bc072439
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1056076d680000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=17093269680000
>
> If the result looks correct, please mark the issue as fixed by replying with:
Makes sense.
#syz fix: fs: Block writes to mounted block devices
Honza
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [syzbot] [ntfs3?] possible deadlock in ni_fiemap
[not found] <9dfe6ab434654f52a317b26f799d5ddb@paragon-software.com>
@ 2024-08-23 17:56 ` syzbot
0 siblings, 0 replies; 8+ messages in thread
From: syzbot @ 2024-08-23 17:56 UTC (permalink / raw)
To: almaz.alexandrovich, linux-kernel, syzkaller-bugs
Hello,
syzbot has tested the proposed patch but the reproducer is still triggering an issue:
possible deadlock in attr_data_get_block
loop0: detected capacity change from 0 to 4096
======================================================
WARNING: possible circular locking dependency detected
6.11.0-rc1-syzkaller-00016-g7529036a025a #0 Not tainted
------------------------------------------------------
syz-executor.0/5510 is trying to acquire lock:
ffff88806c041e60 (&ni->ni_lock/5){+.+.}-{3:3}, at: ni_lock fs/ntfs3/ntfs_fs.h:1111 [inline]
ffff88806c041e60 (&ni->ni_lock/5){+.+.}-{3:3}, at: attr_data_get_block+0x44b/0x2f20 fs/ntfs3/attrib.c:917
but task is already holding lock:
ffff888023f4d718 (&mm->mmap_lock){++++}-{3:3}, at: mmap_write_lock_killable include/linux/mmap_lock.h:122 [inline]
ffff888023f4d718 (&mm->mmap_lock){++++}-{3:3}, at: vm_mmap_pgoff+0x17c/0x3d0 mm/util.c:586
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #1 (&mm->mmap_lock){++++}-{3:3}:
lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5759
__might_fault+0xc6/0x120 mm/memory.c:6388
_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]
fiemap_fill_next_extent+0x235/0x410 fs/ioctl.c:145
ni_fiemap+0x4f5/0x1910 fs/ntfs3/frecord.c:1993
ntfs_fiemap+0x132/0x180 fs/ntfs3/file.c:1346
ioctl_fiemap fs/ioctl.c:220 [inline]
do_vfs_ioctl+0x1c07/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/5){+.+.}-{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:1111 [inline]
attr_data_get_block+0x44b/0x2f20 fs/ntfs3/attrib.c:917
ntfs_file_mmap+0x4f5/0x850 fs/ntfs3/file.c:370
call_mmap include/linux/fs.h:2129 [inline]
mmap_region+0xe8f/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
other info that might help us debug this:
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(&mm->mmap_lock);
lock(&ni->ni_lock/5);
lock(&mm->mmap_lock);
lock(&ni->ni_lock/5);
*** DEADLOCK ***
1 lock held by syz-executor.0/5510:
#0: ffff888023f4d718 (&mm->mmap_lock){++++}-{3:3}, at: mmap_write_lock_killable include/linux/mmap_lock.h:122 [inline]
#0: ffff888023f4d718 (&mm->mmap_lock){++++}-{3:3}, at: vm_mmap_pgoff+0x17c/0x3d0 mm/util.c:586
stack backtrace:
CPU: 1 UID: 0 PID: 5510 Comm: syz-executor.0 Not tainted 6.11.0-rc1-syzkaller-00016-g7529036a025a #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:1111 [inline]
attr_data_get_block+0x44b/0x2f20 fs/ntfs3/attrib.c:917
ntfs_file_mmap+0x4f5/0x850 fs/ntfs3/file.c:370
call_mmap include/linux/fs.h:2129 [inline]
mmap_region+0xe8f/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
RIP: 0033:0x7fcf3647dea9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 00 00 90 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 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fcf372630c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000009
RAX: ffffffffffffffda RBX: 00007fcf365abf80 RCX: 00007fcf3647dea9
RDX: 00000000027fffff RSI: 0000000000600000 RDI: 0000000020000000
RBP: 00007fcf364ca4a4 R08: 0000000000000004 R09: 0000000000000000
R10: 0000000004002011 R11: 0000000000000246 R12: 0000000000000000
R13: 000000000000000b R14: 00007fcf365abf80 R15: 00007ffdefad79e8
</TASK>
Tested on:
commit: 7529036a fs/ntfs3: Rename ntfs3_setattr into ntfs_seta..
git tree: https://github.com/Paragon-Software-Group/linux-ntfs3.git master
console output: https://syzkaller.appspot.com/x/log.txt?x=17478b91980000
kernel config: https://syzkaller.appspot.com/x/.config?x=500271480f7d801c
dashboard link: https://syzkaller.appspot.com/bug?extid=c300ab283ba3bc072439
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
Note: no patches were applied.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [syzbot] [ntfs3?] possible deadlock in ni_fiemap
[not found] <023c2035-91d2-4e0d-a2ce-7aacd763ac0d@paragon-software.com>
@ 2024-07-20 8:38 ` syzbot
0 siblings, 0 replies; 8+ messages in thread
From: syzbot @ 2024-07-20 8:38 UTC (permalink / raw)
To: almaz.alexandrovich, linux-kernel, syzkaller-bugs
Hello,
syzbot has tested the proposed patch but the reproducer is still triggering an issue:
possible deadlock in attr_data_get_block
======================================================
WARNING: possible circular locking dependency detected
6.10.0-rc1-syzkaller-00035-gd57431c6f511 #0 Not tainted
------------------------------------------------------
syz-executor.0/5470 is trying to acquire lock:
ffff88807655e840 (&ni->ni_lock/4){+.+.}-{3:3}, at: ni_lock fs/ntfs3/ntfs_fs.h:1107 [inline]
ffff88807655e840 (&ni->ni_lock/4){+.+.}-{3:3}, at: attr_data_get_block+0x463/0x2ff0 fs/ntfs3/attrib.c:917
but task is already holding lock:
ffff88807e94ea18 (&mm->mmap_lock){++++}-{3:3}, at: mmap_write_lock_killable include/linux/mmap_lock.h:122 [inline]
ffff88807e94ea18 (&mm->mmap_lock){++++}-{3:3}, at: vm_mmap_pgoff+0x17c/0x3d0 mm/util.c:571
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #1 (&mm->mmap_lock){++++}-{3:3}:
lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5754
__might_fault+0xc6/0x120 mm/memory.c:6233
_copy_to_user+0x2a/0xb0 lib/usercopy.c:41
copy_to_user include/linux/uaccess.h:191 [inline]
fiemap_fill_next_extent+0x235/0x410 fs/ioctl.c:145
ni_fiemap+0x4f5/0x1910 fs/ntfs3/frecord.c:1993
ntfs_fiemap+0x132/0x180 fs/ntfs3/file.c:1213
ioctl_fiemap fs/ioctl.c:220 [inline]
do_vfs_ioctl+0x1c07/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:3134 [inline]
check_prevs_add kernel/locking/lockdep.c:3253 [inline]
validate_chain+0x18e0/0x5900 kernel/locking/lockdep.c:3869
__lock_acquire+0x1346/0x1fd0 kernel/locking/lockdep.c:5137
lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5754
__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:1107 [inline]
attr_data_get_block+0x463/0x2ff0 fs/ntfs3/attrib.c:917
ntfs_file_mmap+0x50e/0x860 fs/ntfs3/file.c:294
call_mmap include/linux/fs.h:2107 [inline]
mmap_region+0xe8f/0x2090 mm/mmap.c:2886
do_mmap+0x8ad/0xfa0 mm/mmap.c:1397
vm_mmap_pgoff+0x1dd/0x3d0 mm/util.c:573
ksys_mmap_pgoff+0x4f1/0x720 mm/mmap.c:1443
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:
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(&mm->mmap_lock);
lock(&ni->ni_lock/4);
lock(&mm->mmap_lock);
lock(&ni->ni_lock/4);
*** DEADLOCK ***
1 lock held by syz-executor.0/5470:
#0: ffff88807e94ea18 (&mm->mmap_lock){++++}-{3:3}, at: mmap_write_lock_killable include/linux/mmap_lock.h:122 [inline]
#0: ffff88807e94ea18 (&mm->mmap_lock){++++}-{3:3}, at: vm_mmap_pgoff+0x17c/0x3d0 mm/util.c:571
stack backtrace:
CPU: 0 PID: 5470 Comm: syz-executor.0 Not tainted 6.10.0-rc1-syzkaller-00035-gd57431c6f511 #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+0x241/0x360 lib/dump_stack.c:114
check_noncircular+0x36a/0x4a0 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+0x18e0/0x5900 kernel/locking/lockdep.c:3869
__lock_acquire+0x1346/0x1fd0 kernel/locking/lockdep.c:5137
lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5754
__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:1107 [inline]
attr_data_get_block+0x463/0x2ff0 fs/ntfs3/attrib.c:917
ntfs_file_mmap+0x50e/0x860 fs/ntfs3/file.c:294
call_mmap include/linux/fs.h:2107 [inline]
mmap_region+0xe8f/0x2090 mm/mmap.c:2886
do_mmap+0x8ad/0xfa0 mm/mmap.c:1397
vm_mmap_pgoff+0x1dd/0x3d0 mm/util.c:573
ksys_mmap_pgoff+0x4f1/0x720 mm/mmap.c:1443
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:0x7f2f0687dea9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 00 00 90 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 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f2f075d70c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000009
RAX: ffffffffffffffda RBX: 00007f2f069abf80 RCX: 00007f2f0687dea9
RDX: 00000000027fffff RSI: 0000000000600000 RDI: 0000000020000000
RBP: 00007f2f068ca4a4 R08: 0000000000000004 R09: 0000000000000000
R10: 0000000004002011 R11: 0000000000000246 R12: 0000000000000000
R13: 000000000000000b R14: 00007f2f069abf80 R15: 00007ffd044d5088
</TASK>
Tested on:
commit: d57431c6 fs/ntfs3: Do copy_to_user out of run_lock
git tree: https://github.com/Paragon-Software-Group/linux-ntfs3.git
console output: https://syzkaller.appspot.com/x/log.txt?x=17849349980000
kernel config: https://syzkaller.appspot.com/x/.config?x=47d282ddffae809f
dashboard link: https://syzkaller.appspot.com/bug?extid=c300ab283ba3bc072439
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
Note: no patches were applied.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2024-11-18 11:05 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-18 5:47 [syzbot] possible deadlock in ni_fiemap syzbot
2022-11-30 17:25 ` syzbot
2024-07-20 7:43 ` [syzbot] possible fix syzbot
2024-08-23 16:03 ` [syzbot] possible deadlock in ni_fiemap syzbot
2024-11-18 6:58 ` [syzbot] [ntfs3?] " syzbot
2024-11-18 11:05 ` [syzbot] " syzbot
[not found] <023c2035-91d2-4e0d-a2ce-7aacd763ac0d@paragon-software.com>
2024-07-20 8:38 ` syzbot
[not found] <9dfe6ab434654f52a317b26f799d5ddb@paragon-software.com>
2024-08-23 17:56 ` syzbot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome