====================================================== WARNING: possible circular locking dependency detected 5.19.0-rc8-syzkaller-00146-ge65c6a46df94 #0 Not tainted ------------------------------------------------------ syz-executor.0/6832 is trying to acquire lock: ffffffff8bf47408 (fscrypt_init_mutex){+.+.}-{3:3}, at: fscrypt_initialize+0x3c/0xa0 fs/crypto/crypto.c:324 but task is already holding lock: ffff88801b0d8990 (jbd2_handle){++++}-{0:0}, at: start_this_handle+0xfb4/0x14a0 fs/jbd2/transaction.c:461 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #3 (jbd2_handle){++++}-{0:0}: start_this_handle+0xfe7/0x14a0 fs/jbd2/transaction.c:463 jbd2__journal_start+0x399/0x930 fs/jbd2/transaction.c:520 __ext4_journal_start_sb+0x3a8/0x4a0 fs/ext4/ext4_jbd2.c:105 ext4_sample_last_mounted fs/ext4/file.c:820 [inline] ext4_file_open+0x5e7/0xb50 fs/ext4/file.c:849 do_dentry_open+0x4a1/0x11f0 fs/open.c:848 do_open fs/namei.c:3520 [inline] path_openat+0x1c71/0x2910 fs/namei.c:3653 do_filp_open+0x1aa/0x400 fs/namei.c:3680 do_sys_openat2+0x16d/0x4c0 fs/open.c:1278 do_sys_open fs/open.c:1294 [inline] __do_sys_openat fs/open.c:1310 [inline] __se_sys_openat fs/open.c:1305 [inline] __x64_sys_openat+0x13f/0x1f0 fs/open.c:1305 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd -> #2 (sb_internal){.+.+}-{0:0}: percpu_down_read include/linux/percpu-rwsem.h:51 [inline] __sb_start_write include/linux/fs.h:1699 [inline] sb_start_intwrite include/linux/fs.h:1821 [inline] ext4_evict_inode+0xea4/0x1970 fs/ext4/inode.c:238 evict+0x2ed/0x6b0 fs/inode.c:664 iput_final fs/inode.c:1744 [inline] iput.part.0+0x562/0x820 fs/inode.c:1770 iput+0x58/0x70 fs/inode.c:1760 dentry_unlink_inode+0x2b1/0x460 fs/dcache.c:401 __dentry_kill+0x3c0/0x640 fs/dcache.c:607 shrink_dentry_list+0x23c/0x800 fs/dcache.c:1201 prune_dcache_sb+0xe7/0x140 fs/dcache.c:1282 super_cache_scan+0x336/0x590 fs/super.c:104 do_shrink_slab+0x42d/0xbd0 mm/vmscan.c:770 shrink_slab+0x17c/0x6f0 mm/vmscan.c:930 shrink_node_memcgs mm/vmscan.c:3124 [inline] shrink_node+0x8b3/0x1db0 mm/vmscan.c:3245 kswapd_shrink_node mm/vmscan.c:4024 [inline] balance_pgdat+0x8ef/0x1570 mm/vmscan.c:4215 kswapd+0x7a5/0xf80 mm/vmscan.c:4475 kthread+0x2e9/0x3a0 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306 -> #1 (fs_reclaim){+.+.}-{0:0}: __fs_reclaim_acquire mm/page_alloc.c:4589 [inline] fs_reclaim_acquire+0x115/0x160 mm/page_alloc.c:4603 might_alloc include/linux/sched/mm.h:271 [inline] slab_pre_alloc_hook mm/slab.h:723 [inline] slab_alloc_node mm/slab.c:3200 [inline] kmem_cache_alloc_node_trace+0x48/0x5b0 mm/slab.c:3611 kmalloc_node include/linux/slab.h:618 [inline] kzalloc_node include/linux/slab.h:744 [inline] mempool_create_node mm/mempool.c:266 [inline] mempool_create+0x4e/0xc0 mm/mempool.c:255 mempool_create_page_pool include/linux/mempool.h:107 [inline] fscrypt_initialize+0x86/0xa0 fs/crypto/crypto.c:330 fscrypt_setup_encryption_info+0xef/0xe90 fs/crypto/keysetup.c:531 fscrypt_get_encryption_info+0x34a/0x3f0 fs/crypto/keysetup.c:640 fscrypt_prepare_readdir include/linux/fscrypt.h:972 [inline] ext4_readdir+0x1161/0x38b0 fs/ext4/dir.c:137 iterate_dir+0x56a/0x6f0 fs/readdir.c:65 __do_sys_getdents64 fs/readdir.c:369 [inline] __se_sys_getdents64 fs/readdir.c:354 [inline] __x64_sys_getdents64+0x13a/0x2c0 fs/readdir.c:354 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd -> #0 (fscrypt_init_mutex){+.+.}-{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+0x2abe/0x5660 kernel/locking/lockdep.c:5053 lock_acquire kernel/locking/lockdep.c:5665 [inline] lock_acquire+0x1ab/0x570 kernel/locking/lockdep.c:5630 __mutex_lock_common kernel/locking/mutex.c:603 [inline] __mutex_lock+0x12f/0x1350 kernel/locking/mutex.c:747 fscrypt_initialize+0x3c/0xa0 fs/crypto/crypto.c:324 fscrypt_setup_encryption_info+0xef/0xe90 fs/crypto/keysetup.c:531 fscrypt_get_encryption_info+0x34a/0x3f0 fs/crypto/keysetup.c:640 fscrypt_setup_filename+0x238/0xec0 fs/crypto/fname.c:433 ext4_fname_setup_filename+0x88/0x110 fs/ext4/crypto.c:28 ext4_add_entry+0x3aa/0xe30 fs/ext4/namei.c:2344 ext4_rename+0x190a/0x2650 fs/ext4/namei.c:3864 ext4_rename2+0x1c2/0x270 fs/ext4/namei.c:4144 vfs_rename+0xef2/0x17a0 fs/namei.c:4719 do_renameat2+0xb5e/0xc80 fs/namei.c:4870 __do_sys_renameat2 fs/namei.c:4903 [inline] __se_sys_renameat2 fs/namei.c:4900 [inline] __x64_sys_renameat2+0xe4/0x120 fs/namei.c:4900 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/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: fscrypt_init_mutex --> sb_internal --> jbd2_handle Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(jbd2_handle); lock(sb_internal); lock(jbd2_handle); lock(fscrypt_init_mutex); *** DEADLOCK *** 6 locks held by syz-executor.0/6832: #0: ffff8880445b2460 (sb_writers#5){.+.+}-{0:0}, at: do_renameat2+0x37b/0xc80 fs/namei.c:4806 #1: ffff8880445b2748 (&type->s_vfs_rename_key#2){+.+.}-{3:3}, at: lock_rename+0x54/0x280 fs/namei.c:3013 #2: ffff88802853b900 (&type->i_mutex_dir_key#3/1){+.+.}-{3:3}, at: inode_lock_nested include/linux/fs.h:776 [inline] #2: ffff88802853b900 (&type->i_mutex_dir_key#3/1){+.+.}-{3:3}, at: lock_rename+0xa0/0x280 fs/namei.c:3017 #3: ffff8880284c0700 (&type->i_mutex_dir_key#3/2){+.+.}-{3:3}, at: inode_lock_nested include/linux/fs.h:776 [inline] #3: ffff8880284c0700 (&type->i_mutex_dir_key#3/2){+.+.}-{3:3}, at: lock_rename+0xd4/0x280 fs/namei.c:3018 #4: ffff888024361680 (&sb->s_type->i_mutex_key#8/4){+.+.}-{3:3}, at: inode_lock_nested include/linux/fs.h:776 [inline] #4: ffff888024361680 (&sb->s_type->i_mutex_key#8/4){+.+.}-{3:3}, at: lock_two_nondirectories+0xd1/0x110 fs/inode.c:1124 #5: ffff88801b0d8990 (jbd2_handle){++++}-{0:0}, at: start_this_handle+0xfb4/0x14a0 fs/jbd2/transaction.c:461 stack backtrace: CPU: 1 PID: 6832 Comm: syz-executor.0 Not tainted 5.19.0-rc8-syzkaller-00146-ge65c6a46df94 #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.14.0-2 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106 check_noncircular+0x25f/0x2e0 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+0x2abe/0x5660 kernel/locking/lockdep.c:5053 lock_acquire kernel/locking/lockdep.c:5665 [inline] lock_acquire+0x1ab/0x570 kernel/locking/lockdep.c:5630 __mutex_lock_common kernel/locking/mutex.c:603 [inline] __mutex_lock+0x12f/0x1350 kernel/locking/mutex.c:747 fscrypt_initialize+0x3c/0xa0 fs/crypto/crypto.c:324 fscrypt_setup_encryption_info+0xef/0xe90 fs/crypto/keysetup.c:531 fscrypt_get_encryption_info+0x34a/0x3f0 fs/crypto/keysetup.c:640 fscrypt_setup_filename+0x238/0xec0 fs/crypto/fname.c:433 ext4_fname_setup_filename+0x88/0x110 fs/ext4/crypto.c:28 ext4_add_entry+0x3aa/0xe30 fs/ext4/namei.c:2344 ext4_rename+0x190a/0x2650 fs/ext4/namei.c:3864 ext4_rename2+0x1c2/0x270 fs/ext4/namei.c:4144 vfs_rename+0xef2/0x17a0 fs/namei.c:4719 do_renameat2+0xb5e/0xc80 fs/namei.c:4870 __do_sys_renameat2 fs/namei.c:4903 [inline] __se_sys_renameat2 fs/namei.c:4900 [inline] __x64_sys_renameat2+0xe4/0x120 fs/namei.c:4900 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f1251689209 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 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:00007f12527e1168 EFLAGS: 00000246 ORIG_RAX: 000000000000013c RAX: ffffffffffffffda RBX: 00007f125179bf60 RCX: 00007f1251689209 RDX: 0000000000000003 RSI: 0000000020000080 RDI: 0000000000000004 RBP: 00007f12516e3161 R08: 0000000000000004 R09: 0000000000000000 R10: 00000000200000c0 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffda1dffaaf R14: 00007f12527e1300 R15: 0000000000022000