linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [syzbot] [mm?] possible deadlock in gup_fast_fallback
@ 2024-04-21  3:14 syzbot
  2024-07-24 14:10 ` syzbot
  2024-07-25  1:01 ` syzbot
  0 siblings, 2 replies; 3+ messages in thread
From: syzbot @ 2024-04-21  3:14 UTC (permalink / raw)
  To: akpm, linux-kernel, linux-mm, syzkaller-bugs

Hello,

syzbot found the following issue on:

HEAD commit:    66e4190e92ce Add linux-next specific files for 20240416
git tree:       linux-next
console output: https://syzkaller.appspot.com/x/log.txt?x=1526f44f180000
kernel config:  https://syzkaller.appspot.com/x/.config?x=c247afaa437e6409
dashboard link: https://syzkaller.appspot.com/bug?extid=63ba90b81c16b86379bd
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/86891dae5f9c/disk-66e4190e.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/1ca383660bf2/vmlinux-66e4190e.xz
kernel image: https://storage.googleapis.com/syzbot-assets/bf6ff37d3fcc/bzImage-66e4190e.xz

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

======================================================
WARNING: possible circular locking dependency detected
6.9.0-rc4-next-20240416-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor.2/9254 is trying to acquire lock:
ffff88802c2f0b18 (&mm->mmap_lock){++++}-{3:3}, at: gup_fast_fallback+0x233/0x2b40 mm/gup.c:3442

but task is already holding lock:
ffff88806a3c3d80 (&sb->s_type->i_mutex_key#29){++++}-{3:3}, at: inode_lock include/linux/fs.h:791 [inline]
ffff88806a3c3d80 (&sb->s_type->i_mutex_key#29){++++}-{3:3}, at: __blockdev_direct_IO+0x346/0x49b0 fs/direct-io.c:1146

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #2 (&sb->s_type->i_mutex_key#29){++++}-{3:3}:
       lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5754
       down_write+0x3a/0x50 kernel/locking/rwsem.c:1579
       inode_lock include/linux/fs.h:791 [inline]
       exfat_page_mkwrite+0x43a/0xea0 fs/exfat/file.c:629
       do_page_mkwrite+0x19b/0x480 mm/memory.c:3097
       do_shared_fault mm/memory.c:4977 [inline]
       do_fault mm/memory.c:5039 [inline]
       do_pte_missing mm/memory.c:3881 [inline]
       handle_pte_fault+0x1298/0x6dc0 mm/memory.c:5359
       __handle_mm_fault mm/memory.c:5500 [inline]
       handle_mm_fault+0x10e7/0x1bb0 mm/memory.c:5665
       do_user_addr_fault arch/x86/mm/fault.c:1420 [inline]
       handle_page_fault arch/x86/mm/fault.c:1512 [inline]
       exc_page_fault+0x2b9/0x900 arch/x86/mm/fault.c:1570
       asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:623

-> #1 (sb_pagefaults#3){.+.+}-{0:0}:
       lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5754
       percpu_down_read include/linux/percpu-rwsem.h:51 [inline]
       __sb_start_write include/linux/fs.h:1659 [inline]
       sb_start_pagefault include/linux/fs.h:1824 [inline]
       exfat_page_mkwrite+0x161/0xea0 fs/exfat/file.c:619
       do_page_mkwrite+0x19b/0x480 mm/memory.c:3097
       do_shared_fault mm/memory.c:4977 [inline]
       do_fault mm/memory.c:5039 [inline]
       do_pte_missing mm/memory.c:3881 [inline]
       handle_pte_fault+0x1298/0x6dc0 mm/memory.c:5359
       __handle_mm_fault mm/memory.c:5500 [inline]
       handle_mm_fault+0x10e7/0x1bb0 mm/memory.c:5665
       do_user_addr_fault arch/x86/mm/fault.c:1420 [inline]
       handle_page_fault arch/x86/mm/fault.c:1512 [inline]
       exc_page_fault+0x2b9/0x900 arch/x86/mm/fault.c:1570
       asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:623

-> #0 (&mm->mmap_lock){++++}-{3:3}:
       check_prev_add kernel/locking/lockdep.c:3134 [inline]
       check_prevs_add kernel/locking/lockdep.c:3253 [inline]
       validate_chain+0x18cb/0x58e0 kernel/locking/lockdep.c:3869
       __lock_acquire+0x1346/0x1fd0 kernel/locking/lockdep.c:5137
       lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5754
       gup_fast_fallback+0x24c/0x2b40 mm/gup.c:3442
       pin_user_pages_fast+0xcc/0x160 mm/gup.c:3566
       iov_iter_extract_user_pages lib/iov_iter.c:1583 [inline]
       iov_iter_extract_pages+0x3db/0x720 lib/iov_iter.c:1646
       dio_refill_pages fs/direct-io.c:173 [inline]
       dio_get_page fs/direct-io.c:214 [inline]
       do_direct_IO fs/direct-io.c:916 [inline]
       __blockdev_direct_IO+0x150a/0x49b0 fs/direct-io.c:1249
       blockdev_direct_IO include/linux/fs.h:3182 [inline]
       exfat_direct_IO+0x1b4/0x3d0 fs/exfat/inode.c:526
       generic_file_read_iter+0x231/0x430 mm/filemap.c:2783
       aio_read+0x364/0x500 fs/aio.c:1611
       io_submit_one+0x884/0x18b0 fs/aio.c:2061
       __do_sys_io_submit fs/aio.c:2120 [inline]
       __se_sys_io_submit+0x179/0x2f0 fs/aio.c:2090
       do_syscall_x64 arch/x86/entry/common.c:52 [inline]
       do_syscall_64+0xf5/0x240 arch/x86/entry/common.c:83
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

other info that might help us debug this:

Chain exists of:
  &mm->mmap_lock --> sb_pagefaults#3 --> &sb->s_type->i_mutex_key#29

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&sb->s_type->i_mutex_key#29);
                               lock(sb_pagefaults#3);
                               lock(&sb->s_type->i_mutex_key#29);
  rlock(&mm->mmap_lock);

 *** DEADLOCK ***

1 lock held by syz-executor.2/9254:
 #0: ffff88806a3c3d80 (&sb->s_type->i_mutex_key#29){++++}-{3:3}, at: inode_lock include/linux/fs.h:791 [inline]
 #0: ffff88806a3c3d80 (&sb->s_type->i_mutex_key#29){++++}-{3:3}, at: __blockdev_direct_IO+0x346/0x49b0 fs/direct-io.c:1146

stack backtrace:
CPU: 0 PID: 9254 Comm: syz-executor.2 Not tainted 6.9.0-rc4-next-20240416-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/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+0x18cb/0x58e0 kernel/locking/lockdep.c:3869
 __lock_acquire+0x1346/0x1fd0 kernel/locking/lockdep.c:5137
 lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5754
 gup_fast_fallback+0x24c/0x2b40 mm/gup.c:3442
 pin_user_pages_fast+0xcc/0x160 mm/gup.c:3566
 iov_iter_extract_user_pages lib/iov_iter.c:1583 [inline]
 iov_iter_extract_pages+0x3db/0x720 lib/iov_iter.c:1646
 dio_refill_pages fs/direct-io.c:173 [inline]
 dio_get_page fs/direct-io.c:214 [inline]
 do_direct_IO fs/direct-io.c:916 [inline]
 __blockdev_direct_IO+0x150a/0x49b0 fs/direct-io.c:1249
 blockdev_direct_IO include/linux/fs.h:3182 [inline]
 exfat_direct_IO+0x1b4/0x3d0 fs/exfat/inode.c:526
 generic_file_read_iter+0x231/0x430 mm/filemap.c:2783
 aio_read+0x364/0x500 fs/aio.c:1611
 io_submit_one+0x884/0x18b0 fs/aio.c:2061
 __do_sys_io_submit fs/aio.c:2120 [inline]
 __se_sys_io_submit+0x179/0x2f0 fs/aio.c:2090
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xf5/0x240 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f397947dea9
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:00007f397a1670c8 EFLAGS: 00000246 ORIG_RAX: 00000000000000d1
RAX: ffffffffffffffda RBX: 00007f39795abf80 RCX: 00007f397947dea9
RDX: 0000000020000540 RSI: 0000000000003f0a RDI: 00007f397a13d000
RBP: 00007f39794ca4a4 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 000000000000000b R14: 00007f39795abf80 R15: 00007ffd43409678
 </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@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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [syzbot] [mm?] possible deadlock in gup_fast_fallback
  2024-04-21  3:14 [syzbot] [mm?] possible deadlock in gup_fast_fallback syzbot
@ 2024-07-24 14:10 ` syzbot
  2024-07-25  1:01 ` syzbot
  1 sibling, 0 replies; 3+ messages in thread
From: syzbot @ 2024-07-24 14:10 UTC (permalink / raw)
  To: akpm, linux-kernel, linux-mm, syzkaller-bugs

syzbot has found a reproducer for the following issue on:

HEAD commit:    786c8248dbd3 Merge tag 'perf-tools-fixes-for-v6.11-2024-07..
git tree:       upstream
console+strace: https://syzkaller.appspot.com/x/log.txt?x=15009665980000
kernel config:  https://syzkaller.appspot.com/x/.config?x=d732ba79a3d0331b
dashboard link: https://syzkaller.appspot.com/bug?extid=63ba90b81c16b86379bd
compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=162862e3980000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=10d14ce3980000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/a022c722f874/disk-786c8248.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/860e2faa9749/vmlinux-786c8248.xz
kernel image: https://storage.googleapis.com/syzbot-assets/518e4afe4ede/bzImage-786c8248.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/09d1622c5e09/mount_0.gz

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

ntfs3: loop0: Mark volume as dirty due to NTFS errors
ntfs3: loop0: Failed to load $Extend (-116).
ntfs3: loop0: Failed to initialize $Extend.
======================================================
WARNING: possible circular locking dependency detected
6.10.0-syzkaller-12246-g786c8248dbd3 #0 Not tainted
------------------------------------------------------
syz-executor288/5099 is trying to acquire lock:
ffff888063210b18 (&mm->mmap_lock){++++}-{3:3}, at: gup_fast_fallback+0x233/0x2b50 mm/gup.c:3367

but task is already holding lock:
ffff88807a2be310 (&sb->s_type->i_mutex_key#14){+.+.}-{3:3}, at: inode_trylock include/linux/fs.h:819 [inline]
ffff88807a2be310 (&sb->s_type->i_mutex_key#14){+.+.}-{3:3}, at: ntfs_file_write_iter+0x24a/0x740 fs/ntfs3/file.c:1166

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (&sb->s_type->i_mutex_key#14){+.+.}-{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+0xe8f/0x2090 mm/mmap.c:2927
       do_mmap+0x8ad/0xfa0 mm/mmap.c:1438
       vm_mmap_pgoff+0x1dd/0x3d0 mm/util.c:588
       ksys_mmap_pgoff+0x4f1/0x720 mm/mmap.c:1484
       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 (&mm->mmap_lock){++++}-{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
       gup_fast_fallback+0x24c/0x2b50 mm/gup.c:3367
       pin_user_pages_fast+0xcc/0x160 mm/gup.c:3491
       iov_iter_extract_user_pages lib/iov_iter.c:1583 [inline]
       iov_iter_extract_pages+0x3db/0x720 lib/iov_iter.c:1646
       dio_refill_pages fs/direct-io.c:173 [inline]
       dio_get_page fs/direct-io.c:214 [inline]
       do_direct_IO fs/direct-io.c:916 [inline]
       __blockdev_direct_IO+0x144c/0x4890 fs/direct-io.c:1249
       blockdev_direct_IO include/linux/fs.h:3212 [inline]
       ntfs_direct_IO+0x195/0x370 fs/ntfs3/inode.c:801
       generic_file_direct_write+0x130/0x350 mm/filemap.c:3941
       __generic_file_write_iter+0x129/0x230 mm/filemap.c:4107
       ntfs_file_write_iter+0x663/0x740 fs/ntfs3/file.c:1193
       do_iter_readv_writev+0x60a/0x890
       vfs_writev+0x37c/0xbb0 fs/read_write.c:971
       do_pwritev fs/read_write.c:1072 [inline]
       __do_sys_pwritev2 fs/read_write.c:1131 [inline]
       __se_sys_pwritev2+0x1ca/0x2d0 fs/read_write.c:1122
       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(&sb->s_type->i_mutex_key#14);
                               lock(&mm->mmap_lock);
                               lock(&sb->s_type->i_mutex_key#14);
  rlock(&mm->mmap_lock);

 *** DEADLOCK ***

2 locks held by syz-executor288/5099:
 #0: ffff888023990420 (sb_writers#9){.+.+}-{0:0}, at: file_start_write include/linux/fs.h:2876 [inline]
 #0: ffff888023990420 (sb_writers#9){.+.+}-{0:0}, at: vfs_writev+0x2d4/0xbb0 fs/read_write.c:969
 #1: ffff88807a2be310 (&sb->s_type->i_mutex_key#14){+.+.}-{3:3}, at: inode_trylock include/linux/fs.h:819 [inline]
 #1: ffff88807a2be310 (&sb->s_type->i_mutex_key#14){+.+.}-{3:3}, at: ntfs_file_write_iter+0x24a/0x740 fs/ntfs3/file.c:1166

stack backtrace:
CPU: 0 UID: 0 PID: 5099 Comm: syz-executor288 Not tainted 6.10.0-syzkaller-12246-g786c8248dbd3 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/27/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
 gup_fast_fallback+0x24c/0x2b50 mm/gup.c:3367
 pin_user_pages_fast+0xcc/0x160 mm/gup.c:3491
 iov_iter_extract_user_pages lib/iov_iter.c:1583 [inline]
 iov_iter_extract_pages+0x3db/0x720 lib/iov_iter.c:1646
 dio_refill_pages fs/direct-io.c:173 [inline]
 dio_get_page fs/direct-io.c:214 [inline]
 do_direct_IO fs/direct-io.c:916 [inline]
 __blockdev_direct_IO+0x144c/0x4890 fs/direct-io.c:1249
 blockdev_direct_IO include/linux/fs.h:3212 [inline]
 ntfs_direct_IO+0x195/0x370 fs/ntfs3/inode.c:801
 generic_file_direct_write+0x130/0x350 mm/filemap.c:3941
 __generic_file_write_iter+0x129/0x230 mm/filemap.c:4107
 ntfs_file_write_iter+0x663/0x740 fs/ntfs3/file.c:1193
 do_iter_readv_writev+0x60a/0x890
 vfs_writev+0x37c/0xbb0 fs/read_write.c:971
 do_pwritev fs/read_write.c:1072 [inline]
 __do_sys_pwritev2 fs/read_write.c:1131 [inline]
 __se_sys_pwritev2+0x1ca/0x2d0 fs/read_write.c:1122
 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:0x7fb9777dcb59
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 17 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:00007ffe15926128 EFLAGS: 00000246 ORIG_RAX: 0000000000000148
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fb9777dcb59
RDX: 0000000000000001 RSI: 0000000020000240 RDI: 0000000000000005
RBP: 00007fb97786f5f0 R08: 0000000000000000 R09: 0000000000000003
R10: 0000000000007000 R11: 0000000000000246 R12: 00007ffe15926160
R13: 00007ffe15926388 R14: 431bde82d7b634db R15: 00007fb97782503b
 </TASK>


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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [syzbot] [mm?] possible deadlock in gup_fast_fallback
  2024-04-21  3:14 [syzbot] [mm?] possible deadlock in gup_fast_fallback syzbot
  2024-07-24 14:10 ` syzbot
@ 2024-07-25  1:01 ` syzbot
  1 sibling, 0 replies; 3+ messages in thread
From: syzbot @ 2024-07-25  1:01 UTC (permalink / raw)
  To: akpm, almaz.alexandrovich, linux-kernel, linux-mm, syzkaller-bugs

syzbot has bisected this issue to:

commit 69505fe98f198ee813898cbcaf6770949636430b
Author: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Date:   Thu May 30 07:54:07 2024 +0000

    fs/ntfs3: Replace inode_trylock with inode_lock

bisection log:  https://syzkaller.appspot.com/x/bisect.txt?x=157ffac9980000
start commit:   786c8248dbd3 Merge tag 'perf-tools-fixes-for-v6.11-2024-07..
git tree:       upstream
final oops:     https://syzkaller.appspot.com/x/report.txt?x=177ffac9980000
console output: https://syzkaller.appspot.com/x/log.txt?x=137ffac9980000
kernel config:  https://syzkaller.appspot.com/x/.config?x=d732ba79a3d0331b
dashboard link: https://syzkaller.appspot.com/bug?extid=63ba90b81c16b86379bd
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=162862e3980000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=10d14ce3980000

Reported-by: syzbot+63ba90b81c16b86379bd@syzkaller.appspotmail.com
Fixes: 69505fe98f19 ("fs/ntfs3: Replace inode_trylock with inode_lock")

For information about bisection process see: https://goo.gl/tpsmEJ#bisection


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-07-25  1:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-21  3:14 [syzbot] [mm?] possible deadlock in gup_fast_fallback syzbot
2024-07-24 14:10 ` syzbot
2024-07-25  1:01 ` syzbot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox