syzbot


possible deadlock in ovl_write_iter (2)

Status: fixed on 2020/04/09 01:05
Reported-by: syzbot+54968ebfc84a36152bdd@syzkaller.appspotmail.com
Fix commit: eae6b4a4d7f8 USB: Disable LPM on WD19's Realtek Hub
First crash: 1718d, last: 1718d
Fix bisection: fixed by (bisect log) :
commit eae6b4a4d7f82c5a01d6caeef96abe81888b53d3
Author: Kai-Heng Feng <kai.heng.feng@canonical.com>
Date: Wed Feb 5 11:26:33 2020 +0000

  USB: Disable LPM on WD19's Realtek Hub

  
Similar bugs (3)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.19 possible deadlock in ovl_write_iter syz done 84 1834d 2044d 1/1 fixed on 2019/12/19 13:28
upstream possible deadlock in ovl_write_iter overlayfs C 222 2024d 2247d 0/28 closed as dup on 2019/02/12 15:47
linux-4.19 possible deadlock in ovl_write_iter (3) C error 132 625d 1558d 0/1 upstream: reported C repro on 2020/08/16 01:29

Sample crash report:
IPv6: ADDRCONF(NETDEV_CHANGE): veth1_to_batadv: link becomes ready
audit: type=1400 audit(1583758497.384:41): avc:  denied  { associate } for  pid=8053 comm="syz-executor.3" name="syz3" scontext=unconfined_u:object_r:unlabeled_t:s0 tcontext=system_u:object_r:unlabeled_t:s0 tclass=filesystem permissive=1
======================================================
WARNING: possible circular locking dependency detected
4.19.108-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor.4/8246 is trying to acquire lock:
0000000004acf6d7 (sb_writers#4){.+.+}, at: file_start_write include/linux/fs.h:2775 [inline]
0000000004acf6d7 (sb_writers#4){.+.+}, at: ovl_write_iter+0x91b/0xc20 fs/overlayfs/file.c:280

but task is already holding lock:
00000000dddfd189 (&ovl_i_mutex_key[depth]){+.+.}, at: inode_lock include/linux/fs.h:747 [inline]
00000000dddfd189 (&ovl_i_mutex_key[depth]){+.+.}, at: ovl_write_iter+0x148/0xc20 fs/overlayfs/file.c:268

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #2 (&ovl_i_mutex_key[depth]){+.+.}:
       inode_lock include/linux/fs.h:747 [inline]
       ovl_write_iter+0x148/0xc20 fs/overlayfs/file.c:268
       call_write_iter include/linux/fs.h:1820 [inline]
       new_sync_write fs/read_write.c:474 [inline]
       __vfs_write+0x512/0x760 fs/read_write.c:487
       __kernel_write+0x109/0x370 fs/read_write.c:506
       write_pipe_buf+0x153/0x1e0 fs/splice.c:798
       splice_from_pipe_feed fs/splice.c:503 [inline]
       __splice_from_pipe+0x38f/0x7a0 fs/splice.c:627
       splice_from_pipe+0xd9/0x140 fs/splice.c:662
       default_file_splice_write+0x37/0x90 fs/splice.c:810
       do_splice_from fs/splice.c:852 [inline]
       do_splice+0x5ea/0x1250 fs/splice.c:1154
       __do_sys_splice fs/splice.c:1428 [inline]
       __se_sys_splice fs/splice.c:1408 [inline]
       __x64_sys_splice+0x2b5/0x320 fs/splice.c:1408
       do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
       entry_SYSCALL_64_after_hwframe+0x49/0xbe

-> #1 (&pipe->mutex/1){+.+.}:
       pipe_lock_nested fs/pipe.c:62 [inline]
       pipe_lock+0x63/0x80 fs/pipe.c:70
       iter_file_splice_write+0x183/0xb30 fs/splice.c:700
       do_splice_from fs/splice.c:852 [inline]
       do_splice+0x5ea/0x1250 fs/splice.c:1154
       __do_sys_splice fs/splice.c:1428 [inline]
       __se_sys_splice fs/splice.c:1408 [inline]
       __x64_sys_splice+0x2b5/0x320 fs/splice.c:1408
       do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
       entry_SYSCALL_64_after_hwframe+0x49/0xbe

-> #0 (sb_writers#4){.+.+}:
       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+0x1e6/0x340 fs/super.c:1387
       file_start_write include/linux/fs.h:2775 [inline]
       ovl_write_iter+0x91b/0xc20 fs/overlayfs/file.c:280
       call_write_iter include/linux/fs.h:1820 [inline]
       new_sync_write fs/read_write.c:474 [inline]
       __vfs_write+0x512/0x760 fs/read_write.c:487
       __kernel_write+0x109/0x370 fs/read_write.c:506
       write_pipe_buf+0x153/0x1e0 fs/splice.c:798
       splice_from_pipe_feed fs/splice.c:503 [inline]
       __splice_from_pipe+0x38f/0x7a0 fs/splice.c:627
       splice_from_pipe+0xd9/0x140 fs/splice.c:662
       default_file_splice_write+0x37/0x90 fs/splice.c:810
       do_splice_from fs/splice.c:852 [inline]
       do_splice+0x5ea/0x1250 fs/splice.c:1154
       __do_sys_splice fs/splice.c:1428 [inline]
       __se_sys_splice fs/splice.c:1408 [inline]
       __x64_sys_splice+0x2b5/0x320 fs/splice.c:1408
       do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
       entry_SYSCALL_64_after_hwframe+0x49/0xbe

other info that might help us debug this:

Chain exists of:
  sb_writers#4 --> &pipe->mutex/1 --> &ovl_i_mutex_key[depth]

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&ovl_i_mutex_key[depth]);
                               lock(&pipe->mutex/1);
                               lock(&ovl_i_mutex_key[depth]);
  lock(sb_writers#4);

 *** DEADLOCK ***

3 locks held by syz-executor.4/8246:
 #0: 00000000e414fcde (sb_writers#13){.+.+}, at: file_start_write include/linux/fs.h:2775 [inline]
 #0: 00000000e414fcde (sb_writers#13){.+.+}, at: do_splice+0xc91/0x1250 fs/splice.c:1153
 #1: 000000004215a967 (&pipe->mutex/1){+.+.}, at: pipe_lock_nested fs/pipe.c:62 [inline]
 #1: 000000004215a967 (&pipe->mutex/1){+.+.}, at: pipe_lock+0x63/0x80 fs/pipe.c:70
 #2: 00000000dddfd189 (&ovl_i_mutex_key[depth]){+.+.}, at: inode_lock include/linux/fs.h:747 [inline]
 #2: 00000000dddfd189 (&ovl_i_mutex_key[depth]){+.+.}, at: ovl_write_iter+0x148/0xc20 fs/overlayfs/file.c:268

stack backtrace:
CPU: 0 PID: 8246 Comm: syz-executor.4 Not tainted 4.19.108-syzkaller #0
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+0x188/0x20d lib/dump_stack.c:118
 print_circular_bug.isra.0.cold+0x1c4/0x282 kernel/locking/lockdep.c:1221
overlayfs: unrecognized mount option "Iω gro[¬¬d=18446744073709551615" or missing value
 check_prev_add kernel/locking/lockdep.c:1861 [inline]
 check_prevs_add kernel/locking/lockdep.c:1974 [inline]
 validate_chain kernel/locking/lockdep.c:2415 [inline]
 __lock_acquire+0x2e19/0x49c0 kernel/locking/lockdep.c:3411
 lock_acquire+0x170/0x400 kernel/locking/lockdep.c:3903
 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+0x1e6/0x340 fs/super.c:1387
 file_start_write include/linux/fs.h:2775 [inline]
 ovl_write_iter+0x91b/0xc20 fs/overlayfs/file.c:280
 call_write_iter include/linux/fs.h:1820 [inline]
 new_sync_write fs/read_write.c:474 [inline]
 __vfs_write+0x512/0x760 fs/read_write.c:487
 __kernel_write+0x109/0x370 fs/read_write.c:506
 write_pipe_buf+0x153/0x1e0 fs/splice.c:798
 splice_from_pipe_feed fs/splice.c:503 [inline]
 __splice_from_pipe+0x38f/0x7a0 fs/splice.c:627
 splice_from_pipe+0xd9/0x140 fs/splice.c:662
 default_file_splice_write+0x37/0x90 fs/splice.c:810
 do_splice_from fs/splice.c:852 [inline]
 do_splice+0x5ea/0x1250 fs/splice.c:1154
 __do_sys_splice fs/splice.c:1428 [inline]
 __se_sys_splice fs/splice.c:1408 [inline]
 __x64_sys_splice+0x2b5/0x320 fs/splice.c:1408
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x45c4a9
Code: ad b6 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 7b b6 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007f425f909c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000113
RAX: ffffffffffffffda RBX: 00007f425f90a6d4 RCX: 000000000045c4a9
RDX: 0000000000000005 RSI: 0000000000000000 RDI: 0000000000000003
RBP: 000000000076bfc0 R08: 000000000004ffe0 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000ffffffff
R13: 0000000000000b9f R14: 00000000004ce2bc R15: 000000000076bfcc

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/03/09 13:01 linux-4.19.y 7472c4028e23 2e9971bb .config console log report syz ci2-linux-4-19
2020/03/09 09:55 linux-4.19.y 7472c4028e23 2e9971bb .config console log report ci2-linux-4-19
* Struck through repros no longer work on HEAD.