fscrypt: key with description 'fscrypt:85baa174f0cb1142' has invalid payload fscrypt: key with description 'fscrypt:85baa174f0cb1142' has invalid payload ====================================================== WARNING: possible circular locking dependency detected 6.8.0-rc6-syzkaller-00024-ge326df53af00 #0 Not tainted ------------------------------------------------------ syz-executor.0/7259 is trying to acquire lock: ffff888060cfeb18 (&type->lock_class#6){++++}-{3:3}, at: find_and_lock_process_key+0x97/0x390 fs/crypto/keysetup_v1.c:112 but task is already holding lock: ffff888023daa950 (jbd2_handle){++++}-{0:0}, at: start_this_handle+0x10dd/0x15e0 fs/jbd2/transaction.c:463 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #3 (jbd2_handle){++++}-{0:0}: start_this_handle+0x1103/0x15e0 fs/jbd2/transaction.c:463 jbd2__journal_start+0x395/0x850 fs/jbd2/transaction.c:520 __ext4_journal_start_sb+0x347/0x5e0 fs/ext4/ext4_jbd2.c:112 ext4_sample_last_mounted fs/ext4/file.c:837 [inline] ext4_file_open+0x636/0xc80 fs/ext4/file.c:866 do_dentry_open+0x8da/0x18c0 fs/open.c:953 do_open fs/namei.c:3645 [inline] path_openat+0x1e00/0x29a0 fs/namei.c:3802 do_filp_open+0x1de/0x440 fs/namei.c:3829 do_sys_openat2+0x17a/0x1e0 fs/open.c:1404 do_sys_open fs/open.c:1419 [inline] __do_sys_openat fs/open.c:1435 [inline] __se_sys_openat fs/open.c:1430 [inline] __x64_sys_openat+0x175/0x210 fs/open.c:1430 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xd5/0x270 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x6f/0x77 -> #2 (sb_internal){.+.+}-{0:0}: percpu_down_read include/linux/percpu-rwsem.h:51 [inline] __sb_start_write include/linux/fs.h:1641 [inline] sb_start_intwrite include/linux/fs.h:1824 [inline] ext4_evict_inode+0xe5f/0x1a40 fs/ext4/inode.c:212 evict+0x2ed/0x6c0 fs/inode.c:665 iput_final fs/inode.c:1739 [inline] iput.part.0+0x563/0x7b0 fs/inode.c:1765 iput+0x5c/0x80 fs/inode.c:1755 dentry_unlink_inode+0x295/0x440 fs/dcache.c:400 __dentry_kill+0x1d0/0x600 fs/dcache.c:603 dput.part.0+0x4b1/0x9b0 fs/dcache.c:845 dput+0x1f/0x30 fs/dcache.c:835 ovl_stack_put+0x60/0x90 fs/overlayfs/util.c:132 ovl_destroy_inode+0xc6/0x190 fs/overlayfs/super.c:190 destroy_inode+0xc4/0x1b0 fs/inode.c:310 iput_final fs/inode.c:1739 [inline] iput.part.0+0x563/0x7b0 fs/inode.c:1765 iput+0x5c/0x80 fs/inode.c:1755 dentry_unlink_inode+0x295/0x440 fs/dcache.c:400 __dentry_kill+0x1d0/0x600 fs/dcache.c:603 shrink_kill fs/dcache.c:1048 [inline] shrink_dentry_list+0x140/0x5d0 fs/dcache.c:1075 prune_dcache_sb+0xeb/0x150 fs/dcache.c:1156 super_cache_scan+0x32a/0x550 fs/super.c:221 do_shrink_slab+0x426/0x1120 mm/shrinker.c:435 shrink_slab_memcg mm/shrinker.c:548 [inline] shrink_slab+0xa87/0x1310 mm/shrinker.c:626 shrink_one+0x493/0x7b0 mm/vmscan.c:4767 shrink_many mm/vmscan.c:4828 [inline] lru_gen_shrink_node mm/vmscan.c:4929 [inline] shrink_node+0x214d/0x3750 mm/vmscan.c:5888 kswapd_shrink_node mm/vmscan.c:6693 [inline] balance_pgdat+0x9d2/0x1a90 mm/vmscan.c:6883 kswapd+0x5be/0xc00 mm/vmscan.c:7143 kthread+0x2c6/0x3b0 kernel/kthread.c:388 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1b/0x30 arch/x86/entry/entry_64.S:243 -> #1 (fs_reclaim){+.+.}-{0:0}: __fs_reclaim_acquire mm/page_alloc.c:3692 [inline] fs_reclaim_acquire+0x104/0x150 mm/page_alloc.c:3706 might_alloc include/linux/sched/mm.h:303 [inline] slab_pre_alloc_hook mm/slub.c:3761 [inline] slab_alloc_node mm/slub.c:3842 [inline] __do_kmalloc_node mm/slub.c:3980 [inline] __kmalloc+0xb5/0x440 mm/slub.c:3994 kmalloc include/linux/slab.h:594 [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/0x2e0 fs/crypto/keysetup_v1.c:321 setup_file_encryption_key fs/crypto/keysetup.c:485 [inline] fscrypt_setup_encryption_info+0xb6d/0x1080 fs/crypto/keysetup.c:590 fscrypt_get_encryption_info+0x3d7/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+0x1e0/0x350 fs/ext4/crypto.c:48 ext4_lookup_entry fs/ext4/namei.c:1764 [inline] ext4_lookup+0x14b/0x740 fs/ext4/namei.c:1839 lookup_one_qstr_excl+0x11d/0x190 fs/namei.c:1608 filename_create+0x1ed/0x530 fs/namei.c:3896 do_symlinkat+0xbf/0x310 fs/namei.c:4503 __do_sys_symlinkat fs/namei.c:4526 [inline] __se_sys_symlinkat fs/namei.c:4523 [inline] __x64_sys_symlinkat+0x97/0xc0 fs/namei.c:4523 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xd5/0x270 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x6f/0x77 -> #0 (&type->lock_class#6){++++}-{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+0x244f/0x3b40 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/0x2e0 fs/crypto/keysetup_v1.c:310 setup_file_encryption_key fs/crypto/keysetup.c:485 [inline] fscrypt_setup_encryption_info+0xb6d/0x1080 fs/crypto/keysetup.c:590 fscrypt_get_encryption_info+0x3d7/0x4b0 fs/crypto/keysetup.c:675 fscrypt_setup_filename+0x238/0xd80 fs/crypto/fname.c:458 ext4_fname_setup_filename+0xa3/0x260 fs/ext4/crypto.c:28 ext4_add_entry+0x2e3/0xdf0 fs/ext4/namei.c:2401 ext4_rename+0x16a9/0x28a0 fs/ext4/namei.c:3937 ext4_rename2+0x1bc/0x270 fs/ext4/namei.c:4215 vfs_rename+0xf87/0x20b0 fs/namei.c:4883 do_renameat2+0xc54/0xdc0 fs/namei.c:5040 __do_sys_renameat fs/namei.c:5081 [inline] __se_sys_renameat fs/namei.c:5078 [inline] __x64_sys_renameat+0xc6/0x100 fs/namei.c:5078 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xd5/0x270 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x6f/0x77 other info that might help us debug this: Chain exists of: &type->lock_class#6 --> sb_internal --> jbd2_handle Possible unsafe locking scenario: CPU0 CPU1 ---- ---- rlock(jbd2_handle); lock(sb_internal); lock(jbd2_handle); rlock(&type->lock_class#6); *** DEADLOCK *** 6 locks held by syz-executor.0/7259: #0: ffff888023636420 (sb_writers#5){.+.+}-{0:0}, at: do_renameat2+0x3d6/0xdc0 fs/namei.c:4970 #1: ffff888023636708 (&type->s_vfs_rename_key#2){+.+.}-{3:3}, at: lock_rename fs/namei.c:3073 [inline] #1: ffff888023636708 (&type->s_vfs_rename_key#2){+.+.}-{3:3}, at: do_renameat2+0x4ef/0xdc0 fs/namei.c:4975 #2: ffff88810df96800 (&type->i_mutex_dir_key#3/1){+.+.}-{3:3}, at: inode_lock_nested include/linux/fs.h:839 [inline] #2: ffff88810df96800 (&type->i_mutex_dir_key#3/1){+.+.}-{3:3}, at: lock_two_directories+0x92/0x2d0 fs/namei.c:3039 #3: ffff88810c508400 (&type->i_mutex_dir_key#3/5){+.+.}-{3:3}, at: inode_lock_nested include/linux/fs.h:839 [inline] #3: ffff88810c508400 (&type->i_mutex_dir_key#3/5){+.+.}-{3:3}, at: lock_two_directories+0xc6/0x2d0 fs/namei.c:3040 #4: ffff88810df97200 (&type->i_mutex_dir_key#3/2){+.+.}-{3:3}, at: inode_lock_nested include/linux/fs.h:839 [inline] #4: ffff88810df97200 (&type->i_mutex_dir_key#3/2){+.+.}-{3:3}, at: vfs_rename+0x117e/0x20b0 fs/namei.c:4846 #5: ffff888023daa950 (jbd2_handle){++++}-{0:0}, at: start_this_handle+0x10dd/0x15e0 fs/jbd2/transaction.c:463 stack backtrace: CPU: 0 PID: 7259 Comm: syz-executor.0 Not tainted 6.8.0-rc6-syzkaller-00024-ge326df53af00 #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+0x31b/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+0x244f/0x3b40 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/0x2e0 fs/crypto/keysetup_v1.c:310 setup_file_encryption_key fs/crypto/keysetup.c:485 [inline] fscrypt_setup_encryption_info+0xb6d/0x1080 fs/crypto/keysetup.c:590 fscrypt_get_encryption_info+0x3d7/0x4b0 fs/crypto/keysetup.c:675 fscrypt_setup_filename+0x238/0xd80 fs/crypto/fname.c:458 ext4_fname_setup_filename+0xa3/0x260 fs/ext4/crypto.c:28 ext4_add_entry+0x2e3/0xdf0 fs/ext4/namei.c:2401 ext4_rename+0x16a9/0x28a0 fs/ext4/namei.c:3937 ext4_rename2+0x1bc/0x270 fs/ext4/namei.c:4215 vfs_rename+0xf87/0x20b0 fs/namei.c:4883 do_renameat2+0xc54/0xdc0 fs/namei.c:5040 __do_sys_renameat fs/namei.c:5081 [inline] __se_sys_renameat fs/namei.c:5078 [inline] __x64_sys_renameat+0xc6/0x100 fs/namei.c:5078 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xd5/0x270 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x6f/0x77 RIP: 0033:0x7f629427dda9 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:00007f62950900c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000108 RAX: ffffffffffffffda RBX: 00007f62943abf80 RCX: 00007f629427dda9 RDX: 0000000000000004 RSI: 0000000020000100 RDI: ffffffffffffff9c RBP: 00007f62942ca47a R08: 0000000000000000 R09: 0000000000000000 R10: 0000000020000140 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007f62943abf80 R15: 00007fff4e959568 fscrypt: key with description 'fscrypt:85baa174f0cb1142' has invalid payload