fscrypt: key with description 'fscrypt:e8dab99234bb312e' has invalid payload ====================================================== WARNING: possible circular locking dependency detected 6.7.0-rc5-syzkaller-00042-g88035e5694a8 #0 Not tainted ------------------------------------------------------ syz-executor.1/30113 is trying to acquire lock: ffff888017935258 (&type->lock_class#4){++++}-{3:3}, at: find_and_lock_process_key+0x97/0x390 fs/crypto/keysetup_v1.c:112 but task is already holding lock: ffff888109036950 (jbd2_handle){++++}-{0:0}, at: start_this_handle+0x10d9/0x15e0 fs/jbd2/transaction.c:463 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #2 (jbd2_handle){++++}-{0:0}: start_this_handle+0x10ff/0x15e0 fs/jbd2/transaction.c:463 jbd2__journal_start+0x391/0x840 fs/jbd2/transaction.c:520 __ext4_journal_start_sb+0x343/0x5d0 fs/ext4/ext4_jbd2.c:112 __ext4_journal_start fs/ext4/ext4_jbd2.h:326 [inline] ext4_dirty_inode+0xa1/0x130 fs/ext4/inode.c:5962 __mark_inode_dirty+0x1e0/0xd60 fs/fs-writeback.c:2452 mark_inode_dirty_sync include/linux/fs.h:2311 [inline] iput.part.0+0x5b/0x7b0 fs/inode.c:1800 iput+0x5c/0x80 fs/inode.c:1793 dentry_unlink_inode+0x292/0x430 fs/dcache.c:401 __dentry_kill+0x3b8/0x640 fs/dcache.c:607 shrink_dentry_list+0x11e/0x4a0 fs/dcache.c:1201 prune_dcache_sb+0xeb/0x150 fs/dcache.c:1282 super_cache_scan+0x327/0x540 fs/super.c:228 do_shrink_slab+0x428/0x1120 mm/shrinker.c:435 shrink_slab+0x18a/0x1310 mm/shrinker.c:662 shrink_one+0x4f7/0x700 mm/vmscan.c:4724 shrink_many mm/vmscan.c:4776 [inline] lru_gen_shrink_node mm/vmscan.c:4893 [inline] shrink_node+0x20cd/0x3790 mm/vmscan.c:5833 kswapd_shrink_node mm/vmscan.c:6638 [inline] balance_pgdat+0x9d2/0x1a90 mm/vmscan.c:6828 kswapd+0x5be/0xbf0 mm/vmscan.c:7088 kthread+0x2c6/0x3a0 kernel/kthread.c:388 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:242 -> #1 (fs_reclaim){+.+.}-{0:0}: __fs_reclaim_acquire mm/page_alloc.c:3693 [inline] fs_reclaim_acquire+0x100/0x150 mm/page_alloc.c:3707 might_alloc include/linux/sched/mm.h:303 [inline] slab_pre_alloc_hook mm/slab.h:710 [inline] slab_alloc_node mm/slab.c:3221 [inline] __kmem_cache_alloc_node+0x42/0x460 mm/slab.c:3521 __do_kmalloc_node mm/slab_common.c:1006 [inline] __kmalloc+0x49/0x90 mm/slab_common.c:1020 kmalloc include/linux/slab.h:604 [inline] setup_v1_file_key_derived fs/crypto/keysetup_v1.c:278 [inline] fscrypt_setup_v1_file_key+0x167/0x550 fs/crypto/keysetup_v1.c:299 fscrypt_setup_v1_file_key_via_subscribed_keyrings+0x159/0x2d0 fs/crypto/keysetup_v1.c:321 setup_file_encryption_key fs/crypto/keysetup.c:485 [inline] fscrypt_setup_encryption_info+0xb69/0x1080 fs/crypto/keysetup.c:590 fscrypt_get_encryption_info+0x3d1/0x4b0 fs/crypto/keysetup.c:675 fscrypt_setup_filename+0x238/0xd80 fs/crypto/fname.c:458 __fscrypt_prepare_lookup+0x2c/0xf0 fs/crypto/hooks.c:100 fscrypt_prepare_lookup include/linux/fscrypt.h:979 [inline] ext4_fname_prepare_lookup+0x1d8/0x350 fs/ext4/crypto.c:48 ext4_lookup_entry fs/ext4/namei.c:1764 [inline] ext4_lookup+0x147/0x740 fs/ext4/namei.c:1839 lookup_open.isra.0+0x926/0x13b0 fs/namei.c:3455 open_last_lookups fs/namei.c:3546 [inline] path_openat+0x922/0x2c50 fs/namei.c:3776 do_filp_open+0x1de/0x430 fs/namei.c:3809 do_sys_openat2+0x176/0x1e0 fs/open.c:1440 do_sys_open fs/open.c:1455 [inline] __do_sys_open fs/open.c:1463 [inline] __se_sys_open fs/open.c:1459 [inline] __x64_sys_open+0x154/0x1e0 fs/open.c:1459 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0x40/0x110 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x63/0x6b -> #0 (&type->lock_class#4){++++}-{3:3}: check_prev_add kernel/locking/lockdep.c:3134 [inline] check_prevs_add kernel/locking/lockdep.c:3253 [inline] validate_chain kernel/locking/lockdep.c:3869 [inline] __lock_acquire+0x2433/0x3b20 kernel/locking/lockdep.c:5137 lock_acquire kernel/locking/lockdep.c:5754 [inline] lock_acquire+0x1ae/0x520 kernel/locking/lockdep.c:5719 down_read+0x9a/0x330 kernel/locking/rwsem.c:1526 find_and_lock_process_key+0x97/0x390 fs/crypto/keysetup_v1.c:112 fscrypt_setup_v1_file_key_via_subscribed_keyrings+0x115/0x2d0 fs/crypto/keysetup_v1.c:310 setup_file_encryption_key fs/crypto/keysetup.c:485 [inline] fscrypt_setup_encryption_info+0xb69/0x1080 fs/crypto/keysetup.c:590 fscrypt_get_encryption_info+0x3d1/0x4b0 fs/crypto/keysetup.c:675 fscrypt_setup_filename+0x238/0xd80 fs/crypto/fname.c:458 ext4_fname_setup_filename+0xa3/0x250 fs/ext4/crypto.c:28 ext4_add_entry+0x32b/0xe40 fs/ext4/namei.c:2403 ext4_rename+0x165e/0x2880 fs/ext4/namei.c:3932 ext4_rename2+0x1bc/0x270 fs/ext4/namei.c:4212 vfs_rename+0x13e0/0x1c30 fs/namei.c:4844 do_renameat2+0xc3c/0xdc0 fs/namei.c:4996 __do_sys_renameat fs/namei.c:5036 [inline] __se_sys_renameat fs/namei.c:5033 [inline] __x64_sys_renameat+0xc6/0x100 fs/namei.c:5033 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0x40/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: &type->lock_class#4 --> fs_reclaim --> jbd2_handle Possible unsafe locking scenario: CPU0 CPU1 ---- ---- rlock(jbd2_handle); lock(fs_reclaim); lock(jbd2_handle); rlock(&type->lock_class#4); *** DEADLOCK *** 6 locks held by syz-executor.1/30113: #0: ffff888020b22418 (sb_writers#5){.+.+}-{0:0}, at: do_renameat2+0x3d5/0xdc0 fs/namei.c:4930 #1: ffff888020b22700 (&type->s_vfs_rename_key#2){+.+.}-{3:3}, at: lock_rename fs/namei.c:3050 [inline] #1: ffff888020b22700 (&type->s_vfs_rename_key#2){+.+.}-{3:3}, at: do_renameat2+0x4ec/0xdc0 fs/namei.c:4935 #2: ffff888060d875c0 (&type->i_mutex_dir_key#3/1){+.+.}-{3:3}, at: inode_lock_nested include/linux/fs.h:837 [inline] #2: ffff888060d875c0 (&type->i_mutex_dir_key#3/1){+.+.}-{3:3}, at: lock_two_directories+0x65/0x1d0 fs/namei.c:3023 #3: ffff88802f9cf6c0 (&type->i_mutex_dir_key#3/2){+.+.}-{3:3}, at: inode_lock_nested include/linux/fs.h:837 [inline] #3: ffff88802f9cf6c0 (&type->i_mutex_dir_key#3/2){+.+.}-{3:3}, at: lock_two_directories+0x99/0x1d0 fs/namei.c:3024 #4: ffff88801f9cf400 (&type->i_mutex_dir_key#3){++++}-{3:3}, at: inode_lock_nested include/linux/fs.h:837 [inline] #4: ffff88801f9cf400 (&type->i_mutex_dir_key#3){++++}-{3:3}, at: lock_two_inodes+0x1b2/0x1e0 fs/inode.c:1129 #5: ffff888109036950 (jbd2_handle){++++}-{0:0}, at: start_this_handle+0x10d9/0x15e0 fs/jbd2/transaction.c:463 stack backtrace: CPU: 3 PID: 30113 Comm: syz-executor.1 Not tainted 6.7.0-rc5-syzkaller-00042-g88035e5694a8 #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd9/0x1b0 lib/dump_stack.c:106 check_noncircular+0x317/0x400 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 kernel/locking/lockdep.c:3869 [inline] __lock_acquire+0x2433/0x3b20 kernel/locking/lockdep.c:5137 lock_acquire kernel/locking/lockdep.c:5754 [inline] lock_acquire+0x1ae/0x520 kernel/locking/lockdep.c:5719 down_read+0x9a/0x330 kernel/locking/rwsem.c:1526 find_and_lock_process_key+0x97/0x390 fs/crypto/keysetup_v1.c:112 fscrypt_setup_v1_file_key_via_subscribed_keyrings+0x115/0x2d0 fs/crypto/keysetup_v1.c:310 setup_file_encryption_key fs/crypto/keysetup.c:485 [inline] fscrypt_setup_encryption_info+0xb69/0x1080 fs/crypto/keysetup.c:590 fscrypt_get_encryption_info+0x3d1/0x4b0 fs/crypto/keysetup.c:675 fscrypt_setup_filename+0x238/0xd80 fs/crypto/fname.c:458 ext4_fname_setup_filename+0xa3/0x250 fs/ext4/crypto.c:28 ext4_add_entry+0x32b/0xe40 fs/ext4/namei.c:2403 ext4_rename+0x165e/0x2880 fs/ext4/namei.c:3932 ext4_rename2+0x1bc/0x270 fs/ext4/namei.c:4212 vfs_rename+0x13e0/0x1c30 fs/namei.c:4844 do_renameat2+0xc3c/0xdc0 fs/namei.c:4996 __do_sys_renameat fs/namei.c:5036 [inline] __se_sys_renameat fs/namei.c:5033 [inline] __x64_sys_renameat+0xc6/0x100 fs/namei.c:5033 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0x40/0x110 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x63/0x6b RIP: 0033:0x7ff84587cba9 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:00007ff8443fe0c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000108 RAX: ffffffffffffffda RBX: 00007ff84599bf80 RCX: 00007ff84587cba9 RDX: 0000000000000004 RSI: 0000000020000100 RDI: ffffffffffffff9c RBP: 00007ff8458c847a R08: 0000000000000000 R09: 0000000000000000 R10: 0000000020000140 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007ff84599bf80 R15: 00007fffd04dc798 fscrypt: key with description 'fscrypt:e8dab99234bb312e' has invalid payload