syzbot


possible deadlock in sel_commit_bools_write

Status: public: reported C repro on 2019/04/11 08:44
Reported-by: syzbot+ce459bafcb68ff272f48@syzkaller.appspotmail.com
First crash: 2254d, last: 1817d

Sample crash report:
======================================================
[ INFO: possible circular locking dependency detected ]
4.4.162+ #117 Not tainted
-------------------------------------------------------
syz-executor023/2087 is trying to acquire lock:
 (sel_mutex){+.+.+.}, at: [<ffffffff81963767>] sel_commit_bools_write+0x87/0x250 security/selinux/selinuxfs.c:1142

but task is already holding lock:
 (&pipe->mutex/1){+.+.+.}, at: [<ffffffff814a9afe>] pipe_lock_nested fs/pipe.c:65 [inline]
 (&pipe->mutex/1){+.+.+.}, at: [<ffffffff814a9afe>] pipe_lock+0x5e/0x70 fs/pipe.c:73

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

       [<ffffffff81202cde>] lock_acquire+0x15e/0x450 kernel/locking/lockdep.c:3592
       [<ffffffff826fad9b>] __mutex_lock_common kernel/locking/mutex.c:521 [inline]
       [<ffffffff826fad9b>] mutex_lock_nested+0xbb/0x8d0 kernel/locking/mutex.c:621
       [<ffffffff814aca0c>] __pipe_lock fs/pipe.c:86 [inline]
       [<ffffffff814aca0c>] fifo_open+0x15c/0x9e0 fs/pipe.c:896
       [<ffffffff8148ba0d>] do_dentry_open+0x38d/0xbd0 fs/open.c:749
       [<ffffffff8148f17a>] vfs_open+0x12a/0x210 fs/open.c:862
       [<ffffffff814bed5c>] do_last fs/namei.c:3222 [inline]
       [<ffffffff814bed5c>] path_openat+0x50c/0x39a0 fs/namei.c:3359
       [<ffffffff814c5e87>] do_filp_open+0x197/0x270 fs/namei.c:3393
       [<ffffffff814a1eef>] do_open_execat+0x10f/0x6f0 fs/exec.c:800
       [<ffffffff814a74a1>] do_execveat_common.isra.14+0x6a1/0x1f00 fs/exec.c:1573
       [<ffffffff814a9672>] do_execve fs/exec.c:1679 [inline]
       [<ffffffff814a9672>] SYSC_execve fs/exec.c:1760 [inline]
       [<ffffffff814a9672>] SyS_execve+0x42/0x50 fs/exec.c:1755
       [<ffffffff827065f5>] return_from_execve+0x0/0x23

       [<ffffffff81202cde>] lock_acquire+0x15e/0x450 kernel/locking/lockdep.c:3592
       [<ffffffff826fbf4c>] __mutex_lock_common kernel/locking/mutex.c:521 [inline]
       [<ffffffff826fbf4c>] mutex_lock_killable_nested+0xcc/0xa10 kernel/locking/mutex.c:641
       [<ffffffff815e2b54>] lock_trace+0x44/0xc0 fs/proc/base.c:448
       [<ffffffff815e33a9>] proc_pid_syscall+0xa9/0x260 fs/proc/base.c:683
       [<ffffffff815daffd>] proc_single_show+0xfd/0x170 fs/proc/base.c:805
       [<ffffffff81501656>] seq_read+0x4b6/0x12b0 fs/seq_file.c:240
       [<ffffffff8149084c>] __vfs_read+0x11c/0x3d0 fs/read_write.c:432
       [<ffffffff81492520>] vfs_read+0x130/0x360 fs/read_write.c:454
       [<ffffffff81494d49>] SYSC_read fs/read_write.c:569 [inline]
       [<ffffffff81494d49>] SyS_read+0xd9/0x1c0 fs/read_write.c:562
       [<ffffffff827062e1>] entry_SYSCALL_64_fastpath+0x1e/0x9a

       [<ffffffff81202cde>] lock_acquire+0x15e/0x450 kernel/locking/lockdep.c:3592
       [<ffffffff826fad9b>] __mutex_lock_common kernel/locking/mutex.c:521 [inline]
       [<ffffffff826fad9b>] mutex_lock_nested+0xbb/0x8d0 kernel/locking/mutex.c:621
       [<ffffffff8150127d>] seq_read+0xdd/0x12b0 fs/seq_file.c:178
       [<ffffffff81491378>] do_loop_readv_writev+0x148/0x1e0 fs/read_write.c:680
       [<ffffffff814931b1>] do_readv_writev+0x581/0x6f0 fs/read_write.c:810
       [<ffffffff81493398>] vfs_readv+0x78/0xb0 fs/read_write.c:834
       [<ffffffff8152f53f>] kernel_readv fs/splice.c:586 [inline]
       [<ffffffff8152f53f>] default_file_splice_read+0x50f/0x8f0 fs/splice.c:662
       [<ffffffff8152b417>] do_splice_to+0xf7/0x140 fs/splice.c:1154
       [<ffffffff8152b6a2>] splice_direct_to_actor+0x242/0x830 fs/splice.c:1226
       [<ffffffff8152be33>] do_splice_direct+0x1a3/0x270 fs/splice.c:1337
       [<ffffffff814945d4>] do_sendfile+0x4e4/0xb80 fs/read_write.c:1227
       [<ffffffff814965c3>] SYSC_sendfile64 fs/read_write.c:1282 [inline]
       [<ffffffff814965c3>] SyS_sendfile64+0xc3/0x150 fs/read_write.c:1274
       [<ffffffff827062e1>] entry_SYSCALL_64_fastpath+0x1e/0x9a

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

       [<ffffffff81202cde>] lock_acquire+0x15e/0x450 kernel/locking/lockdep.c:3592
       [<ffffffff826fad9b>] __mutex_lock_common kernel/locking/mutex.c:521 [inline]
       [<ffffffff826fad9b>] mutex_lock_nested+0xbb/0x8d0 kernel/locking/mutex.c:621
       [<ffffffff816c50c4>] ext4_register_li_request+0x304/0x7a0 fs/ext4/super.c:2961
       [<ffffffff816c68c8>] ext4_remount+0x1368/0x1bb0 fs/ext4/super.c:4911
       [<ffffffff8149bf58>] do_remount_sb2+0x428/0x7d0 fs/super.c:771
       [<ffffffff814fbe9e>] do_remount fs/namespace.c:2335 [inline]
       [<ffffffff814fbe9e>] do_mount+0x101e/0x2a10 fs/namespace.c:2848
       [<ffffffff814fe3e1>] SYSC_mount fs/namespace.c:3051 [inline]
       [<ffffffff814fe3e1>] SyS_mount+0x191/0x1c0 fs/namespace.c:3029
       [<ffffffff827062e1>] entry_SYSCALL_64_fastpath+0x1e/0x9a

       [<ffffffff81202cde>] lock_acquire+0x15e/0x450 kernel/locking/lockdep.c:3592
       [<ffffffff826fad9b>] __mutex_lock_common kernel/locking/mutex.c:521 [inline]
       [<ffffffff826fad9b>] mutex_lock_nested+0xbb/0x8d0 kernel/locking/mutex.c:621
       [<ffffffff816c4e47>] ext4_register_li_request+0x87/0x7a0 fs/ext4/super.c:2934
       [<ffffffff816c68c8>] ext4_remount+0x1368/0x1bb0 fs/ext4/super.c:4911
       [<ffffffff8149bf58>] do_remount_sb2+0x428/0x7d0 fs/super.c:771
       [<ffffffff814fbe9e>] do_remount fs/namespace.c:2335 [inline]
       [<ffffffff814fbe9e>] do_mount+0x101e/0x2a10 fs/namespace.c:2848
       [<ffffffff814fe3e1>] SYSC_mount fs/namespace.c:3051 [inline]
       [<ffffffff814fe3e1>] SyS_mount+0x191/0x1c0 fs/namespace.c:3029
       [<ffffffff827062e1>] entry_SYSCALL_64_fastpath+0x1e/0x9a

       [<ffffffff81202cde>] lock_acquire+0x15e/0x450 kernel/locking/lockdep.c:3592
       [<ffffffff82701312>] down_read+0x42/0x60 kernel/locking/rwsem.c:22
       [<ffffffff8149b671>] iterate_supers+0xe1/0x260 fs/super.c:537
       [<ffffffff8199e104>] selinux_complete_init+0x2f/0x31 security/selinux/hooks.c:6154
       [<ffffffff8198fd56>] security_load_policy+0x886/0x9b0 security/selinux/ss/services.c:2060
       [<ffffffff81965c81>] sel_write_load+0x191/0xfc0 security/selinux/selinuxfs.c:535
       [<ffffffff81490c1c>] __vfs_write+0x11c/0x3e0 fs/read_write.c:489
       [<ffffffff814928ce>] vfs_write+0x17e/0x4e0 fs/read_write.c:538
       [<ffffffff81494f09>] SYSC_write fs/read_write.c:585 [inline]
       [<ffffffff81494f09>] SyS_write+0xd9/0x1c0 fs/read_write.c:577
       [<ffffffff827062e1>] entry_SYSCALL_64_fastpath+0x1e/0x9a

       [<ffffffff811ff0fc>] check_prev_add kernel/locking/lockdep.c:1853 [inline]
       [<ffffffff811ff0fc>] check_prevs_add kernel/locking/lockdep.c:1958 [inline]
       [<ffffffff811ff0fc>] validate_chain kernel/locking/lockdep.c:2144 [inline]
       [<ffffffff811ff0fc>] __lock_acquire+0x3e6c/0x5f10 kernel/locking/lockdep.c:3213
       [<ffffffff81202cde>] lock_acquire+0x15e/0x450 kernel/locking/lockdep.c:3592
       [<ffffffff826fad9b>] __mutex_lock_common kernel/locking/mutex.c:521 [inline]
       [<ffffffff826fad9b>] mutex_lock_nested+0xbb/0x8d0 kernel/locking/mutex.c:621
       [<ffffffff81963767>] sel_commit_bools_write+0x87/0x250 security/selinux/selinuxfs.c:1142
       [<ffffffff81490c1c>] __vfs_write+0x11c/0x3e0 fs/read_write.c:489
       [<ffffffff81490fea>] __kernel_write+0x10a/0x350 fs/read_write.c:511
       [<ffffffff8152c05d>] write_pipe_buf+0x15d/0x1f0 fs/splice.c:1074
       [<ffffffff8152cef4>] splice_from_pipe_feed fs/splice.c:776 [inline]
       [<ffffffff8152cef4>] __splice_from_pipe+0x364/0x790 fs/splice.c:901
       [<ffffffff8152ffb9>] splice_from_pipe+0xf9/0x170 fs/splice.c:936
       [<ffffffff815300bc>] default_file_splice_write+0x3c/0x80 fs/splice.c:1086
       [<ffffffff81531181>] do_splice_from fs/splice.c:1128 [inline]
       [<ffffffff81531181>] do_splice fs/splice.c:1404 [inline]
       [<ffffffff81531181>] SYSC_splice fs/splice.c:1707 [inline]
       [<ffffffff81531181>] SyS_splice+0xde1/0x1430 fs/splice.c:1690
       [<ffffffff827062e1>] entry_SYSCALL_64_fastpath+0x1e/0x9a

other info that might help us debug this:

Chain exists of:
 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&pipe->mutex/1);
                               lock(&sig->cred_guard_mutex);
                               lock(&pipe->mutex/1);
  lock(sel_mutex);

 *** DEADLOCK ***

2 locks held by syz-executor023/2087:
 #0:  (sb_writers#3){.+.+.+}, at: [<ffffffff8153134a>] file_start_write include/linux/fs.h:2541 [inline]
 #0:  (sb_writers#3){.+.+.+}, at: [<ffffffff8153134a>] do_splice fs/splice.c:1403 [inline]
 #0:  (sb_writers#3){.+.+.+}, at: [<ffffffff8153134a>] SYSC_splice fs/splice.c:1707 [inline]
 #0:  (sb_writers#3){.+.+.+}, at: [<ffffffff8153134a>] SyS_splice+0xfaa/0x1430 fs/splice.c:1690
 #1:  (&pipe->mutex/1){+.+.+.}, at: [<ffffffff814a9afe>] pipe_lock_nested fs/pipe.c:65 [inline]
 #1:  (&pipe->mutex/1){+.+.+.}, at: [<ffffffff814a9afe>] pipe_lock+0x5e/0x70 fs/pipe.c:73

stack backtrace:
CPU: 0 PID: 2087 Comm: syz-executor023 Not tainted 4.4.162+ #117
 0000000000000000 3f5b8160f0f4f9e9 ffff8801d3f4f5f8 ffffffff81a994bd
 ffffffff83aae4c0 ffffffff83ab50c0 ffffffff83ab0680 ffff8801d5d4e810
 ffff8801d5d4df00 ffff8801d3f4f640 ffffffff813a834a 0000000000000002
Call Trace:
 [<ffffffff81a994bd>] __dump_stack lib/dump_stack.c:15 [inline]
 [<ffffffff81a994bd>] dump_stack+0xc1/0x124 lib/dump_stack.c:51
 [<ffffffff813a834a>] print_circular_bug.cold.34+0x2f7/0x432 kernel/locking/lockdep.c:1226
 [<ffffffff811ff0fc>] check_prev_add kernel/locking/lockdep.c:1853 [inline]
 [<ffffffff811ff0fc>] check_prevs_add kernel/locking/lockdep.c:1958 [inline]
 [<ffffffff811ff0fc>] validate_chain kernel/locking/lockdep.c:2144 [inline]
 [<ffffffff811ff0fc>] __lock_acquire+0x3e6c/0x5f10 kernel/locking/lockdep.c:3213
 [<ffffffff81202cde>] lock_acquire+0x15e/0x450 kernel/locking/lockdep.c:3592
 [<ffffffff826fad9b>] __mutex_lock_common kernel/locking/mutex.c:521 [inline]
 [<ffffffff826fad9b>] mutex_lock_nested+0xbb/0x8d0 kernel/locking/mutex.c:621
 [<ffffffff81963767>] sel_commit_bools_write+0x87/0x250 security/selinux/selinuxfs.c:1142
 [<ffffffff81490c1c>] __vfs_write+0x11c/0x3e0 fs/read_write.c:489
 [<ffffffff81490fea>] __kernel_write+0x10a/0x350 fs/read_write.c:511
 [<ffffffff8152c05d>] write_pipe_buf+0x15d/0x1f0 fs/splice.c:1074
 [<ffffffff8152cef4>] splice_from_pipe_feed fs/splice.c:776 [inline]
 [<ffffffff8152cef4>] __splice_from_pipe+0x364/0x790 fs/splice.c:901
 [<ffffffff8152ffb9>] splice_from_pipe+0xf9/0x170 fs/splice.c:936
 [<ffffffff815300bc>] default_file_splice_write+0x3c/0x80 fs/splice.c:1086
 [<ffffffff81531181>] do_splice_from fs/splice.c:1128 [inline]
 [<ffffffff81531181>] do_splice fs/splice.c:1404 [inline]
 [<ffffffff81531181>] SYSC_splice fs/splice.c:1707 [inline]
 [<ffffffff81531181>] SyS_splice+0xde1/0x1430 fs/splice.c:1690
 [<ffffffff827062e1>] entry_SYSCALL_64_fastpath+0x1e/0x9a

Crashes (684):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2018/10/27 23:56 https://android.googlesource.com/kernel/common android-4.4 c4b00eb70496 8efba39a .config console log report syz C ci-android-44-kasan-gce
2018/10/28 03:55 https://android.googlesource.com/kernel/common android-4.4 c4b00eb70496 8efba39a .config console log report syz C ci-android-44-kasan-gce-386
2018/10/27 23:13 https://android.googlesource.com/kernel/common android-4.4 c4b00eb70496 8efba39a .config console log report syz C ci-android-44-kasan-gce-386
2019/01/25 07:33 https://android.googlesource.com/kernel/common android-4.4 d0c3914ffbe4 bfab9cd8 .config console log report syz ci-android-44-kasan-gce
2019/01/25 08:29 https://android.googlesource.com/kernel/common android-4.4 d0c3914ffbe4 bfab9cd8 .config console log report syz ci-android-44-kasan-gce-386
2019/12/03 12:20 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b ab342da3 .config console log report ci-android-44-kasan-gce
2019/12/03 00:33 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b ab342da3 .config console log report ci-android-44-kasan-gce
2019/12/01 20:59 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b a76bf83f .config console log report ci-android-44-kasan-gce
2019/12/01 02:02 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b a76bf83f .config console log report ci-android-44-kasan-gce
2019/11/30 16:01 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b 3a75be00 .config console log report ci-android-44-kasan-gce
2019/11/28 22:47 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b 46869e3e .config console log report ci-android-44-kasan-gce
2019/11/27 23:49 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b 0d63f89c .config console log report ci-android-44-kasan-gce
2019/11/24 04:11 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b 598ca6c8 .config console log report ci-android-44-kasan-gce
2019/11/23 19:56 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b 598ca6c8 .config console log report ci-android-44-kasan-gce
2019/11/23 10:49 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b 598ca6c8 .config console log report ci-android-44-kasan-gce
2019/11/22 23:04 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b 598ca6c8 .config console log report ci-android-44-kasan-gce
2019/11/21 21:56 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b 8098ea0f .config console log report ci-android-44-kasan-gce
2019/11/21 17:26 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b 8098ea0f .config console log report ci-android-44-kasan-gce
2019/11/21 11:37 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b 8098ea0f .config console log report ci-android-44-kasan-gce
2019/11/21 05:52 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b 8098ea0f .config console log report ci-android-44-kasan-gce
2019/11/20 19:35 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b f4b7ed07 .config console log report ci-android-44-kasan-gce
2019/11/20 10:36 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b f4b7ed07 .config console log report ci-android-44-kasan-gce
2019/11/20 02:01 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b 5bc70212 .config console log report ci-android-44-kasan-gce
2019/11/19 10:50 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b 5bc70212 .config console log report ci-android-44-kasan-gce
2019/11/18 10:22 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b d5696d51 .config console log report ci-android-44-kasan-gce
2018/09/22 09:42 https://android.googlesource.com/kernel/common android-4.4 cb28adba1a09 37079712 .config console log report ci-android-44-kasan-gce
2019/12/03 16:17 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b ab342da3 .config console log report ci-android-44-kasan-gce-386
2019/12/03 14:38 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b ab342da3 .config console log report ci-android-44-kasan-gce-386
2019/12/01 16:29 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b a76bf83f .config console log report ci-android-44-kasan-gce-386
2019/12/01 15:22 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b a76bf83f .config console log report ci-android-44-kasan-gce-386
2019/12/01 12:27 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b a76bf83f .config console log report ci-android-44-kasan-gce-386
2019/12/01 09:12 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b a76bf83f .config console log report ci-android-44-kasan-gce-386
2019/11/29 08:59 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b 76357d6f .config console log report ci-android-44-kasan-gce-386
2019/11/27 11:24 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b 1048481f .config console log report ci-android-44-kasan-gce-386
2019/11/26 10:56 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b f746151a .config console log report ci-android-44-kasan-gce-386
2019/11/25 04:52 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b 598ca6c8 .config console log report ci-android-44-kasan-gce-386
2019/11/25 01:25 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b 598ca6c8 .config console log report ci-android-44-kasan-gce-386
2019/11/25 00:04 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b 598ca6c8 .config console log report ci-android-44-kasan-gce-386
2019/11/24 18:47 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b 598ca6c8 .config console log report ci-android-44-kasan-gce-386
2019/11/24 09:03 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b 598ca6c8 .config console log report ci-android-44-kasan-gce-386
2019/11/23 22:02 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b 598ca6c8 .config console log report ci-android-44-kasan-gce-386
2019/11/23 15:37 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b 598ca6c8 .config console log report ci-android-44-kasan-gce-386
2019/11/23 13:25 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b 598ca6c8 .config console log report ci-android-44-kasan-gce-386
2019/11/23 04:36 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b 598ca6c8 .config console log report ci-android-44-kasan-gce-386
2019/11/23 02:59 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b 598ca6c8 .config console log report ci-android-44-kasan-gce-386
2019/11/22 18:39 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b 598ca6c8 .config console log report ci-android-44-kasan-gce-386
2019/11/21 19:25 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b 8098ea0f .config console log report ci-android-44-kasan-gce-386
2019/11/21 03:27 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b 8098ea0f .config console log report ci-android-44-kasan-gce-386
2019/11/21 01:34 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b 8098ea0f .config console log report ci-android-44-kasan-gce-386
2019/11/20 17:59 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b f4b7ed07 .config console log report ci-android-44-kasan-gce-386
2019/11/19 05:53 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b 5bc70212 .config console log report ci-android-44-kasan-gce-386
* Struck through repros no longer work on HEAD.