====================================================== WARNING: possible circular locking dependency detected 5.19.0-syzkaller-02972-g200e340f2196 #0 Not tainted ------------------------------------------------------ syz-executor.0/16453 is trying to acquire lock: ffffffff8bf3e0e8 (fscrypt_init_mutex){+.+.}-{3:3}, at: fscrypt_initialize+0x3c/0xa0 fs/crypto/crypto.c:324 but task is already holding lock: ffff888042af4990 (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: -> #2 (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_journal_start fs/ext4/ext4_jbd2.h:326 [inline] ext4_dirty_inode+0x9d/0x110 fs/ext4/inode.c:5949 __mark_inode_dirty+0x495/0x1050 fs/fs-writeback.c:2381 mark_inode_dirty_sync include/linux/fs.h:2466 [inline] iput.part.0+0x57/0x820 fs/inode.c:1767 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+0x8b6/0x1dc0 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:4594 [inline] fs_reclaim_acquire+0x115/0x160 mm/page_alloc.c:4608 might_alloc include/linux/sched/mm.h:271 [inline] slab_pre_alloc_hook mm/slab.h:700 [inline] slab_alloc_node mm/slab.c:3200 [inline] kmem_cache_alloc_node_trace+0x47/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:538 fscrypt_get_encryption_info+0x34a/0x3f0 fs/crypto/keysetup.c:647 fscrypt_setup_filename+0x238/0xec0 fs/crypto/fname.c:433 __fscrypt_prepare_lookup+0x28/0xf0 fs/crypto/hooks.c:102 fscrypt_prepare_lookup include/linux/fscrypt.h:947 [inline] ext4_fname_prepare_lookup+0x1ba/0x200 fs/ext4/crypto.c:46 ext4_lookup_entry fs/ext4/namei.c:1717 [inline] ext4_lookup fs/ext4/namei.c:1792 [inline] ext4_lookup+0x12d/0x700 fs/ext4/namei.c:1783 __lookup_slow+0x24c/0x460 fs/namei.c:1685 lookup_slow fs/namei.c:1702 [inline] walk_component+0x33f/0x5a0 fs/namei.c:1993 lookup_last fs/namei.c:2450 [inline] path_lookupat+0x1ba/0x840 fs/namei.c:2474 filename_lookup+0x1ce/0x590 fs/namei.c:2503 user_path_at_empty+0x42/0x60 fs/namei.c:2876 user_path_at include/linux/namei.h:57 [inline] bpf_obj_do_get kernel/bpf/inode.c:506 [inline] bpf_obj_get_user+0x9c/0x4e0 kernel/bpf/inode.c:541 bpf_obj_get kernel/bpf/syscall.c:2643 [inline] __sys_bpf+0x1266/0x5700 kernel/bpf/syscall.c:4923 __do_sys_bpf kernel/bpf/syscall.c:5021 [inline] __se_sys_bpf kernel/bpf/syscall.c:5019 [inline] __x64_sys_bpf+0x75/0xb0 kernel/bpf/syscall.c:5019 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+0x2aba/0x5660 kernel/locking/lockdep.c:5053 lock_acquire kernel/locking/lockdep.c:5666 [inline] lock_acquire+0x1ab/0x570 kernel/locking/lockdep.c:5631 __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:538 fscrypt_get_encryption_info+0x34a/0x3f0 fs/crypto/keysetup.c:647 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+0x115e/0x1a90 fs/namei.c:4698 do_renameat2+0xb5e/0xc80 fs/namei.c:4849 __do_sys_renameat2 fs/namei.c:4882 [inline] __se_sys_renameat2 fs/namei.c:4879 [inline] __x64_sys_renameat2+0xe4/0x120 fs/namei.c:4879 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 --> fs_reclaim --> jbd2_handle Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(jbd2_handle); lock(fs_reclaim); lock(jbd2_handle); lock(fscrypt_init_mutex); *** DEADLOCK *** 6 locks held by syz-executor.0/16453: #0: ffff888042af0460 (sb_writers#5){.+.+}-{0:0}, at: do_renameat2+0x37b/0xc80 fs/namei.c:4785 #1: ffff888042af0748 (&type->s_vfs_rename_key#2){+.+.}-{3:3}, at: lock_rename+0x54/0x280 fs/namei.c:2994 #2: ffff8880287145c0 (&type->i_mutex_dir_key#3/1){+.+.}-{3:3}, at: inode_lock_nested include/linux/fs.h:795 [inline] #2: ffff8880287145c0 (&type->i_mutex_dir_key#3/1){+.+.}-{3:3}, at: lock_rename+0xa0/0x280 fs/namei.c:2998 #3: ffff8880286a45c0 (&type->i_mutex_dir_key#3/2){+.+.}-{3:3}, at: inode_lock_nested include/linux/fs.h:795 [inline] #3: ffff8880286a45c0 (&type->i_mutex_dir_key#3/2){+.+.}-{3:3}, at: lock_rename+0xd4/0x280 fs/namei.c:2999 #4: ffff888023f3a640 (&sb->s_type->i_mutex_key#8/4){+.+.}-{3:3}, at: inode_lock_nested include/linux/fs.h:795 [inline] #4: ffff888023f3a640 (&sb->s_type->i_mutex_key#8/4){+.+.}-{3:3}, at: lock_two_nondirectories+0xd1/0x110 fs/inode.c:1124 #5: ffff888042af4990 (jbd2_handle){++++}-{0:0}, at: start_this_handle+0xfb4/0x14a0 fs/jbd2/transaction.c:461 stack backtrace: CPU: 3 PID: 16453 Comm: syz-executor.0 Not tainted 5.19.0-syzkaller-02972-g200e340f2196 #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+0x2aba/0x5660 kernel/locking/lockdep.c:5053 lock_acquire kernel/locking/lockdep.c:5666 [inline] lock_acquire+0x1ab/0x570 kernel/locking/lockdep.c:5631 __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:538 fscrypt_get_encryption_info+0x34a/0x3f0 fs/crypto/keysetup.c:647 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+0x115e/0x1a90 fs/namei.c:4698 do_renameat2+0xb5e/0xc80 fs/namei.c:4849 __do_sys_renameat2 fs/namei.c:4882 [inline] __se_sys_renameat2 fs/namei.c:4879 [inline] __x64_sys_renameat2+0xe4/0x120 fs/namei.c:4879 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:0x7f3393289279 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:00007f339433a168 EFLAGS: 00000246 ORIG_RAX: 000000000000013c RAX: ffffffffffffffda RBX: 00007f339339bf80 RCX: 00007f3393289279 RDX: 0000000000000003 RSI: 0000000020000080 RDI: 0000000000000004 RBP: 00007f33932e3189 R08: 0000000000000004 R09: 0000000000000000 R10: 00000000200000c0 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffd3dca2bcf R14: 00007f339433a300 R15: 0000000000022000