possible deadlock in seq_read

17 views
Skip to first unread message

syzbot

unread,
Apr 10, 2019, 8:00:15 PM4/10/19
to syzkaller-a...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: 666c420f FROMLIST: ANDROID: binder: Add BINDER_GET_NODE_IN..
git tree: android-4.14
console output: https://syzkaller.appspot.com/x/log.txt?x=1630e07e400000
kernel config: https://syzkaller.appspot.com/x/.config?x=89d929f317ea847c
dashboard link: https://syzkaller.appspot.com/bug?extid=9e57a4133291955054ed
compiler: gcc (GCC) 8.0.1 20180413 (experimental)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=161b6511400000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=12a0d9fa400000

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+9e57a4...@syzkaller.appspotmail.com

urandom_read: 1 callbacks suppressed
random: sshd: uninitialized urandom read (32 bytes read)
audit: type=1400 audit(1537672736.150:7): avc: denied { map } for
pid=1777 comm="syz-executor580" path="/root/syz-executor580834810"
dev="sda1" ino=16481 scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023
tcontext=unconfined_u:object_r:user_home_t:s0 tclass=file permissive=1

======================================================
WARNING: possible circular locking dependency detected
4.14.71+ #8 Not tainted
------------------------------------------------------
syz-executor580/1780 is trying to acquire lock:
(&p->lock){+.+.}, at: [<ffffffff873d06c4>] seq_read+0xd4/0x11d0
fs/seq_file.c:165

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

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #2 (&pipe->mutex/1){+.+.}:
__mutex_lock_common kernel/locking/mutex.c:756 [inline]
__mutex_lock+0xf5/0x1480 kernel/locking/mutex.c:893
__pipe_lock fs/pipe.c:88 [inline]
fifo_open+0x156/0x9d0 fs/pipe.c:921
do_dentry_open+0x426/0xda0 fs/open.c:764
vfs_open+0x11c/0x210 fs/open.c:878
do_last fs/namei.c:3408 [inline]
path_openat+0x4eb/0x23a0 fs/namei.c:3550
do_filp_open+0x197/0x270 fs/namei.c:3584
do_open_execat+0x10d/0x5b0 fs/exec.c:849
do_execveat_common.isra.14+0x6cb/0x1d60 fs/exec.c:1740
do_execve fs/exec.c:1847 [inline]
SYSC_execve fs/exec.c:1928 [inline]
SyS_execve+0x34/0x40 fs/exec.c:1923
do_syscall_64+0x19b/0x4b0 arch/x86/entry/common.c:289
entry_SYSCALL_64_after_hwframe+0x42/0xb7

-> #1 (&sig->cred_guard_mutex){+.+.}:
__mutex_lock_common kernel/locking/mutex.c:756 [inline]
__mutex_lock+0xf5/0x1480 kernel/locking/mutex.c:893
lock_trace+0x3f/0xc0 fs/proc/base.c:408
proc_pid_personality+0x17/0xc0 fs/proc/base.c:2905
proc_single_show+0xf1/0x160 fs/proc/base.c:748
traverse+0x32b/0x8a0 fs/seq_file.c:111
seq_read+0xc94/0x11d0 fs/seq_file.c:192
do_loop_readv_writev fs/read_write.c:698 [inline]
do_iter_read+0x3cc/0x580 fs/read_write.c:922
vfs_readv+0xe6/0x150 fs/read_write.c:984
kernel_readv fs/splice.c:361 [inline]
default_file_splice_read+0x495/0x860 fs/splice.c:416
do_splice_to+0x102/0x150 fs/splice.c:880
splice_direct_to_actor+0x21d/0x750 fs/splice.c:952
do_splice_direct+0x17b/0x220 fs/splice.c:1061
do_sendfile+0x4a1/0xb50 fs/read_write.c:1438
SYSC_sendfile64 fs/read_write.c:1493 [inline]
SyS_sendfile64+0xab/0x140 fs/read_write.c:1485
do_syscall_64+0x19b/0x4b0 arch/x86/entry/common.c:289
entry_SYSCALL_64_after_hwframe+0x42/0xb7

-> #0 (&p->lock){+.+.}:
lock_acquire+0x10f/0x380 kernel/locking/lockdep.c:3991
__mutex_lock_common kernel/locking/mutex.c:756 [inline]
__mutex_lock+0xf5/0x1480 kernel/locking/mutex.c:893
seq_read+0xd4/0x11d0 fs/seq_file.c:165
proc_reg_read+0xef/0x170 fs/proc/inode.c:217
do_loop_readv_writev fs/read_write.c:698 [inline]
do_iter_read+0x3cc/0x580 fs/read_write.c:922
vfs_readv+0xe6/0x150 fs/read_write.c:984
kernel_readv fs/splice.c:361 [inline]
default_file_splice_read+0x495/0x860 fs/splice.c:416
do_splice_to+0x102/0x150 fs/splice.c:880
do_splice fs/splice.c:1173 [inline]
SYSC_splice fs/splice.c:1402 [inline]
SyS_splice+0xf4d/0x12a0 fs/splice.c:1382
do_syscall_64+0x19b/0x4b0 arch/x86/entry/common.c:289
entry_SYSCALL_64_after_hwframe+0x42/0xb7

other info that might help us debug this:

Chain exists of:
&p->lock --> &sig->cred_guard_mutex --> &pipe->mutex/1

Possible unsafe locking scenario:

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

*** DEADLOCK ***

1 lock held by syz-executor580/1780:
#0: (&pipe->mutex/1){+.+.}, at: [<ffffffff873726d8>] pipe_lock_nested
fs/pipe.c:67 [inline]
#0: (&pipe->mutex/1){+.+.}, at: [<ffffffff873726d8>] pipe_lock+0x58/0x70
fs/pipe.c:75

stack backtrace:
CPU: 0 PID: 1780 Comm: syz-executor580 Not tainted 4.14.71+ #8
Call Trace:
__dump_stack lib/dump_stack.c:17 [inline]
dump_stack+0xb9/0x11b lib/dump_stack.c:53
print_circular_bug.isra.18.cold.43+0x2d3/0x40c
kernel/locking/lockdep.c:1258
check_prev_add kernel/locking/lockdep.c:1901 [inline]
check_prevs_add kernel/locking/lockdep.c:2018 [inline]
validate_chain kernel/locking/lockdep.c:2460 [inline]
__lock_acquire+0x2ff9/0x4320 kernel/locking/lockdep.c:3487
lock_acquire+0x10f/0x380 kernel/locking/lockdep.c:3991
__mutex_lock_common kernel/locking/mutex.c:756 [inline]
__mutex_lock+0xf5/0x1480 kernel/locking/mutex.c:893
seq_read+0xd4/0x11d0 fs/seq_file.c:165
proc_reg_read+0xef/0x170 fs/proc/inode.c:217
do_loop_readv_writev fs/read_write.c:698 [inline]
do_iter_read+0x3cc/0x580 fs/read_write.c:922
vfs_readv+0xe6/0x150 fs/read_write.c:984
kernel_readv fs/splice.c:361 [inline]
default_file_splice_read+0x495/0x860 fs/splice.c:416
do_splice_to+0x102/0x150 fs/splice.c:880
do_splice fs/splice.c:1173 [inline]
SYSC_splice fs/splice.c:1402 [inline]
SyS_splice+0xf4d/0x12a0 fs/splice.c:1382
do_syscall_64+0x19b/0x4b0 arch/x86/entry/common.c:289
entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x4457e9
RSP: 002b:00007f7d6f0e3d08 EFLAGS: 00000216 ORIG_RAX: 0000000000000113
RAX: ffffffffffffffda RBX: 00000000006dac68 RCX: 00000000004457e9
RDX: 0000000000000005 RSI: 0000000000000000 RDI: 0000000000000004
RBP: 00000000006dac60 R08: 0000000000000200 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000216 R12: 00000000006dac6c
R13: 00007f7d6f0e3d20 R14: 706d67692f74656e R15: 00000000006dad4c


---
This bug is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this bug report. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
syzbot can test patches for this bug, for details see:
https://goo.gl/tpsmEJ#testing-patches

syzbot

unread,
Apr 11, 2019, 4:44:35 AM4/11/19
to syzkaller-a...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: 498bf612 ANDROID: zram: set comp_len to PAGE_SIZE when pag..
git tree: android-4.4
console output: https://syzkaller.appspot.com/x/log.txt?x=1109f2d5400000
kernel config: https://syzkaller.appspot.com/x/.config?x=91537011cdb01073
dashboard link: https://syzkaller.appspot.com/bug?extid=91cc9c1b9fb8e7310747
compiler: gcc (GCC) 8.0.1 20180413 (experimental)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=178f02b9400000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=11698a47400000

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+91cc9c...@syzkaller.appspotmail.com


======================================================
[ INFO: possible circular locking dependency detected ]
4.4.163+ #122 Not tainted
-------------------------------------------------------
syz-executor742/12963 is trying to acquire lock:
(&p->lock){+.+.+.}, at: [<ffffffff815014ed>] seq_read+0xdd/0x12b0
fs/seq_file.c:178

but task is already holding lock:
(sb_writers#4){.+.+.+}, at: [<ffffffff81494bfa>] file_start_write
include/linux/fs.h:2541 [inline]
(sb_writers#4){.+.+.+}, at: [<ffffffff81494bfa>] do_sendfile+0x89a/0xb80
fs/read_write.c:1226

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

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

[<ffffffff8120301e>] lock_acquire+0x15e/0x450
kernel/locking/lockdep.c:3592
[<ffffffff82706e5b>] __mutex_lock_common kernel/locking/mutex.c:521
[inline]
[<ffffffff82706e5b>] mutex_lock_nested+0xbb/0x8d0
kernel/locking/mutex.c:621
[<ffffffff816c5334>] ext4_register_li_request+0x304/0x7a0
fs/ext4/super.c:2961
[<ffffffff816c6b38>] ext4_remount+0x1368/0x1bb0 fs/ext4/super.c:4911
[<ffffffff8149c1c8>] do_remount_sb2+0x428/0x7d0 fs/super.c:771
[<ffffffff814fc10e>] do_remount fs/namespace.c:2335 [inline]
[<ffffffff814fc10e>] do_mount+0x101e/0x2a10 fs/namespace.c:2848
[<ffffffff814fe651>] SYSC_mount fs/namespace.c:3051 [inline]
[<ffffffff814fe651>] SyS_mount+0x191/0x1c0 fs/namespace.c:3029
[<ffffffff827123e1>] entry_SYSCALL_64_fastpath+0x1e/0x9a

[<ffffffff8120301e>] lock_acquire+0x15e/0x450
kernel/locking/lockdep.c:3592
[<ffffffff82706e5b>] __mutex_lock_common kernel/locking/mutex.c:521
[inline]
[<ffffffff82706e5b>] mutex_lock_nested+0xbb/0x8d0
kernel/locking/mutex.c:621
[<ffffffff816c50b7>] ext4_register_li_request+0x87/0x7a0
fs/ext4/super.c:2934
[<ffffffff816c6b38>] ext4_remount+0x1368/0x1bb0 fs/ext4/super.c:4911
[<ffffffff8149c1c8>] do_remount_sb2+0x428/0x7d0 fs/super.c:771
[<ffffffff814fc10e>] do_remount fs/namespace.c:2335 [inline]
[<ffffffff814fc10e>] do_mount+0x101e/0x2a10 fs/namespace.c:2848
[<ffffffff814fe651>] SYSC_mount fs/namespace.c:3051 [inline]
[<ffffffff814fe651>] SyS_mount+0x191/0x1c0 fs/namespace.c:3029
[<ffffffff827123e1>] entry_SYSCALL_64_fastpath+0x1e/0x9a

[<ffffffff8120301e>] lock_acquire+0x15e/0x450
kernel/locking/lockdep.c:3592
[<ffffffff8270d3d2>] down_read+0x42/0x60 kernel/locking/rwsem.c:22
[<ffffffff8149b8e1>] iterate_supers+0xe1/0x260 fs/super.c:537
[<ffffffff819aa1b4>] selinux_complete_init+0x2f/0x31
security/selinux/hooks.c:6154
[<ffffffff8199be06>] security_load_policy+0x886/0x9b0
security/selinux/ss/services.c:2060
[<ffffffff81971d31>] sel_write_load+0x191/0xfc0
security/selinux/selinuxfs.c:535
[<ffffffff81490e8c>] __vfs_write+0x11c/0x3e0 fs/read_write.c:489
[<ffffffff81492b3e>] vfs_write+0x17e/0x4e0 fs/read_write.c:538
[<ffffffff81495179>] SYSC_write fs/read_write.c:585 [inline]
[<ffffffff81495179>] SyS_write+0xd9/0x1c0 fs/read_write.c:577
[<ffffffff827123e1>] entry_SYSCALL_64_fastpath+0x1e/0x9a

[<ffffffff8120301e>] lock_acquire+0x15e/0x450
kernel/locking/lockdep.c:3592
[<ffffffff82706e5b>] __mutex_lock_common kernel/locking/mutex.c:521
[inline]
[<ffffffff82706e5b>] mutex_lock_nested+0xbb/0x8d0
kernel/locking/mutex.c:621
[<ffffffff8196f817>] sel_commit_bools_write+0x87/0x250
security/selinux/selinuxfs.c:1142
[<ffffffff81490e8c>] __vfs_write+0x11c/0x3e0 fs/read_write.c:489
[<ffffffff8149125a>] __kernel_write+0x10a/0x350 fs/read_write.c:511
[<ffffffff8152c2cd>] write_pipe_buf+0x15d/0x1f0 fs/splice.c:1074
[<ffffffff8152d164>] splice_from_pipe_feed fs/splice.c:776 [inline]
[<ffffffff8152d164>] __splice_from_pipe+0x364/0x790 fs/splice.c:901
[<ffffffff81530229>] splice_from_pipe+0xf9/0x170 fs/splice.c:936
[<ffffffff8153032c>] default_file_splice_write+0x3c/0x80
fs/splice.c:1086
[<ffffffff815313f1>] do_splice_from fs/splice.c:1128 [inline]
[<ffffffff815313f1>] do_splice fs/splice.c:1404 [inline]
[<ffffffff815313f1>] SYSC_splice fs/splice.c:1707 [inline]
[<ffffffff815313f1>] SyS_splice+0xde1/0x1430 fs/splice.c:1690
[<ffffffff827123e1>] entry_SYSCALL_64_fastpath+0x1e/0x9a

[<ffffffff8120301e>] lock_acquire+0x15e/0x450
kernel/locking/lockdep.c:3592
[<ffffffff82706e5b>] __mutex_lock_common kernel/locking/mutex.c:521
[inline]
[<ffffffff82706e5b>] mutex_lock_nested+0xbb/0x8d0
kernel/locking/mutex.c:621
[<ffffffff814acc7c>] __pipe_lock fs/pipe.c:86 [inline]
[<ffffffff814acc7c>] fifo_open+0x15c/0x9e0 fs/pipe.c:896
[<ffffffff8148bc7d>] do_dentry_open+0x38d/0xbd0 fs/open.c:749
[<ffffffff8148f3ea>] vfs_open+0x12a/0x210 fs/open.c:862
[<ffffffff814befcc>] do_last fs/namei.c:3222 [inline]
[<ffffffff814befcc>] path_openat+0x50c/0x39a0 fs/namei.c:3359
[<ffffffff814c60f7>] do_filp_open+0x197/0x270 fs/namei.c:3393
[<ffffffff814a215f>] do_open_execat+0x10f/0x6f0 fs/exec.c:800
[<ffffffff814a7711>] do_execveat_common.isra.14+0x6a1/0x1f00
fs/exec.c:1573
[<ffffffff814a98e2>] do_execve fs/exec.c:1679 [inline]
[<ffffffff814a98e2>] SYSC_execve fs/exec.c:1760 [inline]
[<ffffffff814a98e2>] SyS_execve+0x42/0x50 fs/exec.c:1755
[<ffffffff827126f5>] return_from_execve+0x0/0x23

[<ffffffff8120301e>] lock_acquire+0x15e/0x450
kernel/locking/lockdep.c:3592
[<ffffffff8270800c>] __mutex_lock_common kernel/locking/mutex.c:521
[inline]
[<ffffffff8270800c>] mutex_lock_killable_nested+0xcc/0xa10
kernel/locking/mutex.c:641
[<ffffffff810cae41>] mm_access+0x51/0x140 kernel/fork.c:857
[<ffffffff815e2109>] proc_pid_auxv+0x29/0xd0 fs/proc/base.c:409
[<ffffffff815db26d>] proc_single_show+0xfd/0x170 fs/proc/base.c:805
[<ffffffff81500a93>] traverse+0x363/0x920 fs/seq_file.c:124
[<ffffffff81502115>] seq_read+0xd05/0x12b0 fs/seq_file.c:195
[<ffffffff814915e8>] do_loop_readv_writev+0x148/0x1e0
fs/read_write.c:680
[<ffffffff81493421>] do_readv_writev+0x581/0x6f0 fs/read_write.c:810
[<ffffffff81493608>] vfs_readv+0x78/0xb0 fs/read_write.c:834
[<ffffffff8152f7af>] kernel_readv fs/splice.c:586 [inline]
[<ffffffff8152f7af>] default_file_splice_read+0x50f/0x8f0
fs/splice.c:662
[<ffffffff8152b687>] do_splice_to+0xf7/0x140 fs/splice.c:1154
[<ffffffff8152b912>] splice_direct_to_actor+0x242/0x830
fs/splice.c:1226
[<ffffffff8152c0a3>] do_splice_direct+0x1a3/0x270 fs/splice.c:1337
[<ffffffff81494844>] do_sendfile+0x4e4/0xb80 fs/read_write.c:1227
[<ffffffff81496833>] SYSC_sendfile64 fs/read_write.c:1282 [inline]
[<ffffffff81496833>] SyS_sendfile64+0xc3/0x150 fs/read_write.c:1274
[<ffffffff827123e1>] entry_SYSCALL_64_fastpath+0x1e/0x9a

[<ffffffff811ff43c>] check_prev_add kernel/locking/lockdep.c:1853
[inline]
[<ffffffff811ff43c>] check_prevs_add kernel/locking/lockdep.c:1958
[inline]
[<ffffffff811ff43c>] validate_chain kernel/locking/lockdep.c:2144
[inline]
[<ffffffff811ff43c>] __lock_acquire+0x3e6c/0x5f10
kernel/locking/lockdep.c:3213
[<ffffffff8120301e>] lock_acquire+0x15e/0x450
kernel/locking/lockdep.c:3592
[<ffffffff82706e5b>] __mutex_lock_common kernel/locking/mutex.c:521
[inline]
[<ffffffff82706e5b>] mutex_lock_nested+0xbb/0x8d0
kernel/locking/mutex.c:621
[<ffffffff815014ed>] seq_read+0xdd/0x12b0 fs/seq_file.c:178
[<ffffffff815d889d>] proc_reg_read+0xfd/0x180 fs/proc/inode.c:202
[<ffffffff814915e8>] do_loop_readv_writev+0x148/0x1e0
fs/read_write.c:680
[<ffffffff81493421>] do_readv_writev+0x581/0x6f0 fs/read_write.c:810
[<ffffffff81493608>] vfs_readv+0x78/0xb0 fs/read_write.c:834
[<ffffffff8152f7af>] kernel_readv fs/splice.c:586 [inline]
[<ffffffff8152f7af>] default_file_splice_read+0x50f/0x8f0
fs/splice.c:662
[<ffffffff8152b687>] do_splice_to+0xf7/0x140 fs/splice.c:1154
[<ffffffff8152b912>] splice_direct_to_actor+0x242/0x830
fs/splice.c:1226
[<ffffffff8152c0a3>] do_splice_direct+0x1a3/0x270 fs/splice.c:1337
[<ffffffff81494844>] do_sendfile+0x4e4/0xb80 fs/read_write.c:1227
[<ffffffff81496833>] SYSC_sendfile64 fs/read_write.c:1282 [inline]
[<ffffffff81496833>] SyS_sendfile64+0xc3/0x150 fs/read_write.c:1274
[<ffffffff827123e1>] entry_SYSCALL_64_fastpath+0x1e/0x9a

other info that might help us debug this:

Chain exists of:
Possible unsafe locking scenario:

CPU0 CPU1
---- ----
lock(sb_writers#4);
lock(&eli->li_list_mtx);
lock(sb_writers#4);
lock(&p->lock);

*** DEADLOCK ***

1 lock held by syz-executor742/12963:
#0: (sb_writers#4){.+.+.+}, at: [<ffffffff81494bfa>] file_start_write
include/linux/fs.h:2541 [inline]
#0: (sb_writers#4){.+.+.+}, at: [<ffffffff81494bfa>]
do_sendfile+0x89a/0xb80 fs/read_write.c:1226

stack backtrace:
CPU: 1 PID: 12963 Comm: syz-executor742 Not tainted 4.4.163+ #122
0000000000000000 c3a07f746dcbb295 ffff8801d8a8ef78 ffffffff81aa556d
ffffffff83ac0550 ffffffff83ab4190 ffffffff83aaffc0 ffff8801d96508e8
ffff8801d9650000 ffff8801d8a8efc0 ffffffff813a8827 0000000000000001
Call Trace:
[<ffffffff81aa556d>] __dump_stack lib/dump_stack.c:15 [inline]
[<ffffffff81aa556d>] dump_stack+0xc1/0x124 lib/dump_stack.c:51
[<ffffffff813a8827>] print_circular_bug.cold.34+0x2f7/0x432
kernel/locking/lockdep.c:1226
[<ffffffff811ff43c>] check_prev_add kernel/locking/lockdep.c:1853 [inline]
[<ffffffff811ff43c>] check_prevs_add kernel/locking/lockdep.c:1958 [inline]
[<ffffffff811ff43c>] validate_chain kernel/locking/lockdep.c:2144 [inline]
[<ffffffff811ff43c>] __lock_acquire+0x3e6c/0x5f10
kernel/locking/lockdep.c:3213
[<ffffffff8120301e>] lock_acquire+0x15e/0x450 kernel/locking/lockdep.c:3592
[<ffffffff82706e5b>] __mutex_lock_common kernel/locking/mutex.c:521
[inline]
[<ffffffff82706e5b>] mutex_lock_nested+0xbb/0x8d0
kernel/locking/mutex.c:621
[<ffffffff815014ed>] seq_read+0xdd/0x12b0 fs/seq_file.c:178
[<ffffffff815d889d>] proc_reg_read+0xfd/0x180 fs/proc/inode.c:202
[<ffffffff814915e8>] do_loop_readv_writev+0x148/0x1e0 fs/read_write.c:680
[<ffffffff81493421>] do_readv_writev+0x581/0x6f0 fs/read_write.c:810
[<ffffffff81493608>] vfs_readv+0x78/0xb0 fs/read_write.c:834
[<ffffffff8152f7af>] kernel_readv fs/splice.c:586 [inline]
[<ffffffff8152f7af>] default_file_splice_read+0x50f/0x8f0 fs/splice.c:662
[<ffffffff8152b687>] do_splice_to+0xf7/0x140 fs/splice.c:1154
[<ffffffff8152b912>] splice_direct_to_actor+0x242/0x830 fs/splice.c:1226
[<ffffffff8152c0a3>] do_splice_direct+0x1a3/0x270 fs/splice.c:1337
[<ffffffff81494844>] do_sendfile+0x4e4/0xb80 fs/read_write.c:1227
[<ffffffff81496833>] SYSC_sendfile64 fs/read_write.c:1282 [inline]
[<ffffffff81496833>] SyS_sendfile64+0xc3/0x150 fs/read_write.c:1274
[<ffffffff827123e1>] entry_SYSCALL_64_fastpath+0x1e/0x9a

syzbot

unread,
Apr 11, 2019, 8:00:32 PM4/11/19
to syzkaller-a...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: 8fe42840 Merge 4.9.141 into android-4.9
git tree: android-4.9
console output: https://syzkaller.appspot.com/x/log.txt?x=126c4c2f200000
kernel config: https://syzkaller.appspot.com/x/.config?x=22a5ba9f73b6da1d
dashboard link: https://syzkaller.appspot.com/bug?extid=8cb007c5997af8c27781
compiler: gcc (GCC) 8.0.1 20180413 (experimental)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=15532b3b200000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=115e73df200000

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+8cb007...@syzkaller.appspotmail.com

======================================================
[ INFO: possible circular locking dependency detected ]
4.9.141+ #1 Not tainted
-------------------------------------------------------
syz-executor246/2065 is trying to acquire lock:
(&p->lock){+.+.+.}, at: [<ffffffff8158080d>] seq_read+0xdd/0x12d0
fs/seq_file.c:178
but task is already holding lock:
(&pipe->mutex/1){+.+.+.}, at: [<ffffffff81523c1e>] pipe_lock_nested
fs/pipe.c:66 [inline]
(&pipe->mutex/1){+.+.+.}, at: [<ffffffff81523c1e>] pipe_lock+0x5e/0x70
fs/pipe.c:74
which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

lock_acquire+0x130/0x3e0 kernel/locking/lockdep.c:3756
__mutex_lock_common kernel/locking/mutex.c:521 [inline]
mutex_lock_nested+0xc0/0x900 kernel/locking/mutex.c:621
__pipe_lock fs/pipe.c:87 [inline]
fifo_open+0x15c/0x9e0 fs/pipe.c:921
do_dentry_open+0x3ef/0xc90 fs/open.c:766
vfs_open+0x11c/0x210 fs/open.c:879
do_last fs/namei.c:3410 [inline]
path_openat+0x542/0x2790 fs/namei.c:3534
do_filp_open+0x197/0x270 fs/namei.c:3568
do_open_execat+0x10f/0x640 fs/exec.c:844
do_execveat_common.isra.14+0x687/0x1ed0 fs/exec.c:1723
do_execve fs/exec.c:1829 [inline]
SYSC_execve fs/exec.c:1910 [inline]
SyS_execve+0x42/0x50 fs/exec.c:1905
do_syscall_64+0x19f/0x550 arch/x86/entry/common.c:285
entry_SYSCALL_64_after_swapgs+0x5d/0xdb

lock_acquire+0x130/0x3e0 kernel/locking/lockdep.c:3756
__mutex_lock_common kernel/locking/mutex.c:521 [inline]
mutex_lock_killable_nested+0xcc/0x9f0 kernel/locking/mutex.c:641
lock_trace+0x44/0xc0 fs/proc/base.c:431
proc_pid_syscall+0xa9/0x260 fs/proc/base.c:663
proc_single_show+0xfd/0x170 fs/proc/base.c:785
seq_read+0x4b6/0x12d0 fs/seq_file.c:240
do_loop_readv_writev.part.1+0xd5/0x280 fs/read_write.c:718
do_loop_readv_writev fs/read_write.c:707 [inline]
do_readv_writev+0x56e/0x7b0 fs/read_write.c:873
vfs_readv+0x84/0xc0 fs/read_write.c:897
kernel_readv fs/splice.c:363 [inline]
default_file_splice_read+0x451/0x7f0 fs/splice.c:435
do_splice_to+0x10c/0x170 fs/splice.c:899
splice_direct_to_actor+0x23f/0x7e0 fs/splice.c:971
do_splice_direct+0x1a3/0x270 fs/splice.c:1080
do_sendfile+0x4f0/0xc30 fs/read_write.c:1393
SYSC_sendfile64 fs/read_write.c:1454 [inline]
SyS_sendfile64+0x144/0x160 fs/read_write.c:1440
do_syscall_64+0x19f/0x550 arch/x86/entry/common.c:285
entry_SYSCALL_64_after_swapgs+0x5d/0xdb

check_prev_add kernel/locking/lockdep.c:1828 [inline]
check_prevs_add kernel/locking/lockdep.c:1938 [inline]
validate_chain kernel/locking/lockdep.c:2265 [inline]
__lock_acquire+0x3189/0x4a10 kernel/locking/lockdep.c:3345
lock_acquire+0x130/0x3e0 kernel/locking/lockdep.c:3756
__mutex_lock_common kernel/locking/mutex.c:521 [inline]
mutex_lock_nested+0xc0/0x900 kernel/locking/mutex.c:621
seq_read+0xdd/0x12d0 fs/seq_file.c:178
proc_reg_read+0xfd/0x180 fs/proc/inode.c:203
do_loop_readv_writev.part.1+0xd5/0x280 fs/read_write.c:718
do_loop_readv_writev fs/read_write.c:707 [inline]
do_readv_writev+0x56e/0x7b0 fs/read_write.c:873
vfs_readv+0x84/0xc0 fs/read_write.c:897
kernel_readv fs/splice.c:363 [inline]
default_file_splice_read+0x451/0x7f0 fs/splice.c:435
do_splice_to+0x10c/0x170 fs/splice.c:899
do_splice fs/splice.c:1192 [inline]
SYSC_splice fs/splice.c:1416 [inline]
SyS_splice+0x10d2/0x14d0 fs/splice.c:1399
do_syscall_64+0x19f/0x550 arch/x86/entry/common.c:285
entry_SYSCALL_64_after_swapgs+0x5d/0xdb

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(&p->lock);

*** DEADLOCK ***

1 lock held by syz-executor246/2065:
#0: (&pipe->mutex/1){+.+.+.}, at: [<ffffffff81523c1e>] pipe_lock_nested
fs/pipe.c:66 [inline]
#0: (&pipe->mutex/1){+.+.+.}, at: [<ffffffff81523c1e>]
pipe_lock+0x5e/0x70 fs/pipe.c:74

stack backtrace:
CPU: 1 PID: 2065 Comm: syz-executor246 Not tainted 4.9.141+ #1
ffff8801ce997278 ffffffff81b42e79 ffffffff83ca2c70 ffffffff83ca9f30
ffffffff83ca4920 ffff8801d27c5010 ffff8801d27c4740 ffff8801ce9972c0
ffffffff813fee40 0000000000000001 00000000d27c4ff0 0000000000000001
Call Trace:
[<ffffffff81b42e79>] __dump_stack lib/dump_stack.c:15 [inline]
[<ffffffff81b42e79>] dump_stack+0xc1/0x128 lib/dump_stack.c:51
[<ffffffff813fee40>] print_circular_bug.cold.36+0x2f7/0x432
kernel/locking/lockdep.c:1202
[<ffffffff8120a539>] check_prev_add kernel/locking/lockdep.c:1828 [inline]
[<ffffffff8120a539>] check_prevs_add kernel/locking/lockdep.c:1938 [inline]
[<ffffffff8120a539>] validate_chain kernel/locking/lockdep.c:2265 [inline]
[<ffffffff8120a539>] __lock_acquire+0x3189/0x4a10
kernel/locking/lockdep.c:3345
[<ffffffff8120c8d0>] lock_acquire+0x130/0x3e0 kernel/locking/lockdep.c:3756
[<ffffffff8280b250>] __mutex_lock_common kernel/locking/mutex.c:521
[inline]
[<ffffffff8280b250>] mutex_lock_nested+0xc0/0x900
kernel/locking/mutex.c:621
[<ffffffff8158080d>] seq_read+0xdd/0x12d0 fs/seq_file.c:178
[<ffffffff8165c00d>] proc_reg_read+0xfd/0x180 fs/proc/inode.c:203
[<ffffffff81509df5>] do_loop_readv_writev.part.1+0xd5/0x280
fs/read_write.c:718
[<ffffffff8150b49e>] do_loop_readv_writev fs/read_write.c:707 [inline]
[<ffffffff8150b49e>] do_readv_writev+0x56e/0x7b0 fs/read_write.c:873
[<ffffffff8150b764>] vfs_readv+0x84/0xc0 fs/read_write.c:897
[<ffffffff815ac2a1>] kernel_readv fs/splice.c:363 [inline]
[<ffffffff815ac2a1>] default_file_splice_read+0x451/0x7f0 fs/splice.c:435
[<ffffffff815ab39c>] do_splice_to+0x10c/0x170 fs/splice.c:899
[<ffffffff815b08f2>] do_splice fs/splice.c:1192 [inline]
[<ffffffff815b08f2>] SYSC_splice fs/splice.c:1416 [inline]
[<ffffffff815b08f2>] SyS_splice+0x10d2/0x14d0 fs/splice.c:1399
[<ffffffff810056ef>] do_syscall_64+0x19f/0x550 arch/x86/entry/common.c:285
[<ffffffff82817893>] entry_SYSCALL_64_after_swapgs+0x5d/0xdb

syzbot

unread,
Apr 14, 2019, 6:13:21 PM4/14/19
to Tetsuo Handa, penguin...@i-love.sakura.ne.jp, syzkaller-a...@googlegroups.com
> Backported to 4.9.167 as commit 7d7637dafc595952.

> #syz fix: fs/open.c: allow opening only regular files during execve()

Your '3' command is accepted, but please keep
syzkaller-a...@googlegroups.com mailing list in CC next time. It
serves as a history of what happened with each bug report. Thank you.

Reply all
Reply to author
Forward
0 new messages