syzbot


possible deadlock in pipe_lock (3)

Status: fixed on 2020/08/18 22:40
Subsystems: overlayfs
[Documentation on labels]
Reported-by: syzbot+217d60b447573313b211@syzkaller.appspotmail.com
Fix commit: 1a980b8cbf00 ovl: add splice file read write helper
First crash: 1583d, last: 1545d
Cause bisection: the cause commit could be any of (bisect log):
  9211bfbff80a netfilter: add missing IS_ENABLED(CONFIG_BRIDGE_NETFILTER) checks to header-file.
  47e640af2e49 netfilter: add missing IS_ENABLED(CONFIG_NF_TABLES) check to header-file.
  a1b2f04ea527 netfilter: add missing includes to a number of header-files.
  0abc8bf4f284 netfilter: add missing IS_ENABLED(CONFIG_NF_CONNTRACK) checks to some header-files.
  bd96b4c75675 netfilter: inline four headers files into another one.
  43dd16efc7f2 netfilter: nf_tables: store data in offload context registers
  78458e3e08cd netfilter: add missing IS_ENABLED(CONFIG_NETFILTER) checks to some header-files.
  20a9379d9a03 netfilter: remove "#ifdef __KERNEL__" guards from some headers.
  bd8699e9e292 netfilter: nft_bitwise: add offload support
  2a475c409fe8 kbuild: remove all netfilter headers from header-test blacklist.
  7e59b3fea2a2 netfilter: remove unnecessary spaces
  1b90af292e71 ipvs: Improve robustness to the ipvs sysctl
  5785cf15fd74 netfilter: nf_tables: add missing prototypes.
  0a30ba509fde netfilter: nf_nat_proto: make tables static
  e84fb4b3666d netfilter: conntrack: use shared sysctl constants
  105333435b4f netfilter: connlabels: prefer static lock initialiser
  8c0bb7873815 netfilter: synproxy: rename mss synproxy_options field
  c162610c7db2 Merge git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next
  
Fix bisection: fixed by (bisect log) :
commit 1a980b8cbf0059a5308eea61522f232fd03002e2
Author: Murphy Zhou <jencce.kernel@gmail.com>
Date: Fri Jan 17 12:49:29 2020 +0000

  ovl: add splice file read write helper

  
Discussions (1)
Title Replies (including bot) Last reply
possible deadlock in pipe_lock (3) 0 (2) 2020/03/15 16:19
Similar bugs (8)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in pipe_lock fs 50806 2321d 2369d 0/26 closed as invalid on 2018/02/14 14:20
upstream possible deadlock in pipe_lock (4) overlayfs 1 1088d 1084d 0/26 auto-closed as invalid on 2021/07/03 13:02
upstream possible deadlock in pipe_lock (2) overlayfs 3 1831d 1901d 0/26 auto-closed as invalid on 2019/10/18 15:02
linux-4.19 possible deadlock in pipe_lock (2) C error 155 416d 1583d 0/1 upstream: reported C repro on 2019/12/26 07:17
upstream possible deadlock in pipe_lock (5) overlayfs C done 5 1007d 1006d 20/26 fixed on 2021/11/10 00:50
android-49 possible deadlock in pipe_lock 5 1646d 1839d 0/3 auto-closed as invalid on 2020/02/21 12:40
linux-4.19 possible deadlock in pipe_lock C done 2 1825d 1828d 1/1 fixed on 2019/11/29 10:34
android-44 possible deadlock in pipe_lock C 82 1606d 1839d 0/2 public: reported C repro on 2019/04/14 08:51
Fix bisection attempts (2)
Created Duration User Patch Repo Result
2020/03/15 08:11 8h06m bisect fix upstream job log (1)
2020/02/01 22:36 20m bisect fix upstream job log (0) log

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
5.5.0-rc3-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor691/10028 is trying to acquire lock:
ffff88809643c460 (&pipe->mutex/1){+.+.}, at: pipe_lock_nested fs/pipe.c:65 [inline]
ffff88809643c460 (&pipe->mutex/1){+.+.}, at: pipe_lock+0x65/0x80 fs/pipe.c:73

but task is already holding lock:
ffff888099382428 (sb_writers#4){.+.+}, at: file_start_write include/linux/fs.h:2885 [inline]
ffff888099382428 (sb_writers#4){.+.+}, at: do_splice+0xf48/0x1680 fs/splice.c:1169

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #2 (sb_writers#4){.+.+}:
       percpu_down_read include/linux/percpu-rwsem.h:40 [inline]
       __sb_start_write+0x241/0x460 fs/super.c:1674
       file_start_write include/linux/fs.h:2885 [inline]
       ovl_write_iter+0x91b/0xc20 fs/overlayfs/file.c:277
       call_write_iter include/linux/fs.h:1902 [inline]
       new_sync_write+0x4d3/0x770 fs/read_write.c:483
       __vfs_write+0xe1/0x110 fs/read_write.c:496
       __kernel_write+0x11b/0x3b0 fs/read_write.c:515
       write_pipe_buf+0x15d/0x1f0 fs/splice.c:809
       splice_from_pipe_feed fs/splice.c:512 [inline]
       __splice_from_pipe+0x3ee/0x7c0 fs/splice.c:636
       splice_from_pipe+0x108/0x170 fs/splice.c:671
       default_file_splice_write+0x3c/0x90 fs/splice.c:821
       do_splice_from fs/splice.c:863 [inline]
       do_splice+0xba4/0x1680 fs/splice.c:1170
       __do_sys_splice fs/splice.c:1447 [inline]
       __se_sys_splice fs/splice.c:1427 [inline]
       __x64_sys_splice+0x2c6/0x330 fs/splice.c:1427
       do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294
       entry_SYSCALL_64_after_hwframe+0x49/0xbe

-> #1 (&ovl_i_mutex_key[depth]){+.+.}:
       down_write+0x93/0x150 kernel/locking/rwsem.c:1534
       inode_lock include/linux/fs.h:791 [inline]
       ovl_write_iter+0x148/0xc20 fs/overlayfs/file.c:265
       call_write_iter include/linux/fs.h:1902 [inline]
       new_sync_write+0x4d3/0x770 fs/read_write.c:483
       __vfs_write+0xe1/0x110 fs/read_write.c:496
       __kernel_write+0x11b/0x3b0 fs/read_write.c:515
       write_pipe_buf+0x15d/0x1f0 fs/splice.c:809
       splice_from_pipe_feed fs/splice.c:512 [inline]
       __splice_from_pipe+0x3ee/0x7c0 fs/splice.c:636
       splice_from_pipe+0x108/0x170 fs/splice.c:671
       default_file_splice_write+0x3c/0x90 fs/splice.c:821
       do_splice_from fs/splice.c:863 [inline]
       do_splice+0xba4/0x1680 fs/splice.c:1170
       __do_sys_splice fs/splice.c:1447 [inline]
       __se_sys_splice fs/splice.c:1427 [inline]
       __x64_sys_splice+0x2c6/0x330 fs/splice.c:1427
       do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294
       entry_SYSCALL_64_after_hwframe+0x49/0xbe

-> #0 (&pipe->mutex/1){+.+.}:
       check_prev_add kernel/locking/lockdep.c:2476 [inline]
       check_prevs_add kernel/locking/lockdep.c:2581 [inline]
       validate_chain kernel/locking/lockdep.c:2971 [inline]
       __lock_acquire+0x2596/0x4a00 kernel/locking/lockdep.c:3955
       lock_acquire+0x190/0x410 kernel/locking/lockdep.c:4485
       __mutex_lock_common kernel/locking/mutex.c:956 [inline]
       __mutex_lock+0x156/0x13c0 kernel/locking/mutex.c:1103
       mutex_lock_nested+0x16/0x20 kernel/locking/mutex.c:1118
       pipe_lock_nested fs/pipe.c:65 [inline]
       pipe_lock+0x65/0x80 fs/pipe.c:73
       iter_file_splice_write+0x18b/0xc10 fs/splice.c:709
       do_splice_from fs/splice.c:863 [inline]
       do_splice+0xba4/0x1680 fs/splice.c:1170
       __do_sys_splice fs/splice.c:1447 [inline]
       __se_sys_splice fs/splice.c:1427 [inline]
       __x64_sys_splice+0x2c6/0x330 fs/splice.c:1427
       do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294
       entry_SYSCALL_64_after_hwframe+0x49/0xbe

other info that might help us debug this:

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

 Possible unsafe locking scenario:

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

 *** DEADLOCK ***

1 lock held by syz-executor691/10028:
 #0: ffff888099382428 (sb_writers#4){.+.+}, at: file_start_write include/linux/fs.h:2885 [inline]
 #0: ffff888099382428 (sb_writers#4){.+.+}, at: do_splice+0xf48/0x1680 fs/splice.c:1169

stack backtrace:
CPU: 1 PID: 10028 Comm: syz-executor691 Not tainted 5.5.0-rc3-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+0x197/0x210 lib/dump_stack.c:118
 print_circular_bug.isra.0.cold+0x163/0x172 kernel/locking/lockdep.c:1685
 check_noncircular+0x32e/0x3e0 kernel/locking/lockdep.c:1809
 check_prev_add kernel/locking/lockdep.c:2476 [inline]
 check_prevs_add kernel/locking/lockdep.c:2581 [inline]
 validate_chain kernel/locking/lockdep.c:2971 [inline]
 __lock_acquire+0x2596/0x4a00 kernel/locking/lockdep.c:3955
 lock_acquire+0x190/0x410 kernel/locking/lockdep.c:4485
 __mutex_lock_common kernel/locking/mutex.c:956 [inline]
 __mutex_lock+0x156/0x13c0 kernel/locking/mutex.c:1103
 mutex_lock_nested+0x16/0x20 kernel/locking/mutex.c:1118
 pipe_lock_nested fs/pipe.c:65 [inline]
 pipe_lock+0x65/0x80 fs/pipe.c:73
 iter_file_splice_write+0x18b/0xc10 fs/splice.c:709
 do_splice_from fs/splice.c:863 [inline]
 do_splice+0xba4/0x1680 fs/splice.c:1170
 __do_sys_splice fs/splice.c:1447 [inline]
 __se_sys_splice fs/splice.c:1427 [inline]
 __x64_sys_splice+0x2c6/0x330 fs/splice.c:1427
 do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x448059
Code: e8 6c e7 ff ff 48 83 c4 18 c3 0f 1f 80 00 00 00 00 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 db 07 fc ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007f6e364e9da8 EFLAGS: 00000246 ORIG_RAX: 0000000000000113
RAX: ffffffffffffffda RBX: 00000000006ddc28 RCX: 0000000000448059
RDX: 0000000000000004 RSI: 0000000000000000 RDI: 0000000000000003
RBP: 00000000006ddc20 R08: 0000000100000002 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000006ddc2c
R13: 00007ffdf34111cf R14: 00007f6e364ea9c0 R15: 00000000006ddc2c

Crashes (4):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2019/12/26 07:16 upstream 46cf053efec6 be5c2c81 .config console log report syz C ci-upstream-kasan-gce-selinux-root
2019/12/26 06:36 upstream 46cf053efec6 be5c2c81 .config console log report syz C ci-upstream-kasan-gce-root
2020/01/02 03:50 linux-next 7ddd09fc4b74 25a0186e .config console log report syz C ci-upstream-linux-next-kasan-gce-root
2019/12/26 05:54 upstream 46cf053efec6 be5c2c81 .config console log report ci-upstream-kasan-gce-root
* Struck through repros no longer work on HEAD.