audit: type=1400 audit(1567280717.469:208): avc:  denied  { create } for  pid=10727 comm="syz-executor.3" scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tclass=netlink_generic_socket permissive=0
======================================================
[ INFO: possible circular locking dependency detected ]
4.4.174+ #4 Not tainted
-------------------------------------------------------
syz-executor.1/10733 is trying to acquire lock:
 (&pipe->mutex/1){+.+.+.}, at: [<ffffffff814af8b3>] pipe_lock_nested fs/pipe.c:65 [inline]
 (&pipe->mutex/1){+.+.+.}, at: [<ffffffff814af8b3>] pipe_lock+0x63/0x80 fs/pipe.c:73

but task is already holding lock:
 (sb_writers#4){.+.+.+}, at: [<ffffffff81537eed>] file_start_write include/linux/fs.h:2543 [inline]
 (sb_writers#4){.+.+.+}, at: [<ffffffff81537eed>] do_splice fs/splice.c:1403 [inline]
 (sb_writers#4){.+.+.+}, at: [<ffffffff81537eed>] SYSC_splice fs/splice.c:1707 [inline]
 (sb_writers#4){.+.+.+}, at: [<ffffffff81537eed>] SyS_splice+0xf2d/0x13a0 fs/splice.c:1690

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #5 (sb_writers#4){.+.+.+}:
       [<ffffffff81205f6e>] lock_acquire+0x15e/0x450 kernel/locking/lockdep.c:3592
       [<ffffffff8149ea2f>] percpu_down_read include/linux/percpu-rwsem.h:26 [inline]
       [<ffffffff8149ea2f>] __sb_start_write+0x1af/0x310 fs/super.c:1239
       [<ffffffff816c3af4>] sb_start_write include/linux/fs.h:1517 [inline]
       [<ffffffff816c3af4>] ext4_run_li_request fs/ext4/super.c:2685 [inline]
       [<ffffffff816c3af4>] ext4_lazyinit_thread fs/ext4/super.c:2784 [inline]
       [<ffffffff816c3af4>] ext4_lazyinit_thread+0x1e4/0x7b0 fs/ext4/super.c:2760
       [<ffffffff811342c3>] kthread+0x273/0x310 kernel/kthread.c:211
       [<ffffffff82718fc5>] ret_from_fork+0x55/0x80 arch/x86/entry/entry_64.S:537

-> #4 (&eli->li_list_mtx){+.+...}:
       [<ffffffff81205f6e>] lock_acquire+0x15e/0x450 kernel/locking/lockdep.c:3592
       [<ffffffff8270c191>] __mutex_lock_common kernel/locking/mutex.c:521 [inline]
       [<ffffffff8270c191>] mutex_lock_nested+0xc1/0xb80 kernel/locking/mutex.c:621
       [<ffffffff816cdacd>] ext4_register_li_request+0x2fd/0x7d0 fs/ext4/super.c:2972
       [<ffffffff816cf306>] ext4_remount+0x1366/0x1b90 fs/ext4/super.c:4922
       [<ffffffff814a1ccb>] do_remount_sb2+0x41b/0x7a0 fs/super.c:781
       [<ffffffff815028ab>] do_remount fs/namespace.c:2347 [inline]
       [<ffffffff815028ab>] do_mount+0xfdb/0x2a40 fs/namespace.c:2860
       [<ffffffff81504d00>] SYSC_mount fs/namespace.c:3063 [inline]
       [<ffffffff81504d00>] SyS_mount+0x130/0x1d0 fs/namespace.c:3041
       [<ffffffff82718ba1>] entry_SYSCALL_64_fastpath+0x1e/0x9a

-> #3 (&ext4_li_mtx){+.+.+.}:
       [<ffffffff81205f6e>] lock_acquire+0x15e/0x450 kernel/locking/lockdep.c:3592
       [<ffffffff8270c191>] __mutex_lock_common kernel/locking/mutex.c:521 [inline]
       [<ffffffff8270c191>] mutex_lock_nested+0xc1/0xb80 kernel/locking/mutex.c:621
       [<ffffffff816cd859>] ext4_register_li_request+0x89/0x7d0 fs/ext4/super.c:2945
       [<ffffffff816cf306>] ext4_remount+0x1366/0x1b90 fs/ext4/super.c:4922
       [<ffffffff814a1ccb>] do_remount_sb2+0x41b/0x7a0 fs/super.c:781
       [<ffffffff815028ab>] do_remount fs/namespace.c:2347 [inline]
       [<ffffffff815028ab>] do_mount+0xfdb/0x2a40 fs/namespace.c:2860
       [<ffffffff81504d00>] SYSC_mount fs/namespace.c:3063 [inline]
       [<ffffffff81504d00>] SyS_mount+0x130/0x1d0 fs/namespace.c:3041
       [<ffffffff82718ba1>] entry_SYSCALL_64_fastpath+0x1e/0x9a

-> #2 (&type->s_umount_key#34){++++++}:
       [<ffffffff81205f6e>] lock_acquire+0x15e/0x450 kernel/locking/lockdep.c:3592
       [<ffffffff827139a2>] down_read+0x42/0x60 kernel/locking/rwsem.c:22
       [<ffffffff814a1411>] iterate_supers+0xe1/0x250 fs/super.c:547
       [<ffffffff819b19f7>] selinux_complete_init+0x2f/0x31 security/selinux/hooks.c:6154
       [<ffffffff819a353d>] security_load_policy+0x69d/0x9c0 security/selinux/ss/services.c:2060
       [<ffffffff81979e55>] sel_write_load+0x175/0xf90 security/selinux/selinuxfs.c:535
       [<ffffffff81496916>] __vfs_write+0x116/0x3d0 fs/read_write.c:491
       [<ffffffff81498612>] vfs_write+0x182/0x4e0 fs/read_write.c:540
       [<ffffffff8149ac4c>] SYSC_write fs/read_write.c:587 [inline]
       [<ffffffff8149ac4c>] SyS_write+0xdc/0x1c0 fs/read_write.c:579
       [<ffffffff82718ba1>] entry_SYSCALL_64_fastpath+0x1e/0x9a

-> #1 (sel_mutex){+.+.+.}:
       [<ffffffff81205f6e>] lock_acquire+0x15e/0x450 kernel/locking/lockdep.c:3592
       [<ffffffff8270c191>] __mutex_lock_common kernel/locking/mutex.c:521 [inline]
       [<ffffffff8270c191>] mutex_lock_nested+0xc1/0xb80 kernel/locking/mutex.c:621
       [<ffffffff81977a39>] sel_commit_bools_write+0x89/0x260 security/selinux/selinuxfs.c:1142
       [<ffffffff81496916>] __vfs_write+0x116/0x3d0 fs/read_write.c:491
       [<ffffffff81496ce2>] __kernel_write+0x112/0x370 fs/read_write.c:513
       [<ffffffff81532e6d>] write_pipe_buf+0x15d/0x1f0 fs/splice.c:1074
       [<ffffffff81533b6e>] splice_from_pipe_feed fs/splice.c:776 [inline]
       [<ffffffff81533b6e>] __splice_from_pipe+0x37e/0x7a0 fs/splice.c:901
       [<ffffffff81536be8>] splice_from_pipe+0x108/0x170 fs/splice.c:936
       [<ffffffff81536cdc>] default_file_splice_write+0x3c/0x80 fs/splice.c:1086
       [<ffffffff81537d31>] do_splice_from fs/splice.c:1128 [inline]
       [<ffffffff81537d31>] do_splice fs/splice.c:1404 [inline]
       [<ffffffff81537d31>] SYSC_splice fs/splice.c:1707 [inline]
       [<ffffffff81537d31>] SyS_splice+0xd71/0x13a0 fs/splice.c:1690
       [<ffffffff82718ba1>] entry_SYSCALL_64_fastpath+0x1e/0x9a

-> #0 (&pipe->mutex/1){+.+.+.}:
       [<ffffffff81202d86>] check_prev_add kernel/locking/lockdep.c:1853 [inline]
       [<ffffffff81202d86>] check_prevs_add kernel/locking/lockdep.c:1958 [inline]
       [<ffffffff81202d86>] validate_chain kernel/locking/lockdep.c:2144 [inline]
       [<ffffffff81202d86>] __lock_acquire+0x37d6/0x4f50 kernel/locking/lockdep.c:3213
       [<ffffffff81205f6e>] lock_acquire+0x15e/0x450 kernel/locking/lockdep.c:3592
       [<ffffffff8270c191>] __mutex_lock_common kernel/locking/mutex.c:521 [inline]
       [<ffffffff8270c191>] mutex_lock_nested+0xc1/0xb80 kernel/locking/mutex.c:621
       [<ffffffff814af8b3>] pipe_lock_nested fs/pipe.c:65 [inline]
       [<ffffffff814af8b3>] pipe_lock+0x63/0x80 fs/pipe.c:73
       [<ffffffff815342e9>] iter_file_splice_write+0x179/0xb30 fs/splice.c:974
       [<ffffffff81537d31>] do_splice_from fs/splice.c:1128 [inline]
       [<ffffffff81537d31>] do_splice fs/splice.c:1404 [inline]
       [<ffffffff81537d31>] SYSC_splice fs/splice.c:1707 [inline]
       [<ffffffff81537d31>] SyS_splice+0xd71/0x13a0 fs/splice.c:1690
       [<ffffffff82718ba1>] entry_SYSCALL_64_fastpath+0x1e/0x9a

other info that might help us debug this:

Chain exists of:
  &pipe->mutex/1 --> &eli->li_list_mtx --> sb_writers#4

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(sb_writers#4);
                               lock(&eli->li_list_mtx);
                               lock(sb_writers#4);
  lock(&pipe->mutex/1);

 *** DEADLOCK ***

1 lock held by syz-executor.1/10733:
 #0:  (sb_writers#4){.+.+.+}, at: [<ffffffff81537eed>] file_start_write include/linux/fs.h:2543 [inline]
 #0:  (sb_writers#4){.+.+.+}, at: [<ffffffff81537eed>] do_splice fs/splice.c:1403 [inline]
 #0:  (sb_writers#4){.+.+.+}, at: [<ffffffff81537eed>] SYSC_splice fs/splice.c:1707 [inline]
 #0:  (sb_writers#4){.+.+.+}, at: [<ffffffff81537eed>] SyS_splice+0xf2d/0x13a0 fs/splice.c:1690

stack backtrace:
CPU: 0 PID: 10733 Comm: syz-executor.1 Not tainted 4.4.174+ #4
 0000000000000000 6dce86cbb2d46e70 ffff8801d88578b0 ffffffff81aad1a1
 ffffffff84057a80 ffff8800bad68000 ffffffff83abd100 ffffffff83abc1d0
 ffffffff83ac7ed0 ffff8801d8857900 ffffffff813abcda ffffffff83e1e980
Call Trace:
 [<ffffffff81aad1a1>] __dump_stack lib/dump_stack.c:15 [inline]
 [<ffffffff81aad1a1>] dump_stack+0xc1/0x120 lib/dump_stack.c:51
 [<ffffffff813abcda>] print_circular_bug.cold+0x2f7/0x44e kernel/locking/lockdep.c:1226
 [<ffffffff81202d86>] check_prev_add kernel/locking/lockdep.c:1853 [inline]
 [<ffffffff81202d86>] check_prevs_add kernel/locking/lockdep.c:1958 [inline]
 [<ffffffff81202d86>] validate_chain kernel/locking/lockdep.c:2144 [inline]
 [<ffffffff81202d86>] __lock_acquire+0x37d6/0x4f50 kernel/locking/lockdep.c:3213
 [<ffffffff81205f6e>] lock_acquire+0x15e/0x450 kernel/locking/lockdep.c:3592
 [<ffffffff8270c191>] __mutex_lock_common kernel/locking/mutex.c:521 [inline]
 [<ffffffff8270c191>] mutex_lock_nested+0xc1/0xb80 kernel/locking/mutex.c:621
 [<ffffffff814af8b3>] pipe_lock_nested fs/pipe.c:65 [inline]
 [<ffffffff814af8b3>] pipe_lock+0x63/0x80 fs/pipe.c:73
 [<ffffffff815342e9>] iter_file_splice_write+0x179/0xb30 fs/splice.c:974
 [<ffffffff81537d31>] do_splice_from fs/splice.c:1128 [inline]
 [<ffffffff81537d31>] do_splice fs/splice.c:1404 [inline]
 [<ffffffff81537d31>] SYSC_splice fs/splice.c:1707 [inline]
 [<ffffffff81537d31>] SyS_splice+0xd71/0x13a0 fs/splice.c:1690
 [<ffffffff82718ba1>] entry_SYSCALL_64_fastpath+0x1e/0x9a
audit: type=1400 audit(1567280717.939:209): avc:  denied  { set_context_mgr } for  pid=10753 comm="syz-executor.4" scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tclass=binder permissive=0
binder: 10753:10756 ioctl 40046207 0 returned -13
binder: 10753:10756 unknown command -849209730
binder: 10753:10756 ioctl c0306201 20000080 returned -22
audit: type=1400 audit(1567280717.989:210): avc:  denied  { set_context_mgr } for  pid=10753 comm="syz-executor.4" scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tclass=binder permissive=0
binder: 10753:10757 ioctl 40046207 0 returned -13
binder: 10753:10757 unknown command -849209730
binder: 10753:10757 ioctl c0306201 20000080 returned -22
input: syz0 as /devices/virtual/input/input24
uinput: write device info first
input: syz0 as /devices/virtual/input/input26
input: syz0 as /devices/virtual/input/input27
input: syz0 as /devices/virtual/input/input28
audit: type=1400 audit(1567280726.929:211): avc:  denied  { create } for  pid=11074 comm="syz-executor.3" scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tclass=netlink_generic_socket permissive=0
audit: type=1400 audit(1567280727.029:212): avc:  denied  { create } for  pid=11083 comm="syz-executor.3" scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tclass=netlink_generic_socket permissive=0
audit: type=1400 audit(1567280727.069:213): avc:  denied  { create } for  pid=11083 comm="syz-executor.3" scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tclass=netlink_generic_socket permissive=0
audit: type=1400 audit(1567280727.139:214): avc:  denied  { create } for  pid=11083 comm="syz-executor.3" scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tclass=netlink_generic_socket permissive=0
input: syz0 as /devices/virtual/input/input29