====================================================== WARNING: possible circular locking dependency detected 6.6.0-rc4-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.0/2651 is trying to acquire lock: ffff888107a57688 (&of->mutex){+.+.}-{3:3}, at: kernfs_fop_llseek+0x33/0xc0 fs/kernfs/file.c:916 but task is already holding lock: ffff88810ae97f30 (&ovl_i_lock_key[depth]){+.+.}-{3:3}, at: ovl_inode_lock fs/overlayfs/overlayfs.h:597 [inline] ffff88810ae97f30 (&ovl_i_lock_key[depth]){+.+.}-{3:3}, at: ovl_llseek+0xe5/0x1a0 fs/overlayfs/file.c:223 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #3 (&ovl_i_lock_key[depth]){+.+.}-{3:3}: __mutex_lock_common kernel/locking/mutex.c:603 [inline] __mutex_lock+0x99/0x9a0 kernel/locking/mutex.c:747 ovl_inode_lock_interruptible fs/overlayfs/overlayfs.h:602 [inline] ovl_nlink_start+0x99/0x110 fs/overlayfs/util.c:1061 ovl_do_remove+0xa0/0x410 fs/overlayfs/dir.c:902 vfs_rmdir+0x9f/0x170 fs/namei.c:4203 do_rmdir+0x15f/0x210 fs/namei.c:4262 __do_sys_rmdir fs/namei.c:4281 [inline] __se_sys_rmdir fs/namei.c:4279 [inline] __x64_sys_rmdir+0x1e/0x30 fs/namei.c:4279 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x46/0xa0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x6f/0xd9 -> #2 (sb_writers#4){.+.+}-{0:0}: percpu_down_read include/linux/percpu-rwsem.h:51 [inline] __sb_start_write include/linux/fs.h:1571 [inline] sb_start_write+0x34/0xd0 include/linux/fs.h:1646 mnt_want_write+0x12/0x40 fs/namespace.c:403 ovl_do_remove+0x7b/0x410 fs/overlayfs/dir.c:894 vfs_rmdir+0x9f/0x170 fs/namei.c:4203 do_rmdir+0x15f/0x210 fs/namei.c:4262 __do_sys_rmdir fs/namei.c:4281 [inline] __se_sys_rmdir fs/namei.c:4279 [inline] __x64_sys_rmdir+0x1e/0x30 fs/namei.c:4279 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x46/0xa0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x6f/0xd9 -> #1 (&ovl_i_mutex_dir_key[depth]){++++}-{3:3}: down_read+0x4a/0x440 kernel/locking/rwsem.c:1520 inode_lock_shared include/linux/fs.h:812 [inline] lookup_slow+0x20/0x50 fs/namei.c:1709 walk_component+0xda/0xf0 fs/namei.c:2001 lookup_last fs/namei.c:2458 [inline] path_lookupat+0x45/0x100 fs/namei.c:2482 filename_lookup+0xd9/0x1f0 fs/namei.c:2511 kern_path+0x2a/0x80 fs/namei.c:2609 lookup_bdev+0x4a/0xc0 block/bdev.c:926 resume_store+0x9b/0x230 kernel/power/hibernate.c:1177 kernfs_fop_write_iter+0x12a/0x1b0 fs/kernfs/file.c:334 call_write_iter include/linux/fs.h:1956 [inline] new_sync_write fs/read_write.c:491 [inline] vfs_write+0x271/0x2f0 fs/read_write.c:584 ksys_write+0x70/0xe0 fs/read_write.c:637 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x46/0xa0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x6f/0xd9 -> #0 (&of->mutex){+.+.}-{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:3868 [inline] __lock_acquire+0x11f9/0x2490 kernel/locking/lockdep.c:5136 lock_acquire+0xea/0x270 kernel/locking/lockdep.c:5753 __mutex_lock_common kernel/locking/mutex.c:603 [inline] __mutex_lock+0x99/0x9a0 kernel/locking/mutex.c:747 kernfs_fop_llseek+0x33/0xc0 fs/kernfs/file.c:916 ovl_llseek+0x10d/0x1a0 fs/overlayfs/file.c:227 vfs_llseek fs/read_write.c:289 [inline] ksys_lseek fs/read_write.c:302 [inline] __do_sys_lseek fs/read_write.c:313 [inline] __se_sys_lseek fs/read_write.c:311 [inline] __x64_sys_lseek+0x58/0xa0 fs/read_write.c:311 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x46/0xa0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x6f/0xd9 other info that might help us debug this: Chain exists of: &of->mutex --> sb_writers#4 --> &ovl_i_lock_key[depth] Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&ovl_i_lock_key[depth]); lock(sb_writers#4); lock(&ovl_i_lock_key[depth]); lock(&of->mutex); *** DEADLOCK *** 2 locks held by syz-executor.0/2651: #0: ffff888103664ac8 (&f->f_pos_lock){+.+.}-{3:3}, at: __fdget_pos+0xa1/0xc0 fs/file.c:1064 #1: ffff88810ae97f30 (&ovl_i_lock_key[depth]){+.+.}-{3:3}, at: ovl_inode_lock fs/overlayfs/overlayfs.h:597 [inline] #1: ffff88810ae97f30 (&ovl_i_lock_key[depth]){+.+.}-{3:3}, at: ovl_llseek+0xe5/0x1a0 fs/overlayfs/file.c:223 stack backtrace: CPU: 1 PID: 2651 Comm: syz-executor.0 Not tainted 6.6.0-rc4-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x8d/0xe0 lib/dump_stack.c:106 check_noncircular+0x119/0x140 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:3868 [inline] __lock_acquire+0x11f9/0x2490 kernel/locking/lockdep.c:5136 lock_acquire+0xea/0x270 kernel/locking/lockdep.c:5753 __mutex_lock_common kernel/locking/mutex.c:603 [inline] __mutex_lock+0x99/0x9a0 kernel/locking/mutex.c:747 kernfs_fop_llseek+0x33/0xc0 fs/kernfs/file.c:916 ovl_llseek+0x10d/0x1a0 fs/overlayfs/file.c:227 vfs_llseek fs/read_write.c:289 [inline] ksys_lseek fs/read_write.c:302 [inline] __do_sys_lseek fs/read_write.c:313 [inline] __se_sys_lseek fs/read_write.c:311 [inline] __x64_sys_lseek+0x58/0xa0 fs/read_write.c:311 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x46/0xa0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x6f/0xd9 RIP: 0033:0x7fcfd147dde9 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:00007fcfd22410c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000008 RAX: ffffffffffffffda RBX: 00007fcfd15abf80 RCX: 00007fcfd147dde9 RDX: 0000000000000003 RSI: 0000000000000000 RDI: 0000000000000005 RBP: 00007fcfd14ca47a R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000006 R14: 00007fcfd15abf80 R15: 00007ffd702d5738