syzbot


possible deadlock in reiserfs_get_block (2)

Status: auto-obsoleted due to no activity on 2024/04/13 20:35
Subsystems: reiserfs
[Documentation on labels]
Reported-by: syzbot+d5cbfdc994a7376f6088@syzkaller.appspotmail.com
First crash: 192d, last: 163d
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] [reiserfs?] possible deadlock in reiserfs_get_block (2) 0 (1) 2023/12/12 13:43
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in reiserfs_get_block reiserfs 13 354d 540d 0/27 auto-obsoleted due to no activity on 2023/10/05 20:29

Sample crash report:
REISERFS (device loop3): Created .reiserfs_priv - reserved for xattr storage.
======================================================
WARNING: possible circular locking dependency detected
6.7.0-rc8-syzkaller-00055-g5eff55d725a4 #0 Not tainted
------------------------------------------------------
syz-executor.3/12458 is trying to acquire lock:
ffff88802b08baa0 (&mm->mmap_lock){++++}-{3:3}, at: __might_fault+0xa5/0x120 mm/memory.c:5956

but task is already holding lock:
ffff8880208f9090 (&sbi->lock){+.+.}-{3:3}, at: reiserfs_write_lock+0x7a/0xd0 fs/reiserfs/lock.c:27

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #3 (&sbi->lock){+.+.}-{3:3}:
       lock_acquire+0x1e3/0x530 kernel/locking/lockdep.c:5754
       __mutex_lock_common kernel/locking/mutex.c:603 [inline]
       __mutex_lock+0x136/0xd60 kernel/locking/mutex.c:747
       reiserfs_write_lock+0x7a/0xd0 fs/reiserfs/lock.c:27
       reiserfs_get_block+0x280/0x5130 fs/reiserfs/inode.c:680
       do_mpage_readpage+0x90c/0x1f60 fs/mpage.c:233
       mpage_readahead+0x44f/0x930 fs/mpage.c:381
       read_pages+0x183/0x830 mm/readahead.c:160
       page_cache_ra_unbounded+0x68e/0x7c0 mm/readahead.c:269
       do_sync_mmap_readahead+0x444/0x850
       filemap_fault+0x7c6/0x1670 mm/filemap.c:3242
       __do_fault+0x133/0x4e0 mm/memory.c:4266
       do_read_fault mm/memory.c:4629 [inline]
       do_fault mm/memory.c:4763 [inline]
       do_pte_missing mm/memory.c:3731 [inline]
       handle_pte_fault mm/memory.c:5039 [inline]
       __handle_mm_fault mm/memory.c:5180 [inline]
       handle_mm_fault+0x4c9b/0x6680 mm/memory.c:5345
       faultin_page mm/gup.c:956 [inline]
       __get_user_pages+0x6bd/0x15f0 mm/gup.c:1239
       populate_vma_page_range+0x2aa/0x370 mm/gup.c:1677
       __mm_populate+0x279/0x450 mm/gup.c:1786
       mm_populate include/linux/mm.h:3379 [inline]
       vm_mmap_pgoff+0x304/0x420 mm/util.c:561
       ksys_mmap_pgoff+0x4ff/0x6d0 mm/mmap.c:1425
       do_syscall_x64 arch/x86/entry/common.c:52 [inline]
       do_syscall_64+0x45/0x110 arch/x86/entry/common.c:83
       entry_SYSCALL_64_after_hwframe+0x63/0x6b

-> #2 (mapping.invalidate_lock#11){.+.+}-{3:3}:
       lock_acquire+0x1e3/0x530 kernel/locking/lockdep.c:5754
       down_read+0xb1/0xa40 kernel/locking/rwsem.c:1526
       filemap_invalidate_lock_shared include/linux/fs.h:857 [inline]
       filemap_fault+0x646/0x1670 mm/filemap.c:3234
       __do_fault+0x133/0x4e0 mm/memory.c:4266
       do_shared_fault mm/memory.c:4693 [inline]
       do_fault mm/memory.c:4767 [inline]
       do_pte_missing mm/memory.c:3731 [inline]
       handle_pte_fault mm/memory.c:5039 [inline]
       __handle_mm_fault mm/memory.c:5180 [inline]
       handle_mm_fault+0x21e9/0x6680 mm/memory.c:5345
       do_user_addr_fault arch/x86/mm/fault.c:1364 [inline]
       handle_page_fault arch/x86/mm/fault.c:1505 [inline]
       exc_page_fault+0x456/0x870 arch/x86/mm/fault.c:1561
       asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:570

-> #1 (&vma->vm_lock->lock){++++}-{3:3}:
       lock_acquire+0x1e3/0x530 kernel/locking/lockdep.c:5754
       down_write+0x3a/0x50 kernel/locking/rwsem.c:1579
       vma_start_write include/linux/mm.h:716 [inline]
       vma_link+0x2c9/0x540 mm/mmap.c:404
       insert_vm_struct+0x19f/0x260 mm/mmap.c:3378
       __bprm_mm_init fs/exec.c:281 [inline]
       bprm_mm_init fs/exec.c:383 [inline]
       alloc_bprm+0x4d5/0x900 fs/exec.c:1532
       kernel_execve+0x96/0xa20 fs/exec.c:1987
       call_usermodehelper_exec_async+0x233/0x370 kernel/umh.c:110
       ret_from_fork+0x48/0x80 arch/x86/kernel/process.c:147
       ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:242

-> #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+0x1909/0x5ab0 kernel/locking/lockdep.c:3869
       __lock_acquire+0x1345/0x1fd0 kernel/locking/lockdep.c:5137
       lock_acquire+0x1e3/0x530 kernel/locking/lockdep.c:5754
       __might_fault+0xc1/0x120 mm/memory.c:5956
       reiserfs_ioctl+0x125/0x2f0 fs/reiserfs/ioctl.c:96
       vfs_ioctl fs/ioctl.c:51 [inline]
       __do_sys_ioctl fs/ioctl.c:871 [inline]
       __se_sys_ioctl+0xf8/0x170 fs/ioctl.c:857
       do_syscall_x64 arch/x86/entry/common.c:52 [inline]
       do_syscall_64+0x45/0x110 arch/x86/entry/common.c:83
       entry_SYSCALL_64_after_hwframe+0x63/0x6b

other info that might help us debug this:

Chain exists of:
  &mm->mmap_lock --> mapping.invalidate_lock#11 --> &sbi->lock

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&sbi->lock);
                               lock(mapping.invalidate_lock#11);
                               lock(&sbi->lock);
  rlock(&mm->mmap_lock);

 *** DEADLOCK ***

1 lock held by syz-executor.3/12458:
 #0: ffff8880208f9090 (&sbi->lock){+.+.}-{3:3}, at: reiserfs_write_lock+0x7a/0xd0 fs/reiserfs/lock.c:27

stack backtrace:
CPU: 0 PID: 12458 Comm: syz-executor.3 Not tainted 6.7.0-rc8-syzkaller-00055-g5eff55d725a4 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/17/2023
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e7/0x2d0 lib/dump_stack.c:106
 check_noncircular+0x366/0x490 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+0x1909/0x5ab0 kernel/locking/lockdep.c:3869
 __lock_acquire+0x1345/0x1fd0 kernel/locking/lockdep.c:5137
 lock_acquire+0x1e3/0x530 kernel/locking/lockdep.c:5754
 __might_fault+0xc1/0x120 mm/memory.c:5956
 reiserfs_ioctl+0x125/0x2f0 fs/reiserfs/ioctl.c:96
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:871 [inline]
 __se_sys_ioctl+0xf8/0x170 fs/ioctl.c:857
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0x45/0x110 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x63/0x6b
RIP: 0033:0x7fab9727cce9
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:00007fab95dfe0c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007fab9739bf80 RCX: 00007fab9727cce9
RDX: 0000000020000100 RSI: 0000000080087601 RDI: 0000000000000004
RBP: 00007fab972c947a R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 000000000000000b R14: 00007fab9739bf80 R15: 00007ffe1959cfb8
 </TASK>

Crashes (5):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/01/04 20:35 upstream 5eff55d725a4 28c42cff .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in reiserfs_get_block
2024/01/02 22:53 upstream 610a9b8f49fb fb427a07 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in reiserfs_get_block
2024/01/02 17:44 upstream 610a9b8f49fb fb427a07 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in reiserfs_get_block
2023/12/27 04:47 upstream fbafc3e621c3 fb427a07 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in reiserfs_get_block
2023/12/06 12:44 upstream bee0e7762ad2 858d62d1 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in reiserfs_get_block
* Struck through repros no longer work on HEAD.