bisecting fixing commit since c14d30dc9987047b439b03d6e6db7d54d9f7f180 building syzkaller on 5ce135324a84d6de67c913f1b725e3fc5ec39535 testing commit c14d30dc9987047b439b03d6e6db7d54d9f7f180 with gcc (GCC) 8.1.0 kernel signature: 76ce719d65f15a601be9ba48c276fe77751610a2f3465f324ec7619f7ff47e3c all runs: crashed: possible deadlock in ovl_write_iter testing current HEAD a87f96283793d58b042618c689630db264715274 testing commit a87f96283793d58b042618c689630db264715274 with gcc (GCC) 8.1.0 kernel signature: 7da03039da20f136b68a7d3e44f0f0959a6c9e86e2ed89ae6c74d11bf921ca3c all runs: crashed: possible deadlock in ovl_write_iter revisions tested: 2, total time: 23m1.601922296s (build: 16m37.030962466s, test: 5m57.189823936s) the crash still happens on HEAD commit msg: Linux 4.19.145 crash: possible deadlock in ovl_write_iter Bluetooth: hci1: command 0x0419 tx timeout Bluetooth: hci2: command 0x0419 tx timeout Bluetooth: hci4: command 0x0419 tx timeout Bluetooth: hci0: command 0x0419 tx timeout ====================================================== WARNING: possible circular locking dependency detected 4.19.145-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.0/7966 is trying to acquire lock: 00000000f161b12c (&ovl_i_mutex_key[depth]){+.+.}, at: inode_lock include/linux/fs.h:748 [inline] 00000000f161b12c (&ovl_i_mutex_key[depth]){+.+.}, at: ovl_write_iter+0x12d/0xb10 fs/overlayfs/file.c:270 but task is already holding lock: 00000000de85ce42 (&pipe->mutex/1){+.+.}, at: pipe_lock_nested fs/pipe.c:62 [inline] 00000000de85ce42 (&pipe->mutex/1){+.+.}, at: pipe_lock fs/pipe.c:70 [inline] 00000000de85ce42 (&pipe->mutex/1){+.+.}, at: pipe_wait+0x185/0x1b0 fs/pipe.c:118 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #2 (&pipe->mutex/1){+.+.}: __mutex_lock_common kernel/locking/mutex.c:925 [inline] __mutex_lock+0xf5/0x1200 kernel/locking/mutex.c:1072 mutex_lock_nested+0x16/0x20 kernel/locking/mutex.c:1087 pipe_lock_nested fs/pipe.c:62 [inline] pipe_lock+0x4f/0x60 fs/pipe.c:70 iter_file_splice_write+0x144/0xc40 fs/splice.c:700 do_splice_from fs/splice.c:852 [inline] do_splice fs/splice.c:1154 [inline] __do_sys_splice fs/splice.c:1428 [inline] __se_sys_splice+0x716/0x17d0 fs/splice.c:1408 __x64_sys_splice+0xdc/0x1a0 fs/splice.c:1408 do_syscall_64+0xd0/0x4e0 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe -> #1 (sb_writers#3){.+.+}: percpu_down_read_preempt_disable include/linux/percpu-rwsem.h:36 [inline] percpu_down_read include/linux/percpu-rwsem.h:59 [inline] __sb_start_write+0x17d/0x2a0 fs/super.c:1387 sb_start_write include/linux/fs.h:1579 [inline] mnt_want_write+0x3c/0xa0 fs/namespace.c:360 ovl_want_write+0x71/0x90 fs/overlayfs/util.c:24 ovl_setattr+0xb8/0x880 fs/overlayfs/inode.c:30 notify_change+0x6c1/0xcb0 fs/attr.c:334 do_truncate+0xef/0x1a0 fs/open.c:63 handle_truncate fs/namei.c:3009 [inline] do_last fs/namei.c:3427 [inline] path_openat+0x1af2/0x2870 fs/namei.c:3537 do_filp_open+0x177/0x250 fs/namei.c:3567 do_sys_open+0x1dd/0x350 fs/open.c:1085 __do_sys_openat fs/open.c:1112 [inline] __se_sys_openat fs/open.c:1106 [inline] __x64_sys_openat+0x98/0xf0 fs/open.c:1106 do_syscall_64+0xd0/0x4e0 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe -> #0 (&ovl_i_mutex_key[depth]){+.+.}: lock_acquire+0x180/0x3a0 kernel/locking/lockdep.c:3907 down_write+0x38/0x90 kernel/locking/rwsem.c:70 inode_lock include/linux/fs.h:748 [inline] ovl_write_iter+0x12d/0xb10 fs/overlayfs/file.c:270 call_write_iter include/linux/fs.h:1821 [inline] new_sync_write fs/read_write.c:474 [inline] __vfs_write+0x443/0x890 fs/read_write.c:487 __kernel_write+0xe4/0x350 fs/read_write.c:506 write_pipe_buf+0x154/0x1f0 fs/splice.c:798 splice_from_pipe_feed fs/splice.c:503 [inline] __splice_from_pipe+0x2cb/0x720 fs/splice.c:627 splice_from_pipe+0xbb/0x120 fs/splice.c:662 default_file_splice_write+0x18/0x50 fs/splice.c:810 do_splice_from fs/splice.c:852 [inline] do_splice fs/splice.c:1154 [inline] __do_sys_splice fs/splice.c:1428 [inline] __se_sys_splice+0x716/0x17d0 fs/splice.c:1408 __x64_sys_splice+0xdc/0x1a0 fs/splice.c:1408 do_syscall_64+0xd0/0x4e0 arch/x86/entry/common.c:293 overlayfs: failed to resolve './file0': -2 entry_SYSCALL_64_after_hwframe+0x49/0xbe other info that might help us debug this: Chain exists of: &ovl_i_mutex_key[depth] --> sb_writers#3 --> &pipe->mutex/1 Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&pipe->mutex/1); lock(sb_writers#3); lock(&pipe->mutex/1); lock(&ovl_i_mutex_key[depth]); *** DEADLOCK *** 2 locks held by syz-executor.0/7966: #0: 0000000036b840ed (sb_writers#16){.+.+}, at: file_start_write include/linux/fs.h:2780 [inline] #0: 0000000036b840ed (sb_writers#16){.+.+}, at: do_splice fs/splice.c:1153 [inline] #0: 0000000036b840ed (sb_writers#16){.+.+}, at: __do_sys_splice fs/splice.c:1428 [inline] #0: 0000000036b840ed (sb_writers#16){.+.+}, at: __se_sys_splice+0xfed/0x17d0 fs/splice.c:1408 #1: 00000000de85ce42 (&pipe->mutex/1){+.+.}, at: pipe_lock_nested fs/pipe.c:62 [inline] #1: 00000000de85ce42 (&pipe->mutex/1){+.+.}, at: pipe_lock fs/pipe.c:70 [inline] #1: 00000000de85ce42 (&pipe->mutex/1){+.+.}, at: pipe_wait+0x185/0x1b0 fs/pipe.c:118 stack backtrace: CPU: 1 PID: 7966 Comm: syz-executor.0 Not tainted 4.19.145-syzkaller #0 overlayfs: failed to resolve './file0': -2 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x17c/0x22a lib/dump_stack.c:118 print_circular_bug.isra.17.cold.34+0x2e3/0x41e kernel/locking/lockdep.c:1221 check_prev_add kernel/locking/lockdep.c:1865 [inline] check_prevs_add kernel/locking/lockdep.c:1978 [inline] validate_chain kernel/locking/lockdep.c:2419 [inline] __lock_acquire+0x35bc/0x47c0 kernel/locking/lockdep.c:3415 lock_acquire+0x180/0x3a0 kernel/locking/lockdep.c:3907 down_write+0x38/0x90 kernel/locking/rwsem.c:70 inode_lock include/linux/fs.h:748 [inline] ovl_write_iter+0x12d/0xb10 fs/overlayfs/file.c:270 call_write_iter include/linux/fs.h:1821 [inline] new_sync_write fs/read_write.c:474 [inline] __vfs_write+0x443/0x890 fs/read_write.c:487 __kernel_write+0xe4/0x350 fs/read_write.c:506 write_pipe_buf+0x154/0x1f0 fs/splice.c:798 splice_from_pipe_feed fs/splice.c:503 [inline] __splice_from_pipe+0x2cb/0x720 fs/splice.c:627 splice_from_pipe+0xbb/0x120 fs/splice.c:662 default_file_splice_write+0x18/0x50 fs/splice.c:810 do_splice_from fs/splice.c:852 [inline] do_splice fs/splice.c:1154 [inline] __do_sys_splice fs/splice.c:1428 [inline] __se_sys_splice+0x716/0x17d0 fs/splice.c:1408 __x64_sys_splice+0xdc/0x1a0 fs/splice.c:1408 do_syscall_64+0xd0/0x4e0 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x45d239 Code: 5d b4 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 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 0f 83 2b b4 fb ff c3 66 2e 0f 1f 84 00 00 00 00 RSP: 002b:00007fc0a35eac78 EFLAGS: 00000246 ORIG_RAX: 0000000000000113 RAX: ffffffffffffffda RBX: 0000000000032bc0 RCX: 000000000045d239 RDX: 0000000000000006 RSI: 0000000000000000 RDI: 0000000000000004 RBP: 000000000118d0d8 R08: 00000000088000cc R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 000000000118d08c R13: 00007fff966f575f R14: 00007fc0a35eb9c0 R15: 000000000118d08c overlayfs: filesystem on './file0' not supported as upperdir overlayfs: filesystem on './file0' not supported as upperdir overlayfs: filesystem on './file0' not supported as upperdir overlayfs: filesystem on './file0' not supported as upperdir overlayfs: failed to resolve './file0': -2 overlayfs: filesystem on './file0' not supported as upperdir overlayfs: filesystem on './file0' not supported as upperdir overlayfs: failed to resolve './file0': -2 overlayfs: filesystem on './file0' not supported as upperdir overlayfs: filesystem on './file0' not supported as upperdir overlayfs: failed to resolve './file0': -2 overlayfs: failed to resolve './file0': -2 overlayfs: filesystem on './file0' not supported as upperdir overlayfs: failed to resolve './file0': -2 overlayfs: failed to resolve './file0': -2 overlayfs: failed to resolve './file0': -2 overlayfs: failed to resolve './file0': -2 overlayfs: filesystem on './file0' not supported as upperdir overlayfs: failed to resolve './file0': -2 overlayfs: failed to resolve './file0': -2 overlayfs: filesystem on './file0' not supported as upperdir overlayfs: failed to resolve './file0': -2 overlayfs: filesystem on './file0' not supported as upperdir overlayfs: filesystem on './file0' not supported as upperdir overlayfs: failed to resolve './file0': -2 overlayfs: filesystem on './file0' not supported as upperdir overlayfs: failed to resolve './file0': -2 overlayfs: filesystem on './file0' not supported as upperdir overlayfs: failed to resolve './file0': -2 overlayfs: failed to resolve './file0': -2 overlayfs: failed to resolve './file0': -2 overlayfs: failed to resolve './file0': -2 overlayfs: failed to resolve './file0': -2 overlayfs: filesystem on './file0' not supported as upperdir overlayfs: failed to resolve './file0': -2 overlayfs: failed to resolve './file0': -2 overlayfs: failed to resolve './file0': -2 overlayfs: failed to resolve './file0': -2 overlayfs: filesystem on './file0' not supported as upperdir overlayfs: failed to resolve './file0': -2 overlayfs: failed to resolve './file0': -2 overlayfs: filesystem on './file0' not supported as upperdir overlayfs: failed to resolve './file0': -2 overlayfs: filesystem on './file0' not supported as upperdir overlayfs: filesystem on './file0' not supported as upperdir overlayfs: filesystem on './file0' not supported as upperdir overlayfs: filesystem on './file0' not supported as upperdir overlayfs: filesystem on './file0' not supported as upperdir overlayfs: filesystem on './file0' not supported as upperdir overlayfs: failed to resolve './file0': -2 overlayfs: filesystem on './file0' not supported as upperdir overlayfs: filesystem on './file0' not supported as upperdir overlayfs: filesystem on './file0' not supported as upperdir overlayfs: failed to resolve './file0': -2 overlayfs: filesystem on './file0' not supported as upperdir overlayfs: filesystem on './file0' not supported as upperdir overlayfs: filesystem on './file0' not supported as upperdir overlayfs: filesystem on './file0' not supported as upperdir overlayfs: failed to resolve './file0': -2 overlayfs: failed to resolve './file0': -2 overlayfs: failed to resolve './file0': -2 overlayfs: failed to resolve './file0': -2 overlayfs: filesystem on './file0' not supported as upperdir overlayfs: filesystem on './file0' not supported as upperdir overlayfs: filesystem on './file0' not supported as upperdir overlayfs: filesystem on './file0' not supported as upperdir