====================================================== WARNING: possible circular locking dependency detected 6.2.0-next-20230302-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor761/5144 is trying to acquire lock: ffff88807cb8f090 (&sbi->lock){+.+.}-{3:3}, at: reiserfs_write_lock+0x79/0x100 fs/reiserfs/lock.c:27 but task is already holding lock: ffff8880785fe558 (sb_pagefaults){.+.+}-{0:0}, at: do_page_mkwrite+0x1a1/0x690 mm/memory.c:2930 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #2 (sb_pagefaults){.+.+}-{0:0}: percpu_down_read include/linux/percpu-rwsem.h:51 [inline] __sb_start_write include/linux/fs.h:1477 [inline] sb_start_pagefault include/linux/fs.h:1581 [inline] filemap_page_mkwrite+0x174/0x790 mm/filemap.c:3569 do_page_mkwrite+0x1a1/0x690 mm/memory.c:2930 do_shared_fault mm/memory.c:4567 [inline] do_fault mm/memory.c:4635 [inline] handle_pte_fault mm/memory.c:4919 [inline] __handle_mm_fault+0x224e/0x3e70 mm/memory.c:5061 handle_mm_fault+0x2c0/0x9c0 mm/memory.c:5207 do_user_addr_fault+0x511/0x1210 arch/x86/mm/fault.c:1440 handle_page_fault arch/x86/mm/fault.c:1534 [inline] exc_page_fault+0x98/0x170 arch/x86/mm/fault.c:1590 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:570 -> #1 (&mm->mmap_lock){++++}-{3:3}: __might_fault mm/memory.c:5696 [inline] __might_fault+0x10c/0x180 mm/memory.c:5689 reiserfs_ioctl+0x1d2/0x330 fs/reiserfs/ioctl.c:96 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:870 [inline] __se_sys_ioctl fs/ioctl.c:856 [inline] __x64_sys_ioctl+0x197/0x210 fs/ioctl.c:856 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd -> #0 (&sbi->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+0x2ec7/0x5d40 kernel/locking/lockdep.c:5056 lock_acquire.part.0+0x11a/0x370 kernel/locking/lockdep.c:5669 __mutex_lock_common kernel/locking/mutex.c:603 [inline] __mutex_lock+0x12f/0x1350 kernel/locking/mutex.c:747 reiserfs_write_lock+0x79/0x100 fs/reiserfs/lock.c:27 reiserfs_dirty_inode+0xd2/0x260 fs/reiserfs/super.c:704 __mark_inode_dirty+0x247/0x1250 fs/fs-writeback.c:2421 generic_update_time+0x21b/0x2b0 fs/inode.c:1860 inode_update_time fs/inode.c:1873 [inline] __file_update_time fs/inode.c:2058 [inline] file_update_time+0x224/0x270 fs/inode.c:2089 filemap_page_mkwrite+0x28c/0x790 mm/filemap.c:3570 do_page_mkwrite+0x1a1/0x690 mm/memory.c:2930 do_shared_fault mm/memory.c:4567 [inline] do_fault mm/memory.c:4635 [inline] handle_pte_fault mm/memory.c:4919 [inline] __handle_mm_fault+0x224e/0x3e70 mm/memory.c:5061 handle_mm_fault+0x2c0/0x9c0 mm/memory.c:5207 do_user_addr_fault+0x511/0x1210 arch/x86/mm/fault.c:1440 handle_page_fault arch/x86/mm/fault.c:1534 [inline] exc_page_fault+0x98/0x170 arch/x86/mm/fault.c:1590 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:570 other info that might help us debug this: Chain exists of: &sbi->lock --> &mm->mmap_lock --> sb_pagefaults Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(sb_pagefaults); lock(&mm->mmap_lock); lock(sb_pagefaults); lock(&sbi->lock); *** DEADLOCK *** 2 locks held by syz-executor761/5144: #0: ffff888027170ad8 (&mm->mmap_lock){++++}-{3:3}, at: mmap_read_trylock include/linux/mmap_lock.h:161 [inline] #0: ffff888027170ad8 (&mm->mmap_lock){++++}-{3:3}, at: do_user_addr_fault+0x43f/0x1210 arch/x86/mm/fault.c:1381 #1: ffff8880785fe558 (sb_pagefaults){.+.+}-{0:0}, at: do_page_mkwrite+0x1a1/0x690 mm/memory.c:2930 stack backtrace: CPU: 1 PID: 5144 Comm: syz-executor761 Not tainted 6.2.0-next-20230302-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/16/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd9/0x150 lib/dump_stack.c:106 check_noncircular+0x25f/0x2e0 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+0x2ec7/0x5d40 kernel/locking/lockdep.c:5056 lock_acquire.part.0+0x11a/0x370 kernel/locking/lockdep.c:5669 __mutex_lock_common kernel/locking/mutex.c:603 [inline] __mutex_lock+0x12f/0x1350 kernel/locking/mutex.c:747 reiserfs_write_lock+0x79/0x100 fs/reiserfs/lock.c:27 reiserfs_dirty_inode+0xd2/0x260 fs/reiserfs/super.c:704 __mark_inode_dirty+0x247/0x1250 fs/fs-writeback.c:2421 generic_update_time+0x21b/0x2b0 fs/inode.c:1860 inode_update_time fs/inode.c:1873 [inline] __file_update_time fs/inode.c:2058 [inline] file_update_time+0x224/0x270 fs/inode.c:2089 filemap_page_mkwrite+0x28c/0x790 mm/filemap.c:3570 do_page_mkwrite+0x1a1/0x690 mm/memory.c:2930 do_shared_fault mm/memory.c:4567 [inline] do_fault mm/memory.c:4635 [inline] handle_pte_fault mm/memory.c:4919 [inline] __handle_mm_fault+0x224e/0x3e70 mm/memory.c:5061 handle_mm_fault+0x2c0/0x9c0 mm/memory.c:5207 do_user_addr_fault+0x511/0x1210 arch/x86/mm/fault.c:1440 handle_page_fault arch/x86/mm/fault.c:1534 [inline] exc_page_fault+0x98/0x170 arch/x86/mm/fault.c:1590 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:570 RIP: 0033:0x7f6d3e3065a3 Code: 00 e8 21 26 04 00 48 8b 35 ba 5b 0b 00 31 c9 31 c0 ba 01 76 08 80 bf 10 00 00 00 e8 07 26 04 00 b8 98 00 00 20 b9 20 00 00 00 04 25 80 00 00 20 08 00 00 00 66 c7 04 25 84 00 00 20 20 01 48 RSP: 002b:00007ffea8c6ad70 EFLAGS: 00010286 RAX: 0000000020000098 RBX: 00000000000141a1 RCX: 0000000000000020 RDX: 0000000000000000 RSI: 0000000080087601 RDI: 0000000000000004 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000005 R11: 0000000000000246 R12: 00007ffea8c6ad9c R13: 00007ffea8c6add0 R14: 00007ffea8c6adb0 R15: 0000000000000004