syzbot


possible deadlock in do_io_accounting

Status: public: reported C repro on 2019/04/11 08:44
Reported-by: syzbot+f788c5ed82d7038c2d3d@syzkaller.appspotmail.com
First crash: 2066d, last: 1630d
Similar bugs (8)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-49 possible deadlock in do_io_accounting C 4521 1629d 1864d 0/3 public: reported C repro on 2019/04/12 00:00
linux-4.19 possible deadlock in do_io_accounting C done 4 1693d 1805d 1/1 fixed on 2019/12/10 20:49
upstream possible deadlock in do_io_accounting (3) fs C inconclusive done 39 1515d 1606d 15/26 fixed on 2020/08/18 22:40
linux-4.19 possible deadlock in do_io_accounting (2) syz error 26 1345d 1608d 0/1 upstream: reported syz repro on 2019/12/24 07:12
upstream possible deadlock in do_io_accounting fs syz 1003 1880d 2358d 0/26 closed as dup on 2017/12/12 21:27
upstream possible deadlock in do_io_accounting (2) fs 1 1853d 1850d 0/26 auto-closed as invalid on 2019/10/20 09:03
android-414 possible deadlock in do_io_accounting syz 70 1881d 1864d 0/1 public: reported syz repro on 2019/04/12 00:01
linux-4.14 possible deadlock in do_io_accounting C error 56 843d 1791d 0/1 upstream: reported C repro on 2019/06/24 03:04

Sample crash report:
======================================================
[ INFO: possible circular locking dependency detected ]
4.4.157+ #101 Not tainted
-------------------------------------------------------
syz-executor405/2092 is trying to acquire lock:
 (&sig->cred_guard_mutex){+.+.+.}, at: [<ffffffff815b52ab>] do_io_accounting+0x1fb/0x7e0 fs/proc/base.c:2647

but task is already holding lock:
 (&p->lock){+.+.+.}, at: [<ffffffff814e05fd>] seq_read+0xdd/0x12b0 fs/seq_file.c:178

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

       [<ffffffff811fad5e>] lock_acquire+0x15e/0x450 kernel/locking/lockdep.c:3592
       [<ffffffff8268682b>] __mutex_lock_common kernel/locking/mutex.c:521 [inline]
       [<ffffffff8268682b>] mutex_lock_nested+0xbb/0x840 kernel/locking/mutex.c:621
       [<ffffffff814e05fd>] seq_read+0xdd/0x12b0 fs/seq_file.c:178
       [<ffffffff815b0c6d>] proc_reg_read+0xfd/0x180 fs/proc/inode.c:202
       [<ffffffff81473378>] do_loop_readv_writev+0x148/0x1e0 fs/read_write.c:680
       [<ffffffff814751b1>] do_readv_writev+0x581/0x6f0 fs/read_write.c:810
       [<ffffffff81475398>] vfs_readv+0x78/0xb0 fs/read_write.c:834
       [<ffffffff8150cd7b>] kernel_readv fs/splice.c:586 [inline]
       [<ffffffff8150cd7b>] default_file_splice_read+0x4fb/0x8d0 fs/splice.c:662
       [<ffffffff81508c67>] do_splice_to+0xf7/0x140 fs/splice.c:1154
       [<ffffffff81508ef2>] splice_direct_to_actor+0x242/0x830 fs/splice.c:1226
       [<ffffffff81509683>] do_splice_direct+0x1a3/0x270 fs/splice.c:1337
       [<ffffffff814765d4>] do_sendfile+0x4e4/0xb80 fs/read_write.c:1227
       [<ffffffff814785c3>] SYSC_sendfile64 fs/read_write.c:1282 [inline]
       [<ffffffff814785c3>] SyS_sendfile64+0xc3/0x150 fs/read_write.c:1274
       [<ffffffff82690f61>] entry_SYSCALL_64_fastpath+0x1e/0x9a

       [<ffffffff811fad5e>] lock_acquire+0x15e/0x450 kernel/locking/lockdep.c:3592
       [<ffffffff8147acae>] percpu_down_read include/linux/percpu-rwsem.h:26 [inline]
       [<ffffffff8147acae>] __sb_start_write+0x1ae/0x310 fs/super.c:1221
       [<ffffffff81690ef7>] sb_start_write include/linux/fs.h:1515 [inline]
       [<ffffffff81690ef7>] ext4_run_li_request fs/ext4/super.c:2674 [inline]
       [<ffffffff81690ef7>] ext4_lazyinit_thread+0x1a7/0x750 fs/ext4/super.c:2773
       [<ffffffff8112f458>] kthread+0x268/0x300 kernel/kthread.c:211
       [<ffffffff82691345>] ret_from_fork+0x55/0x80 arch/x86/entry/entry_64.S:510

-> #5 (&eli->li_list_mtx){+.+...}:
       [<ffffffff811fad5e>] lock_acquire+0x15e/0x450 kernel/locking/lockdep.c:3592
       [<ffffffff8268682b>] __mutex_lock_common kernel/locking/mutex.c:521 [inline]
       [<ffffffff8268682b>] mutex_lock_nested+0xbb/0x840 kernel/locking/mutex.c:621
       [<ffffffff8169b0e4>] ext4_register_li_request+0x304/0x6c0 fs/ext4/super.c:2961
       [<ffffffff8169c808>] ext4_remount+0x1368/0x1bb0 fs/ext4/super.c:4909
       [<ffffffff8147dde8>] do_remount_sb2+0x428/0x7d0 fs/super.c:771
       [<ffffffff814db4fe>] do_remount fs/namespace.c:2335 [inline]
       [<ffffffff814db4fe>] do_mount+0x101e/0x28f0 fs/namespace.c:2848
       [<ffffffff814dd841>] SYSC_mount fs/namespace.c:3051 [inline]
       [<ffffffff814dd841>] SyS_mount+0x191/0x1c0 fs/namespace.c:3029
       [<ffffffff82690f61>] entry_SYSCALL_64_fastpath+0x1e/0x9a

-> #4 (&ext4_li_mtx){+.+.+.}:
       [<ffffffff811fad5e>] lock_acquire+0x15e/0x450 kernel/locking/lockdep.c:3592
       [<ffffffff8268682b>] __mutex_lock_common kernel/locking/mutex.c:521 [inline]
       [<ffffffff8268682b>] mutex_lock_nested+0xbb/0x840 kernel/locking/mutex.c:621
       [<ffffffff8169ae67>] ext4_register_li_request+0x87/0x6c0 fs/ext4/super.c:2934
       [<ffffffff8169c808>] ext4_remount+0x1368/0x1bb0 fs/ext4/super.c:4909
       [<ffffffff8147dde8>] do_remount_sb2+0x428/0x7d0 fs/super.c:771
       [<ffffffff814db4fe>] do_remount fs/namespace.c:2335 [inline]
       [<ffffffff814db4fe>] do_mount+0x101e/0x28f0 fs/namespace.c:2848
       [<ffffffff814dd841>] SYSC_mount fs/namespace.c:3051 [inline]
       [<ffffffff814dd841>] SyS_mount+0x191/0x1c0 fs/namespace.c:3029
       [<ffffffff82690f61>] entry_SYSCALL_64_fastpath+0x1e/0x9a

-> #3 (&type->s_umount_key#34){++++++}:
       [<ffffffff811fad5e>] lock_acquire+0x15e/0x450 kernel/locking/lockdep.c:3592
       [<ffffffff8268c3d2>] down_read+0x42/0x60 kernel/locking/rwsem.c:22
       [<ffffffff8147d501>] iterate_supers+0xe1/0x260 fs/super.c:537
       [<ffffffff8195fde3>] selinux_complete_init+0x2f/0x31 security/selinux/hooks.c:6154
       [<ffffffff81951b16>] security_load_policy+0x886/0x9b0 security/selinux/ss/services.c:2060
       [<ffffffff819280f1>] sel_write_load+0x191/0xfc0 security/selinux/selinuxfs.c:535
       [<ffffffff81472c4c>] __vfs_write+0x11c/0x3e0 fs/read_write.c:489
       [<ffffffff814748ce>] vfs_write+0x17e/0x4e0 fs/read_write.c:538
       [<ffffffff81476f09>] SYSC_write fs/read_write.c:585 [inline]
       [<ffffffff81476f09>] SyS_write+0xd9/0x1c0 fs/read_write.c:577
       [<ffffffff82690f61>] entry_SYSCALL_64_fastpath+0x1e/0x9a

-> #2 (sel_mutex){+.+.+.}:
       [<ffffffff811fad5e>] lock_acquire+0x15e/0x450 kernel/locking/lockdep.c:3592
       [<ffffffff8268682b>] __mutex_lock_common kernel/locking/mutex.c:521 [inline]
       [<ffffffff8268682b>] mutex_lock_nested+0xbb/0x840 kernel/locking/mutex.c:621
       [<ffffffff81925bd7>] sel_commit_bools_write+0x87/0x250 security/selinux/selinuxfs.c:1142
       [<ffffffff81472c4c>] __vfs_write+0x11c/0x3e0 fs/read_write.c:489
       [<ffffffff81473000>] __kernel_write+0xf0/0x320 fs/read_write.c:511
       [<ffffffff815098ad>] write_pipe_buf+0x15d/0x1f0 fs/splice.c:1074
       [<ffffffff8150a744>] splice_from_pipe_feed fs/splice.c:776 [inline]
       [<ffffffff8150a744>] __splice_from_pipe+0x364/0x790 fs/splice.c:901
       [<ffffffff8150d7e9>] splice_from_pipe+0xf9/0x170 fs/splice.c:936
       [<ffffffff8150d8ec>] default_file_splice_write+0x3c/0x80 fs/splice.c:1086
       [<ffffffff8150e9b1>] do_splice_from fs/splice.c:1128 [inline]
       [<ffffffff8150e9b1>] do_splice fs/splice.c:1404 [inline]
       [<ffffffff8150e9b1>] SYSC_splice fs/splice.c:1707 [inline]
       [<ffffffff8150e9b1>] SyS_splice+0xde1/0x1430 fs/splice.c:1690
       [<ffffffff82690f61>] entry_SYSCALL_64_fastpath+0x1e/0x9a

-> #1 (&pipe->mutex/1){+.+.+.}:
       [<ffffffff811fad5e>] lock_acquire+0x15e/0x450 kernel/locking/lockdep.c:3592
       [<ffffffff8268682b>] __mutex_lock_common kernel/locking/mutex.c:521 [inline]
       [<ffffffff8268682b>] mutex_lock_nested+0xbb/0x840 kernel/locking/mutex.c:621
       [<ffffffff8148e2ec>] __pipe_lock fs/pipe.c:86 [inline]
       [<ffffffff8148e2ec>] fifo_open+0x15c/0x9e0 fs/pipe.c:896
       [<ffffffff8146da3d>] do_dentry_open+0x38d/0xbd0 fs/open.c:749
       [<ffffffff814711aa>] vfs_open+0x12a/0x210 fs/open.c:862
       [<ffffffff814a063c>] do_last fs/namei.c:3222 [inline]
       [<ffffffff814a063c>] path_openat+0x50c/0x39a0 fs/namei.c:3359
       [<ffffffff814a7767>] do_filp_open+0x197/0x270 fs/namei.c:3393
       [<ffffffff8148375f>] do_open_execat+0x10f/0x6f0 fs/exec.c:800
       [<ffffffff81488d81>] do_execveat_common.isra.15+0x6a1/0x1f00 fs/exec.c:1573
       [<ffffffff8148af52>] do_execve fs/exec.c:1679 [inline]
       [<ffffffff8148af52>] SYSC_execve fs/exec.c:1760 [inline]
       [<ffffffff8148af52>] SyS_execve+0x42/0x50 fs/exec.c:1755
       [<ffffffff82691275>] return_from_execve+0x0/0x23

-> #0 (&sig->cred_guard_mutex){+.+.+.}:
       [<ffffffff811f740e>] check_prev_add kernel/locking/lockdep.c:1853 [inline]
       [<ffffffff811f740e>] check_prevs_add kernel/locking/lockdep.c:1958 [inline]
       [<ffffffff811f740e>] validate_chain kernel/locking/lockdep.c:2144 [inline]
       [<ffffffff811f740e>] __lock_acquire+0x3b6e/0x5ba0 kernel/locking/lockdep.c:3213
       [<ffffffff811fad5e>] lock_acquire+0x15e/0x450 kernel/locking/lockdep.c:3592
       [<ffffffff826878bc>] __mutex_lock_common kernel/locking/mutex.c:521 [inline]
       [<ffffffff826878bc>] mutex_lock_killable_nested+0xcc/0x980 kernel/locking/mutex.c:641
       [<ffffffff815b52ab>] do_io_accounting+0x1fb/0x7e0 fs/proc/base.c:2647
       [<ffffffff815b58b2>] proc_tgid_io_accounting+0x22/0x30 fs/proc/base.c:2696
       [<ffffffff815b348d>] proc_single_show+0xfd/0x170 fs/proc/base.c:791
       [<ffffffff814e09d6>] seq_read+0x4b6/0x12b0 fs/seq_file.c:240
       [<ffffffff8147287c>] __vfs_read+0x11c/0x3d0 fs/read_write.c:432
       [<ffffffff81474520>] vfs_read+0x130/0x360 fs/read_write.c:454
       [<ffffffff81477135>] SYSC_pread64 fs/read_write.c:607 [inline]
       [<ffffffff81477135>] SyS_pread64+0x145/0x170 fs/read_write.c:594
       [<ffffffff82690f61>] entry_SYSCALL_64_fastpath+0x1e/0x9a

other info that might help us debug this:

Chain exists of:
  &sig->cred_guard_mutex --> sb_writers#4 --> &p->lock

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&p->lock);
                               lock(sb_writers#4);
                               lock(&p->lock);
  lock(&sig->cred_guard_mutex);

 *** DEADLOCK ***

1 lock held by syz-executor405/2092:
 #0:  (&p->lock){+.+.+.}, at: [<ffffffff814e05fd>] seq_read+0xdd/0x12b0 fs/seq_file.c:178

stack backtrace:
CPU: 1 PID: 2092 Comm: syz-executor405 Not tainted 4.4.157+ #101
 0000000000000000 412908aa696cbf82 ffff8800b9c576b8 ffffffff81a559fd
 ffffffff83ab26a0 ffffffff83aae320 ffffffff83aac9d0 ffff8800b7ecb868
 ffff8800b7ecaf80 ffff8800b9c57700 ffffffff813924cf 0000000000000001
Call Trace:
 [<ffffffff81a559fd>] __dump_stack lib/dump_stack.c:15 [inline]
 [<ffffffff81a559fd>] dump_stack+0xc1/0x124 lib/dump_stack.c:51
 [<ffffffff813924cf>] print_circular_bug.cold.34+0x2f7/0x432 kernel/locking/lockdep.c:1226
 [<ffffffff811f740e>] check_prev_add kernel/locking/lockdep.c:1853 [inline]
 [<ffffffff811f740e>] check_prevs_add kernel/locking/lockdep.c:1958 [inline]
 [<ffffffff811f740e>] validate_chain kernel/locking/lockdep.c:2144 [inline]
 [<ffffffff811f740e>] __lock_acquire+0x3b6e/0x5ba0 kernel/locking/lockdep.c:3213
 [<ffffffff811fad5e>] lock_acquire+0x15e/0x450 kernel/locking/lockdep.c:3592
 [<ffffffff826878bc>] __mutex_lock_common kernel/locking/mutex.c:521 [inline]
 [<ffffffff826878bc>] mutex_lock_killable_nested+0xcc/0x980 kernel/locking/mutex.c:641
 [<ffffffff815b52ab>] do_io_accounting+0x1fb/0x7e0 fs/proc/base.c:2647
 [<ffffffff815b58b2>] proc_tgid_io_accounting+0x22/0x30 fs/proc/base.c:2696
 [<ffffffff815b348d>] proc_single_show+0xfd/0x170 fs/proc/base.c:791
 [<ffffffff814e09d6>] seq_read+0x4b6/0x12b0 fs/seq_file.c:240
 [<ffffffff8147287c>] __vfs_read+0x11c/0x3d0 fs/read_write.c:432
 [<ffffffff81474520>] vfs_read+0x130/0x360 fs/read_write.c:454
 [<ffffffff81477135>] SYSC_pread64 fs/read_write.c:607 [inline]
 [<ffffffff81477135>] SyS_pread64+0x145/0x170 fs/read_write.c:594
 [<ffffffff82690f61>] entry_SYSCALL_64_fastpath+0x1e/0x9a

Crashes (28):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2018/09/22 19:11 https://android.googlesource.com/kernel/common android-4.4 cb28adba1a09 37079712 .config console log report syz C ci-android-44-kasan-gce
2018/09/22 19:35 https://android.googlesource.com/kernel/common android-4.4 cb28adba1a09 37079712 .config console log report syz C ci-android-44-kasan-gce-386
2019/12/02 08:38 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b f879db37 .config console log report ci-android-44-kasan-gce
2019/11/29 20:44 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b d29b9e84 .config console log report ci-android-44-kasan-gce
2019/11/10 09:06 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b dc438b91 .config console log report ci-android-44-kasan-gce
2019/10/04 10:39 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b fc17ba49 .config console log report ci-android-44-kasan-gce
2019/01/19 18:00 https://android.googlesource.com/kernel/common android-4.4 24189101975d 8aa587b0 .config console log report ci-android-44-kasan-gce
2018/11/03 18:31 https://android.googlesource.com/kernel/common android-4.4 c4b00eb70496 8bd6bd63 .config console log report ci-android-44-kasan-gce
2018/10/13 23:28 https://android.googlesource.com/kernel/common android-4.4 8e7f196597f3 caf12900 .config console log report ci-android-44-kasan-gce
2018/10/06 21:55 https://android.googlesource.com/kernel/common android-4.4 ea3a6005d280 8b311eaf .config console log report ci-android-44-kasan-gce
2019/11/20 13:33 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b f4b7ed07 .config console log report ci-android-44-kasan-gce-386
2019/11/15 01:22 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b a24fe792 .config console log report ci-android-44-kasan-gce-386
2019/10/09 03:13 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b b1ebbfef .config console log report ci-android-44-kasan-gce-386
2019/08/28 05:25 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b fd37b39e .config console log report ci-android-44-kasan-gce-386
2019/01/09 19:46 https://android.googlesource.com/kernel/common android-4.4 d08574b6f0ae 45c0c1b1 .config console log report ci-android-44-kasan-gce-386
2019/01/06 04:46 https://android.googlesource.com/kernel/common android-4.4 d08574b6f0ae 53be0a37 .config console log report ci-android-44-kasan-gce-386
2018/12/31 14:55 https://android.googlesource.com/kernel/common android-4.4 dfca92bab267 2b42fdc8 .config console log report ci-android-44-kasan-gce-386
2018/12/26 13:09 https://android.googlesource.com/kernel/common android-4.4 dfca92bab267 8a41a0ad .config console log report ci-android-44-kasan-gce-386
2018/12/25 13:46 https://android.googlesource.com/kernel/common android-4.4 dfca92bab267 8a41a0ad .config console log report ci-android-44-kasan-gce-386
2018/11/26 04:16 https://android.googlesource.com/kernel/common android-4.4 564ce1b48436 3d3ec907 .config console log report ci-android-44-kasan-gce-386
2018/11/25 12:46 https://android.googlesource.com/kernel/common android-4.4 564ce1b48436 3d3ec907 .config console log report ci-android-44-kasan-gce-386
2018/11/18 19:49 https://android.googlesource.com/kernel/common android-4.4 498bf61266f1 adf636a8 .config console log report ci-android-44-kasan-gce-386
2018/11/13 23:48 https://android.googlesource.com/kernel/common android-4.4 498bf61266f1 5f5f6d14 .config console log report ci-android-44-kasan-gce-386
2018/11/12 13:15 https://android.googlesource.com/kernel/common android-4.4 0ca3fcabdc05 7b5f8621 .config console log report ci-android-44-kasan-gce-386
2018/11/07 19:10 https://android.googlesource.com/kernel/common android-4.4 1bdb20fcd457 e85d2a61 .config console log report ci-android-44-kasan-gce-386
2018/11/07 04:04 https://android.googlesource.com/kernel/common android-4.4 1bdb20fcd457 8bd6bd63 .config console log report ci-android-44-kasan-gce-386
2018/11/03 01:42 https://android.googlesource.com/kernel/common android-4.4 c4b00eb70496 8bd6bd63 .config console log report ci-android-44-kasan-gce-386
2018/10/29 07:18 https://android.googlesource.com/kernel/common android-4.4 c4b00eb70496 9ca2afa1 .config console log report ci-android-44-kasan-gce-386
* Struck through repros no longer work on HEAD.