[v5.15] possible deadlock in ni_fiemap

0 views
Skip to first unread message

syzbot

unread,
Mar 20, 2023, 1:55:49 PM3/20/23
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 8020ae3c051d Linux 5.15.103
git tree: linux-5.15.y
console output: https://syzkaller.appspot.com/x/log.txt?x=150c3e4ec80000
kernel config: https://syzkaller.appspot.com/x/.config?x=d4215fb4040f8f8d
dashboard link: https://syzkaller.appspot.com/bug?extid=279c5747e43b1bc50fcb
compiler: Debian clang version 15.0.7, GNU ld (GNU Binutils for Debian) 2.35.2

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

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/857e17de0f0a/disk-8020ae3c.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/9efc49fcd441/vmlinux-8020ae3c.xz
kernel image: https://storage.googleapis.com/syzbot-assets/f14c38b6bfa7/bzImage-8020ae3c.xz

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

======================================================
WARNING: possible circular locking dependency detected
5.15.103-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor.3/32228 is trying to acquire lock:
ffff888038426328 (&mm->mmap_lock#2){++++}-{3:3}, at: __might_fault+0x91/0x110 mm/memory.c:5296

but task is already holding lock:
ffff888084dad2d0 (&ni->file.run_lock#3){++++}-{3:3}, at: ni_fiemap+0x36f/0x1230 fs/ntfs3/frecord.c:1907

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+0x1ff/0x570 kernel/locking/lockdep.c:5622
down_read+0x3b/0x50 kernel/locking/rwsem.c:1488
attr_data_get_block+0x26a/0x24e0 fs/ntfs3/attrib.c:828
ntfs_file_mmap+0x458/0x7e0 fs/ntfs3/file.c:389
call_mmap include/linux/fs.h:2108 [inline]
mmap_region+0x10e7/0x1670 mm/mmap.c:1791
do_mmap+0x78d/0xe00 mm/mmap.c:1575
vm_mmap_pgoff+0x1ca/0x2d0 mm/util.c:551
ksys_mmap_pgoff+0x559/0x780 mm/mmap.c:1624
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+0x61/0xcb

-> #0 (&mm->mmap_lock#2){++++}-{3:3}:
check_prev_add kernel/locking/lockdep.c:3053 [inline]
check_prevs_add kernel/locking/lockdep.c:3172 [inline]
validate_chain+0x1646/0x58b0 kernel/locking/lockdep.c:3787
__lock_acquire+0x1295/0x1ff0 kernel/locking/lockdep.c:5011
lock_acquire+0x1ff/0x570 kernel/locking/lockdep.c:5622
__might_fault+0xb4/0x110 mm/memory.c:5297
_copy_to_user+0x28/0x130 lib/usercopy.c:35
copy_to_user include/linux/uaccess.h:200 [inline]
fiemap_fill_next_extent+0x231/0x410 fs/ioctl.c:144
ni_fiemap+0x9ae/0x1230 fs/ntfs3/frecord.c:1990
ntfs_fiemap+0x12e/0x170 fs/ntfs3/file.c:1225
ioctl_fiemap fs/ioctl.c:219 [inline]
do_vfs_ioctl+0x1934/0x2b70 fs/ioctl.c:814
__do_sys_ioctl fs/ioctl.c:872 [inline]
__se_sys_ioctl+0x81/0x160 fs/ioctl.c:860
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+0x61/0xcb

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-executor.3/32228:
#0: ffff888084dad220 (&ni->ni_lock/4){+.+.}-{3:3}, at: ni_lock fs/ntfs3/ntfs_fs.h:1107 [inline]
#0: ffff888084dad220 (&ni->ni_lock/4){+.+.}-{3:3}, at: ntfs_fiemap+0xfb/0x170 fs/ntfs3/file.c:1223
#1: ffff888084dad2d0 (&ni->file.run_lock#3){++++}-{3:3}, at: ni_fiemap+0x36f/0x1230 fs/ntfs3/frecord.c:1907

stack backtrace:
CPU: 0 PID: 32228 Comm: syz-executor.3 Not tainted 5.15.103-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/02/2023
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1e3/0x2cb 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+0x1646/0x58b0 kernel/locking/lockdep.c:3787
__lock_acquire+0x1295/0x1ff0 kernel/locking/lockdep.c:5011
lock_acquire+0x1ff/0x570 kernel/locking/lockdep.c:5622
__might_fault+0xb4/0x110 mm/memory.c:5297
_copy_to_user+0x28/0x130 lib/usercopy.c:35
copy_to_user include/linux/uaccess.h:200 [inline]
fiemap_fill_next_extent+0x231/0x410 fs/ioctl.c:144
ni_fiemap+0x9ae/0x1230 fs/ntfs3/frecord.c:1990
ntfs_fiemap+0x12e/0x170 fs/ntfs3/file.c:1225
ioctl_fiemap fs/ioctl.c:219 [inline]
do_vfs_ioctl+0x1934/0x2b70 fs/ioctl.c:814
__do_sys_ioctl fs/ioctl.c:872 [inline]
__se_sys_ioctl+0x81/0x160 fs/ioctl.c:860
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+0x61/0xcb
RIP: 0033:0x7fe8c62240f9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fe8c4796168 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007fe8c6343f80 RCX: 00007fe8c62240f9
RDX: 0000000020000040 RSI: 00000000c020660b RDI: 0000000000000005
RBP: 00007fe8c627fb39 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ffc1988ae5f R14: 00007fe8c4796300 R15: 0000000000022000
</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.

syzbot

unread,
Mar 28, 2023, 10:45:58 PM3/28/23
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: e3a87a10f259 Linux 6.1.21
git tree: linux-6.1.y
console output: https://syzkaller.appspot.com/x/log.txt?x=12aa87c1c80000
kernel config: https://syzkaller.appspot.com/x/.config?x=b49b0405a60858ed
dashboard link: https://syzkaller.appspot.com/bug?extid=4c15d900d6f374740ab6
compiler: Debian clang version 15.0.7, GNU ld (GNU Binutils for Debian) 2.35.2

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

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/ed3d1f3e75e6/disk-e3a87a10.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/6d8e44c8c75c/vmlinux-e3a87a10.xz
kernel image: https://storage.googleapis.com/syzbot-assets/cebe803ea4fa/bzImage-e3a87a10.xz

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

======================================================
WARNING: possible circular locking dependency detected
6.1.21-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor.1/31972 is trying to acquire lock:
ffff88801d434c58 (&mm->mmap_lock#2){++++}-{3:3}, at: __might_fault+0x8f/0x110 mm/memory.c:5640

but task is already holding lock:
ffff8880418b97d0 (&ni->file.run_lock){++++}-{3:3}, at: ni_fiemap+0x36f/0x1230 fs/ntfs3/frecord.c:1956

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #2 (&ni->file.run_lock){++++}-{3:3}:
lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5669
down_write+0x36/0x60 kernel/locking/rwsem.c:1573
attr_data_get_block+0x433/0x2520 fs/ntfs3/attrib.c:922
ntfs_get_block_vbo+0x373/0xe60 fs/ntfs3/inode.c:580
do_mpage_readpage+0x8d2/0x2040 fs/mpage.c:208
mpage_read_folio+0x104/0x1d0 fs/mpage.c:379
filemap_read_folio+0x199/0x780 mm/filemap.c:2407
do_read_cache_folio+0x2ee/0x810 mm/filemap.c:3535
do_read_cache_page+0x32/0x220 mm/filemap.c:3577
read_mapping_page include/linux/pagemap.h:756 [inline]
ntfs_map_page+0x1d/0x60 fs/ntfs3/ntfs_fs.h:899
ntfs_fill_super+0x3e3f/0x4500 fs/ntfs3/super.c:1210
get_tree_bdev+0x3fe/0x620 fs/super.c:1337
vfs_get_tree+0x88/0x270 fs/super.c:1544
do_new_mount+0x28b/0xad0 fs/namespace.c:3040
do_mount fs/namespace.c:3383 [inline]
__do_sys_mount fs/namespace.c:3591 [inline]
__se_sys_mount+0x2d5/0x3c0 fs/namespace.c:3568
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

-> #1 (&ni->ni_lock/4){+.+.}-{3:3}:
lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5669
__mutex_lock_common+0x1d4/0x2520 kernel/locking/mutex.c:603
__mutex_lock kernel/locking/mutex.c:747 [inline]
mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:799
ni_lock fs/ntfs3/ntfs_fs.h:1108 [inline]
attr_data_get_block+0x429/0x2520 fs/ntfs3/attrib.c:921
ntfs_file_mmap+0x452/0x7e0 fs/ntfs3/file.c:387
call_mmap include/linux/fs.h:2210 [inline]
mmap_region+0xf96/0x1fa0 mm/mmap.c:2625
do_mmap+0x8c5/0xf60 mm/mmap.c:1411
vm_mmap_pgoff+0x1ca/0x2d0 mm/util.c:520
ksys_mmap_pgoff+0x4f5/0x6d0 mm/mmap.c:1457
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:3098 [inline]
check_prevs_add kernel/locking/lockdep.c:3217 [inline]
validate_chain+0x1667/0x58e0 kernel/locking/lockdep.c:3832
__lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5056
lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5669
__might_fault+0xb2/0x110 mm/memory.c:5641
_copy_to_user+0x26/0x130 lib/usercopy.c:36
copy_to_user include/linux/uaccess.h:169 [inline]
fiemap_fill_next_extent+0x231/0x410 fs/ioctl.c:144
ni_fiemap+0x9ae/0x1230 fs/ntfs3/frecord.c:2039
ntfs_fiemap+0x12e/0x170 fs/ntfs3/file.c:1245
ioctl_fiemap fs/ioctl.c:219 [inline]
do_vfs_ioctl+0x18e9/0x2a90 fs/ioctl.c:810
__do_sys_ioctl fs/ioctl.c:868 [inline]
__se_sys_ioctl+0x81/0x160 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:

Chain exists of:
&mm->mmap_lock#2 --> &ni->ni_lock/4 --> &ni->file.run_lock

Possible unsafe locking scenario:

CPU0 CPU1
---- ----
lock(&ni->file.run_lock);
lock(&ni->ni_lock/4);
lock(&ni->file.run_lock);
lock(&mm->mmap_lock#2);

*** DEADLOCK ***

2 locks held by syz-executor.1/31972:
#0: ffff8880418b9720 (&ni->ni_lock/4){+.+.}-{3:3}, at: ni_lock fs/ntfs3/ntfs_fs.h:1108 [inline]
#0: ffff8880418b9720 (&ni->ni_lock/4){+.+.}-{3:3}, at: ntfs_fiemap+0xfb/0x170 fs/ntfs3/file.c:1243
#1: ffff8880418b97d0 (&ni->file.run_lock){++++}-{3:3}, at: ni_fiemap+0x36f/0x1230 fs/ntfs3/frecord.c:1956

stack backtrace:
CPU: 1 PID: 31972 Comm: syz-executor.1 Not tainted 6.1.21-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/17/2023
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
check_noncircular+0x2fa/0x3b0 kernel/locking/lockdep.c:2178
check_prev_add kernel/locking/lockdep.c:3098 [inline]
check_prevs_add kernel/locking/lockdep.c:3217 [inline]
validate_chain+0x1667/0x58e0 kernel/locking/lockdep.c:3832
__lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5056
lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5669
__might_fault+0xb2/0x110 mm/memory.c:5641
_copy_to_user+0x26/0x130 lib/usercopy.c:36
copy_to_user include/linux/uaccess.h:169 [inline]
fiemap_fill_next_extent+0x231/0x410 fs/ioctl.c:144
ni_fiemap+0x9ae/0x1230 fs/ntfs3/frecord.c:2039
ntfs_fiemap+0x12e/0x170 fs/ntfs3/file.c:1245
ioctl_fiemap fs/ioctl.c:219 [inline]
do_vfs_ioctl+0x18e9/0x2a90 fs/ioctl.c:810
__do_sys_ioctl fs/ioctl.c:868 [inline]
__se_sys_ioctl+0x81/0x160 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:0x7ff350e8c0f9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ff351b39168 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007ff350fabf80 RCX: 00007ff350e8c0f9
RDX: 0000000020000100 RSI: 00000000c020660b RDI: 0000000000000004
RBP: 00007ff350ee7b39 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ffdfc7de21f R14: 00007ff351b39300 R15: 0000000000022000

syzbot

unread,
May 12, 2023, 5:38:41 PM5/12/23
to syzkaller...@googlegroups.com
syzbot has found a reproducer for the following issue on:

HEAD commit: bf4ad6fa4e53 Linux 6.1.28
git tree: linux-6.1.y
console output: https://syzkaller.appspot.com/x/log.txt?x=129a5c6e280000
kernel config: https://syzkaller.appspot.com/x/.config?x=ee1a89a0c6a2db67
dashboard link: https://syzkaller.appspot.com/bug?extid=4c15d900d6f374740ab6
compiler: Debian clang version 15.0.7, GNU ld (GNU Binutils for Debian) 2.35.2
userspace arch: arm64
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=11eb573a280000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/a7b85a636ba8/disk-bf4ad6fa.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/a626aeb9d231/vmlinux-bf4ad6fa.xz
kernel image: https://storage.googleapis.com/syzbot-assets/78fbbffb9ee8/Image-bf4ad6fa.gz.xz
mounted in repro #1: https://storage.googleapis.com/syzbot-assets/b56810034cbe/mount_0.gz
mounted in repro #2: https://storage.googleapis.com/syzbot-assets/94ab8bf35018/mount_4.gz

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

======================================================
WARNING: possible circular locking dependency detected
6.1.28-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor.0/6649 is trying to acquire lock:
ffff0000dfaa5b48 (&mm->mmap_lock){++++}-{3:3}, at: __might_fault+0x9c/0x124 mm/memory.c:5654

but task is already holding lock:
ffff0000e7720940 (&indx->run_lock){.+.+}-{3:3}, at: ni_fiemap+0x2c4/0xe10 fs/ntfs3/frecord.c:1956

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #2 (&indx->run_lock){.+.+}-{3:3}:
down_read+0x5c/0x78 kernel/locking/rwsem.c:1520
indx_read+0x2a4/0x810 fs/ntfs3/index.c:993
indx_find+0x400/0x9b8 fs/ntfs3/index.c:1094
dir_search_u+0x180/0x324 fs/ntfs3/dir.c:254
ntfs_lookup+0x104/0x1a4 fs/ntfs3/namei.c:83
lookup_open fs/namei.c:3391 [inline]
open_last_lookups fs/namei.c:3481 [inline]
path_openat+0xd3c/0x2548 fs/namei.c:3711
do_filp_open+0x1bc/0x3cc fs/namei.c:3741
do_sys_openat2+0x128/0x3d8 fs/open.c:1310
do_sys_open fs/open.c:1326 [inline]
__do_sys_openat fs/open.c:1342 [inline]
__se_sys_openat fs/open.c:1337 [inline]
__arm64_sys_openat+0x1f0/0x240 fs/open.c:1337
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x64/0x218 arch/arm64/kernel/syscall.c:206
el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:581

-> #1 (&ni->ni_lock/4){+.+.}-{3:3}:
__mutex_lock_common+0x190/0x21a0 kernel/locking/mutex.c:603
__mutex_lock kernel/locking/mutex.c:747 [inline]
mutex_lock_nested+0x38/0x44 kernel/locking/mutex.c:799
ni_lock fs/ntfs3/ntfs_fs.h:1109 [inline]
attr_data_get_block+0x330/0x1bdc fs/ntfs3/attrib.c:921
ntfs_file_mmap+0x3a4/0x688 fs/ntfs3/file.c:387
call_mmap include/linux/fs.h:2210 [inline]
mmap_region+0xdd0/0x1a98 mm/mmap.c:2663
do_mmap+0xa00/0x1108 mm/mmap.c:1411
vm_mmap_pgoff+0x1a4/0x2b4 mm/util.c:520
ksys_mmap_pgoff+0x3c8/0x5b0 mm/mmap.c:1457
__do_sys_mmap arch/arm64/kernel/sys.c:28 [inline]
__se_sys_mmap arch/arm64/kernel/sys.c:21 [inline]
__arm64_sys_mmap+0xf8/0x110 arch/arm64/kernel/sys.c:21
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x64/0x218 arch/arm64/kernel/syscall.c:206
el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:581

-> #0 (&mm->mmap_lock){++++}-{3:3}:
check_prev_add kernel/locking/lockdep.c:3098 [inline]
check_prevs_add kernel/locking/lockdep.c:3217 [inline]
validate_chain kernel/locking/lockdep.c:3832 [inline]
__lock_acquire+0x3338/0x764c kernel/locking/lockdep.c:5056
lock_acquire+0x26c/0x7cc kernel/locking/lockdep.c:5669
__might_fault+0xc4/0x124 mm/memory.c:5655
_copy_to_user include/linux/uaccess.h:143 [inline]
copy_to_user include/linux/uaccess.h:169 [inline]
fiemap_fill_next_extent+0x1b4/0x424 fs/ioctl.c:144
ni_fiemap+0x7dc/0xe10 fs/ntfs3/frecord.c:2060
ntfs_fiemap+0x110/0x168 fs/ntfs3/file.c:1245
ioctl_fiemap fs/ioctl.c:219 [inline]
do_vfs_ioctl+0x194c/0x26f8 fs/ioctl.c:810
__do_sys_ioctl fs/ioctl.c:868 [inline]
__se_sys_ioctl fs/ioctl.c:856 [inline]
__arm64_sys_ioctl+0xe4/0x1c8 fs/ioctl.c:856
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x64/0x218 arch/arm64/kernel/syscall.c:206
el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:581

other info that might help us debug this:

Chain exists of:
&mm->mmap_lock --> &ni->ni_lock/4 --> &indx->run_lock

Possible unsafe locking scenario:

CPU0 CPU1
---- ----
lock(&indx->run_lock);
lock(&ni->ni_lock/4);
lock(&indx->run_lock);
lock(&mm->mmap_lock);

*** DEADLOCK ***

2 locks held by syz-executor.0/6649:
#0: ffff0000e7720860 (&ni->ni_lock/4){+.+.}-{3:3}, at: ni_lock fs/ntfs3/ntfs_fs.h:1109 [inline]
#0: ffff0000e7720860 (&ni->ni_lock/4){+.+.}-{3:3}, at: ntfs_fiemap+0xec/0x168 fs/ntfs3/file.c:1243
#1: ffff0000e7720940 (&indx->run_lock){.+.+}-{3:3}, at: ni_fiemap+0x2c4/0xe10 fs/ntfs3/frecord.c:1956

stack backtrace:
CPU: 1 PID: 6649 Comm: syz-executor.0 Not tainted 6.1.28-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/14/2023
Call trace:
dump_backtrace+0x1c8/0x1f4 arch/arm64/kernel/stacktrace.c:158
show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:165
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x108/0x170 lib/dump_stack.c:106
dump_stack+0x1c/0x5c lib/dump_stack.c:113
print_circular_bug+0x150/0x1b8 kernel/locking/lockdep.c:2056
check_noncircular+0x2cc/0x378 kernel/locking/lockdep.c:2178
check_prev_add kernel/locking/lockdep.c:3098 [inline]
check_prevs_add kernel/locking/lockdep.c:3217 [inline]
validate_chain kernel/locking/lockdep.c:3832 [inline]
__lock_acquire+0x3338/0x764c kernel/locking/lockdep.c:5056
lock_acquire+0x26c/0x7cc kernel/locking/lockdep.c:5669
__might_fault+0xc4/0x124 mm/memory.c:5655
_copy_to_user include/linux/uaccess.h:143 [inline]
copy_to_user include/linux/uaccess.h:169 [inline]
fiemap_fill_next_extent+0x1b4/0x424 fs/ioctl.c:144
ni_fiemap+0x7dc/0xe10 fs/ntfs3/frecord.c:2060
ntfs_fiemap+0x110/0x168 fs/ntfs3/file.c:1245
ioctl_fiemap fs/ioctl.c:219 [inline]
do_vfs_ioctl+0x194c/0x26f8 fs/ioctl.c:810
__do_sys_ioctl fs/ioctl.c:868 [inline]
__se_sys_ioctl fs/ioctl.c:856 [inline]
__arm64_sys_ioctl+0xe4/0x1c8 fs/ioctl.c:856
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x64/0x218 arch/arm64/kernel/syscall.c:206
el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:581


---
If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.

syzbot

unread,
May 15, 2023, 8:55:46 PM5/15/23
to syzkaller...@googlegroups.com
syzbot has found a reproducer for the following issue on:

HEAD commit: b0ece631f84a Linux 5.15.111
git tree: linux-5.15.y
console output: https://syzkaller.appspot.com/x/log.txt?x=159108d2280000
kernel config: https://syzkaller.appspot.com/x/.config?x=db3750b003ff805e
dashboard link: https://syzkaller.appspot.com/bug?extid=279c5747e43b1bc50fcb
compiler: Debian clang version 15.0.7, GNU ld (GNU Binutils for Debian) 2.35.2
userspace arch: arm64
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=11d10b01280000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/eded75b6c3f9/disk-b0ece631.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/20e5ae802010/vmlinux-b0ece631.xz
kernel image: https://storage.googleapis.com/syzbot-assets/05d665c869f3/Image-b0ece631.gz.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/cc2907dec48d/mount_0.gz

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

======================================================
WARNING: possible circular locking dependency detected
5.15.111-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor.0/4117 is trying to acquire lock:
ffff0000d2cd79d8 (&mm->mmap_lock){++++}-{3:3}, at: __might_fault+0xa0/0x128 mm/memory.c:5310

but task is already holding lock:
ffff0000e42d2e20 (&indx->run_lock){.+.+}-{3:3}, at: ni_fiemap+0x2c4/0xe10 fs/ntfs3/frecord.c:1907

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #2 (&indx->run_lock){.+.+}-{3:3}:
down_read+0xbc/0x11c kernel/locking/rwsem.c:1488
indx_read+0x294/0x7f8 fs/ntfs3/index.c:993
indx_find+0x404/0x9d4 fs/ntfs3/index.c:1100
dir_search_u+0x180/0x324 fs/ntfs3/dir.c:254
ntfs_lookup+0x104/0x1a4 fs/ntfs3/namei.c:83
lookup_open fs/namei.c:3370 [inline]
open_last_lookups fs/namei.c:3462 [inline]
path_openat+0xc9c/0x26f0 fs/namei.c:3669
do_filp_open+0x1a8/0x3b4 fs/namei.c:3699
do_sys_openat2+0x128/0x3d8 fs/open.c:1211
do_sys_open fs/open.c:1227 [inline]
__do_sys_openat fs/open.c:1243 [inline]
__se_sys_openat fs/open.c:1238 [inline]
__arm64_sys_openat+0x1f0/0x240 fs/open.c:1238
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181
el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:596
el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:614
el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584

-> #1 (&ni->ni_lock/4){+.+.}-{3:3}:
__mutex_lock_common+0x194/0x2154 kernel/locking/mutex.c:596
__mutex_lock kernel/locking/mutex.c:729 [inline]
mutex_lock_nested+0xa4/0xf8 kernel/locking/mutex.c:743
ni_lock fs/ntfs3/ntfs_fs.h:1108 [inline]
attr_data_get_block+0x35c/0x1c18 fs/ntfs3/attrib.c:846
ntfs_file_mmap+0x3a4/0x688 fs/ntfs3/file.c:389
call_mmap include/linux/fs.h:2108 [inline]
mmap_region+0xcb4/0x12f0 mm/mmap.c:1791
do_mmap+0x6c0/0xcec mm/mmap.c:1575
vm_mmap_pgoff+0x1a4/0x2b4 mm/util.c:551
ksys_mmap_pgoff+0x458/0x668 mm/mmap.c:1624
__do_sys_mmap arch/arm64/kernel/sys.c:28 [inline]
__se_sys_mmap arch/arm64/kernel/sys.c:21 [inline]
__arm64_sys_mmap+0xf8/0x110 arch/arm64/kernel/sys.c:21
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181
el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:596
el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:614
el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584

-> #0 (&mm->mmap_lock){++++}-{3:3}:
check_prev_add kernel/locking/lockdep.c:3053 [inline]
check_prevs_add kernel/locking/lockdep.c:3172 [inline]
validate_chain kernel/locking/lockdep.c:3787 [inline]
__lock_acquire+0x32cc/0x7620 kernel/locking/lockdep.c:5011
lock_acquire+0x240/0x77c kernel/locking/lockdep.c:5622
__might_fault+0xc8/0x128 mm/memory.c:5311
_copy_to_user include/linux/uaccess.h:174 [inline]
copy_to_user include/linux/uaccess.h:200 [inline]
fiemap_fill_next_extent+0x1b4/0x44c fs/ioctl.c:144
ni_fiemap+0x7dc/0xe10 fs/ntfs3/frecord.c:2011
ntfs_fiemap+0x110/0x168 fs/ntfs3/file.c:1225
ioctl_fiemap fs/ioctl.c:219 [inline]
do_vfs_ioctl+0x1bcc/0x2a38 fs/ioctl.c:814
__do_sys_ioctl fs/ioctl.c:872 [inline]
__se_sys_ioctl fs/ioctl.c:860 [inline]
__arm64_sys_ioctl+0xe4/0x1c8 fs/ioctl.c:860
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181
el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:596
el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:614
el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584

other info that might help us debug this:

Chain exists of:
&mm->mmap_lock --> &ni->ni_lock/4 --> &indx->run_lock

Possible unsafe locking scenario:

CPU0 CPU1
---- ----
lock(&indx->run_lock);
lock(&ni->ni_lock/4);
lock(&indx->run_lock);
lock(&mm->mmap_lock);

*** DEADLOCK ***

2 locks held by syz-executor.0/4117:
#0: ffff0000e42d2d40 (&ni->ni_lock/4){+.+.}-{3:3}, at: ni_lock fs/ntfs3/ntfs_fs.h:1108 [inline]
#0: ffff0000e42d2d40 (&ni->ni_lock/4){+.+.}-{3:3}, at: ntfs_fiemap+0xec/0x168 fs/ntfs3/file.c:1223
#1: ffff0000e42d2e20 (&indx->run_lock){.+.+}-{3:3}, at: ni_fiemap+0x2c4/0xe10 fs/ntfs3/frecord.c:1907

stack backtrace:
CPU: 1 PID: 4117 Comm: syz-executor.0 Not tainted 5.15.111-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/14/2023
Call trace:
dump_backtrace+0x0/0x530 arch/arm64/kernel/stacktrace.c:152
show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:216
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x108/0x170 lib/dump_stack.c:106
dump_stack+0x1c/0x58 lib/dump_stack.c:113
print_circular_bug+0x150/0x1b8 kernel/locking/lockdep.c:2011
check_noncircular+0x2cc/0x378 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 kernel/locking/lockdep.c:3787 [inline]
__lock_acquire+0x32cc/0x7620 kernel/locking/lockdep.c:5011
lock_acquire+0x240/0x77c kernel/locking/lockdep.c:5622
__might_fault+0xc8/0x128 mm/memory.c:5311
_copy_to_user include/linux/uaccess.h:174 [inline]
copy_to_user include/linux/uaccess.h:200 [inline]
fiemap_fill_next_extent+0x1b4/0x44c fs/ioctl.c:144
ni_fiemap+0x7dc/0xe10 fs/ntfs3/frecord.c:2011
ntfs_fiemap+0x110/0x168 fs/ntfs3/file.c:1225
ioctl_fiemap fs/ioctl.c:219 [inline]
do_vfs_ioctl+0x1bcc/0x2a38 fs/ioctl.c:814
__do_sys_ioctl fs/ioctl.c:872 [inline]
__se_sys_ioctl fs/ioctl.c:860 [inline]
__arm64_sys_ioctl+0xe4/0x1c8 fs/ioctl.c:860
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181
el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:596
el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:614
el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584

syzbot

unread,
Jun 12, 2023, 6:01:06 AM6/12/23
to syzkaller...@googlegroups.com
syzbot has found a reproducer for the following issue on:

HEAD commit: 2f3918bc53fb Linux 6.1.33
git tree: linux-6.1.y
console output: https://syzkaller.appspot.com/x/log.txt?x=16e401f1280000
kernel config: https://syzkaller.appspot.com/x/.config?x=668ab7dd51e152ad
dashboard link: https://syzkaller.appspot.com/bug?extid=4c15d900d6f374740ab6
compiler: Debian clang version 15.0.7, GNU ld (GNU Binutils for Debian) 2.35.2
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1125a1dd280000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1483d475280000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/148750653b59/disk-2f3918bc.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/f86efd682b25/vmlinux-2f3918bc.xz
kernel image: https://storage.googleapis.com/syzbot-assets/483386a4e270/bzImage-2f3918bc.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/836dccd385e8/mount_0.gz

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

======================================================
WARNING: possible circular locking dependency detected
6.1.33-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor315/3570 is trying to acquire lock:
ffff888028cf1f58 (&mm->mmap_lock#2){++++}-{3:3}, at: __might_fault+0x8f/0x110 mm/memory.c:5654

but task is already holding lock:
ffff8880741f2e20 (&indx->run_lock){.+.+}-{3:3}, at: ni_fiemap+0x36f/0x1230 fs/ntfs3/frecord.c:1956

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #2 (&indx->run_lock){.+.+}-{3:3}:
lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5669
down_read+0x43/0x2e0 kernel/locking/rwsem.c:1520
indx_read+0x2c5/0x910 fs/ntfs3/index.c:993
indx_find+0x498/0xb00 fs/ntfs3/index.c:1094
dir_search_u+0x1b3/0x390 fs/ntfs3/dir.c:254
ntfs_lookup+0x102/0x1f0 fs/ntfs3/namei.c:83
lookup_open fs/namei.c:3391 [inline]
open_last_lookups fs/namei.c:3481 [inline]
path_openat+0x10fb/0x2e60 fs/namei.c:3711
do_filp_open+0x230/0x480 fs/namei.c:3741
do_sys_openat2+0x13b/0x500 fs/open.c:1318
do_sys_open fs/open.c:1334 [inline]
__do_sys_openat fs/open.c:1350 [inline]
__se_sys_openat fs/open.c:1345 [inline]
__x64_sys_openat+0x243/0x290 fs/open.c:1345
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

-> #1 (&ni->ni_lock/4){+.+.}-{3:3}:
lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5669
__mutex_lock_common+0x1d4/0x2520 kernel/locking/mutex.c:603
__mutex_lock kernel/locking/mutex.c:747 [inline]
mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:799
ni_lock fs/ntfs3/ntfs_fs.h:1109 [inline]
attr_data_get_block+0x429/0x2520 fs/ntfs3/attrib.c:921
ntfs_file_mmap+0x452/0x7e0 fs/ntfs3/file.c:387
call_mmap include/linux/fs.h:2210 [inline]
mmap_region+0xf96/0x1fa0 mm/mmap.c:2663
do_mmap+0x8c5/0xf60 mm/mmap.c:1411
vm_mmap_pgoff+0x1ca/0x2d0 mm/util.c:520
ksys_mmap_pgoff+0x4f5/0x6d0 mm/mmap.c:1457
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:3098 [inline]
check_prevs_add kernel/locking/lockdep.c:3217 [inline]
validate_chain+0x1667/0x58e0 kernel/locking/lockdep.c:3832
__lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5056
lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5669
__might_fault+0xb2/0x110 mm/memory.c:5655
_copy_to_user+0x26/0x130 lib/usercopy.c:36
copy_to_user include/linux/uaccess.h:169 [inline]
fiemap_fill_next_extent+0x231/0x410 fs/ioctl.c:144
ni_fiemap+0xa5a/0x1230 fs/ntfs3/frecord.c:2060
ntfs_fiemap+0x12e/0x170 fs/ntfs3/file.c:1245
ioctl_fiemap fs/ioctl.c:219 [inline]
do_vfs_ioctl+0x18e9/0x2a90 fs/ioctl.c:810
__do_sys_ioctl fs/ioctl.c:868 [inline]
__se_sys_ioctl+0x81/0x160 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:

Chain exists of:
&mm->mmap_lock#2 --> &ni->ni_lock/4 --> &indx->run_lock

Possible unsafe locking scenario:

CPU0 CPU1
---- ----
lock(&indx->run_lock);
lock(&ni->ni_lock/4);
lock(&indx->run_lock);
lock(&mm->mmap_lock#2);

*** DEADLOCK ***

2 locks held by syz-executor315/3570:
#0: ffff8880741f2d40 (&ni->ni_lock/4){+.+.}-{3:3}, at: ni_lock fs/ntfs3/ntfs_fs.h:1109 [inline]
#0: ffff8880741f2d40 (&ni->ni_lock/4){+.+.}-{3:3}, at: ntfs_fiemap+0xfb/0x170 fs/ntfs3/file.c:1243
#1: ffff8880741f2e20 (&indx->run_lock){.+.+}-{3:3}, at: ni_fiemap+0x36f/0x1230 fs/ntfs3/frecord.c:1956

stack backtrace:
CPU: 1 PID: 3570 Comm: syz-executor315 Not tainted 6.1.33-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/25/2023
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
check_noncircular+0x2fa/0x3b0 kernel/locking/lockdep.c:2178
check_prev_add kernel/locking/lockdep.c:3098 [inline]
check_prevs_add kernel/locking/lockdep.c:3217 [inline]
validate_chain+0x1667/0x58e0 kernel/locking/lockdep.c:3832
__lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5056
lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5669
__might_fault+0xb2/0x110 mm/memory.c:5655
_copy_to_user+0x26/0x130 lib/usercopy.c:36
copy_to_user include/linux/uaccess.h:169 [inline]
fiemap_fill_next_extent+0x231/0x410 fs/ioctl.c:144
ni_fiemap+0xa5a/0x1230 fs/ntfs3/frecord.c:2060
ntfs_fiemap+0x12e/0x170 fs/ntfs3/file.c:1245
ioctl_fiemap fs/ioctl.c:219 [inline]
do_vfs_ioctl+0x18e9/0x2a90 fs/ioctl.c:810
__do_sys_ioctl fs/ioctl.c:868 [inline]
__se_sys_ioctl+0x81/0x160 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:0x7f064a57c439
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 31 18 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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f06422de208 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007f064a6187a8 RCX: 00007f064a57c439
RDX: 0000000020000080 RSI: 00000000c020660b RDI: 0000000000000005
RBP: 00007f064a6187a0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f064a6187ac
R13: 00007fff976e268f R14: 00007f06422de300 R15: 0000000000022000
</TASK>

syzbot

unread,
Jun 25, 2023, 5:02:57 AM6/25/23
to syzkaller...@googlegroups.com
syzbot has found a reproducer for the following issue on:

HEAD commit: f67653019430 Linux 5.15.118
git tree: linux-5.15.y
console output: https://syzkaller.appspot.com/x/log.txt?x=14273723280000
kernel config: https://syzkaller.appspot.com/x/.config?x=c6daef03436a2bc5
dashboard link: https://syzkaller.appspot.com/bug?extid=279c5747e43b1bc50fcb
compiler: Debian clang version 15.0.7, GNU ld (GNU Binutils for Debian) 2.35.2
userspace arch: arm64
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=17239950a80000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=12f770bf280000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/600ef9372d32/disk-f6765301.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/46dca37198b3/vmlinux-f6765301.xz
kernel image: https://storage.googleapis.com/syzbot-assets/7ae4a35a0a6d/Image-f6765301.gz.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/c7fd5b494332/mount_0.gz

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

loop0: detected capacity change from 0 to 4096
======================================================
WARNING: possible circular locking dependency detected
5.15.118-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor225/3963 is trying to acquire lock:
ffff0000c1d4e898 (&mm->mmap_lock){++++}-{3:3}, at: __might_fault+0xa0/0x128 mm/memory.c:5310

but task is already holding lock:
ffff0000df44f050 (&ni->file.run_lock#3){++++}-{3:3}, at: ni_fiemap+0x494/0xe10 fs/ntfs3/frecord.c:1930

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+0xc0/0x398 kernel/locking/rwsem.c:1488
attr_data_get_block+0x21c/0x1c18 fs/ntfs3/attrib.c:828
ntfs_file_mmap+0x3a4/0x688 fs/ntfs3/file.c:389
call_mmap include/linux/fs.h:2108 [inline]
mmap_region+0xcb4/0x12f0 mm/mmap.c:1791
do_mmap+0x6c0/0xcec mm/mmap.c:1575
vm_mmap_pgoff+0x1a4/0x2b4 mm/util.c:551
ksys_mmap_pgoff+0x458/0x668 mm/mmap.c:1624
__do_sys_mmap arch/arm64/kernel/sys.c:28 [inline]
__se_sys_mmap arch/arm64/kernel/sys.c:21 [inline]
__arm64_sys_mmap+0xf8/0x110 arch/arm64/kernel/sys.c:21
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181
el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:596
el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:614
el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584

-> #0 (&mm->mmap_lock){++++}-{3:3}:
check_prev_add kernel/locking/lockdep.c:3053 [inline]
check_prevs_add kernel/locking/lockdep.c:3172 [inline]
validate_chain kernel/locking/lockdep.c:3787 [inline]
__lock_acquire+0x32cc/0x7620 kernel/locking/lockdep.c:5011
lock_acquire+0x240/0x77c kernel/locking/lockdep.c:5622
__might_fault+0xc8/0x128 mm/memory.c:5311
_copy_to_user include/linux/uaccess.h:174 [inline]
copy_to_user include/linux/uaccess.h:200 [inline]
fiemap_fill_next_extent+0x1b4/0x44c fs/ioctl.c:144
ni_fiemap+0x7dc/0xe10 fs/ntfs3/frecord.c:2011
ntfs_fiemap+0x110/0x168 fs/ntfs3/file.c:1225
ioctl_fiemap fs/ioctl.c:219 [inline]
do_vfs_ioctl+0x1bcc/0x2a38 fs/ioctl.c:814
__do_sys_ioctl fs/ioctl.c:872 [inline]
__se_sys_ioctl fs/ioctl.c:860 [inline]
__arm64_sys_ioctl+0xe4/0x1c8 fs/ioctl.c:860
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181
el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:596
el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:614
el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584

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-executor225/3963:
#0: ffff0000df44efa0 (&ni->ni_lock/4){+.+.}-{3:3}, at: ni_lock fs/ntfs3/ntfs_fs.h:1108 [inline]
#0: ffff0000df44efa0 (&ni->ni_lock/4){+.+.}-{3:3}, at: ntfs_fiemap+0xec/0x168 fs/ntfs3/file.c:1223
#1: ffff0000df44f050 (&ni->file.run_lock#3){++++}-{3:3}, at: ni_fiemap+0x494/0xe10 fs/ntfs3/frecord.c:1930

stack backtrace:
CPU: 1 PID: 3963 Comm: syz-executor225 Not tainted 5.15.118-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/27/2023
Call trace:
dump_backtrace+0x0/0x530 arch/arm64/kernel/stacktrace.c:152
show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:216
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x108/0x170 lib/dump_stack.c:106
dump_stack+0x1c/0x58 lib/dump_stack.c:113
print_circular_bug+0x150/0x1b8 kernel/locking/lockdep.c:2011
check_noncircular+0x2cc/0x378 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 kernel/locking/lockdep.c:3787 [inline]
__lock_acquire+0x32cc/0x7620 kernel/locking/lockdep.c:5011
lock_acquire+0x240/0x77c kernel/locking/lockdep.c:5622
__might_fault+0xc8/0x128 mm/memory.c:5311
_copy_to_user include/linux/uaccess.h:174 [inline]
copy_to_user include/linux/uaccess.h:200 [inline]
fiemap_fill_next_extent+0x1b4/0x44c fs/ioctl.c:144
ni_fiemap+0x7dc/0xe10 fs/ntfs3/frecord.c:2011
ntfs_fiemap+0x110/0x168 fs/ntfs3/file.c:1225
ioctl_fiemap fs/ioctl.c:219 [inline]
do_vfs_ioctl+0x1bcc/0x2a38 fs/ioctl.c:814
__do_sys_ioctl fs/ioctl.c:872 [inline]
__se_sys_ioctl fs/ioctl.c:860 [inline]
__arm64_sys_ioctl+0xe4/0x1c8 fs/ioctl.c:860
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181
el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:596
el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:614
el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584


syzbot

unread,
Nov 14, 2023, 4:28:05 AM11/14/23
to syzkaller...@googlegroups.com
syzbot suspects this issue could be fixed by backporting the following commit:

commit d92725256b4f22d084b813b37ddc394da79aacab
git tree: upstream
Author: Peter Xu <pet...@redhat.com>
Date: Mon May 30 18:34:50 2022 +0000

mm: avoid unnecessary page fault retires on shared memory types

bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=175fa588e80000
kernel config: https://syzkaller.appspot.com/x/.config?x=295181026c532aa4
dashboard link: https://syzkaller.appspot.com/bug?extid=279c5747e43b1bc50fcb
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=11bdb127a80000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=17906a65a80000


Please keep in mind that other backports might be required as well.

For information about bisection process see: https://goo.gl/tpsmEJ#bisection
Reply all
Reply to author
Forward
0 new messages