syzbot


INFO: task hung in n_tty_flush_buffer

Status: public: reported C repro on 2019/04/14 00:00
Reported-by: syzbot+209e8061ce237297fd9a@syzkaller.appspotmail.com
First crash: 2403d, last: 2334d
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream INFO: task hung in n_tty_flush_buffer serial 6 2335d 2409d 8/28 fixed on 2018/07/09 18:05
linux-4.14 INFO: task hung in n_tty_flush_buffer 1 1660d 1660d 0/1 auto-closed as invalid on 2020/09/03 14:06

Sample crash report:
random: crng init done
INFO: task syz-executor468:4187 blocked for more than 120 seconds.
      Not tainted 4.9.96-g71fce1e #10
"echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
syz-executor468 D28920  4187   3860 0x00000002
 ffff8801b5b26000 ffff8801b5611a40 ffff8801da0f2f40 ffff8801b8344800
 ffff8801db321b98 ffff8801d7787568 ffffffff839e240d ffffffff81233817
 0000000000000000 ffff8801b5b268c0 0000000600000007 ffff8801db322468
Call Trace:
 [<ffffffff839e3a0f>] schedule+0x7f/0x1b0 kernel/sched/core.c:3557
 [<ffffffff839ef048>] __rwsem_down_write_failed_common kernel/locking/rwsem-xadd.c:526 [inline]
 [<ffffffff839ef048>] rwsem_down_write_failed+0x598/0x990 kernel/locking/rwsem-xadd.c:555
 [<ffffffff81ee4e77>] call_rwsem_down_write_failed+0x17/0x30 arch/x86/lib/rwsem.S:105
 [<ffffffff839ece1c>] __down_write arch/x86/include/asm/rwsem.h:125 [inline]
 [<ffffffff839ece1c>] down_write+0x5c/0xa0 kernel/locking/rwsem.c:54
 [<ffffffff8211a4e1>] n_tty_flush_buffer+0x21/0x310 drivers/tty/n_tty.c:359
 [<ffffffff821286b9>] tty_ldisc_hangup+0x89/0x5b0 drivers/tty/tty_ldisc.c:659
 [<ffffffff8210fb37>] __tty_hangup.part.22+0x5f7/0xb00 drivers/tty/tty_io.c:744
 [<ffffffff82110061>] __tty_hangup drivers/tty/tty_io.c:694 [inline]
 [<ffffffff82110061>] tty_vhangup+0x21/0x30 drivers/tty/tty_io.c:817
 [<ffffffff8212ff34>] pty_close+0x374/0x4d0 drivers/tty/pty.c:74
 [<ffffffff82111c70>] tty_release+0x370/0xd00 drivers/tty/tty_io.c:1813
 [<ffffffff81575b13>] __fput+0x263/0x700 fs/file_table.c:208
 [<ffffffff81576035>] ____fput+0x15/0x20 fs/file_table.c:244
 [<ffffffff8119603c>] task_work_run+0x10c/0x180 kernel/task_work.c:116
 [<ffffffff8113ec91>] exit_task_work include/linux/task_work.h:21 [inline]
 [<ffffffff8113ec91>] do_exit+0x9e1/0x27c0 kernel/exit.c:837
 [<ffffffff81144d91>] do_group_exit+0x111/0x340 kernel/exit.c:941
 [<ffffffff81167b8f>] get_signal+0x4cf/0x1450 kernel/signal.c:2317
 [<ffffffff810524d7>] do_signal+0x87/0x19f0 arch/x86/kernel/signal.c:807
 [<ffffffff81005581>] exit_to_usermode_loop+0xe1/0x120 arch/x86/entry/common.c:157
 [<ffffffff810064d4>] prepare_exit_to_usermode arch/x86/entry/common.c:191 [inline]
 [<ffffffff810064d4>] syscall_return_slowpath arch/x86/entry/common.c:260 [inline]
 [<ffffffff810064d4>] do_syscall_64+0x364/0x490 arch/x86/entry/common.c:287
 [<ffffffff839f3313>] entry_SYSCALL_64_after_swapgs+0x5d/0xdb

Showing all locks held in the system:
2 locks held by khungtaskd/518:
 #0:  (rcu_read_lock){......}, at: [<ffffffff813646ec>] check_hung_uninterruptible_tasks kernel/hung_task.c:168 [inline]
 #0:  (rcu_read_lock){......}, at: [<ffffffff813646ec>] watchdog+0x11c/0xa20 kernel/hung_task.c:239
 #1:  (tasklist_lock){.+.+..}, at: [<ffffffff81423ce0>] debug_show_all_locks+0x79/0x218 kernel/locking/lockdep.c:4336
2 locks held by getty/3778:
 #0:  (&tty->ldisc_sem){++++++}, at: [<ffffffff839f14b2>] ldsem_down_read+0x32/0x40 drivers/tty/tty_ldsem.c:367
 #1:  (&ldata->atomic_read_lock){+.+...}, at: [<ffffffff8211c792>] n_tty_read+0x202/0x16e0 drivers/tty/n_tty.c:2133
4 locks held by syz-executor468/4187:
 #0:  (&tty->legacy_mutex){+.+.+.}, at: [<ffffffff8212d0fa>] tty_lock+0x6a/0xd0 drivers/tty/tty_mutex.c:18
 #1:  (&tty->legacy_mutex/1){+.+...}, at: [<ffffffff8212d0fa>] tty_lock+0x6a/0xd0 drivers/tty/tty_mutex.c:18
 #2:  (&tty->ldisc_sem){++++++}, at: [<ffffffff82127940>] tty_ldisc_ref+0x20/0x80 drivers/tty/tty_ldisc.c:297
 #3:  (&o_tty->termios_rwsem/1){++++..}, at: [<ffffffff8211a4e1>] n_tty_flush_buffer+0x21/0x310 drivers/tty/n_tty.c:359

=============================================

NMI backtrace for cpu 0
CPU: 0 PID: 518 Comm: khungtaskd Not tainted 4.9.96-g71fce1e #10
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
 ffff8801d85f7d08 ffffffff81eb0b69 0000000000000000 0000000000000000
 0000000000000000 0000000000000001 ffffffff810b7d60 ffff8801d85f7d40
 ffffffff81ebbe97 0000000000000000 0000000000000000 0000000000000003
Call Trace:
 [<ffffffff81eb0b69>] __dump_stack lib/dump_stack.c:15 [inline]
 [<ffffffff81eb0b69>] dump_stack+0xc1/0x128 lib/dump_stack.c:51
 [<ffffffff81ebbe97>] nmi_cpu_backtrace.cold.2+0x48/0x87 lib/nmi_backtrace.c:99
 [<ffffffff81ebbe2a>] nmi_trigger_cpumask_backtrace+0x12a/0x14f lib/nmi_backtrace.c:60
 [<ffffffff810b7e64>] arch_trigger_cpumask_backtrace+0x14/0x20 arch/x86/kernel/apic/hw_nmi.c:37
 [<ffffffff81364c84>] trigger_all_cpu_backtrace include/linux/nmi.h:58 [inline]
 [<ffffffff81364c84>] check_hung_task kernel/hung_task.c:125 [inline]
 [<ffffffff81364c84>] check_hung_uninterruptible_tasks kernel/hung_task.c:182 [inline]
 [<ffffffff81364c84>] watchdog+0x6b4/0xa20 kernel/hung_task.c:239
 [<ffffffff8119ad5d>] kthread+0x26d/0x300 kernel/kthread.c:211
 [<ffffffff839f34dc>] ret_from_fork+0x5c/0x70 arch/x86/entry/entry_64.S:373
Sending NMI from CPU 0 to CPUs 1:
NMI backtrace for cpu 1
CPU: 1 PID: 45 Comm: kworker/u4:2 Not tainted 4.9.96-g71fce1e #10
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: events_unbound flush_to_ldiscc
task: ffff8801d9580000 task.stack: ffff8801d9588000
RIP: 0010:[<ffffffff8135ca1e>] c [<ffffffff8135ca1e>] __sanitizer_cov_trace_pc+0x1e/0x50 kernel/kcov.c:96
RSP: 0018:ffff8801d958f9c8  EFLAGS: 00000246
RAX: ffff8801d9580000 RBX: ffffc900016b4000 RCX: 0000000000000000
RDX: 0000000000000000 RSI: ffffffff821186be RDI: ffffc900016b5b31
RBP: ffff8801d958f9c8 R08: ffff8801d95809b0 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: 00000009cb6888d0
R13: 0000000000003b54 R14: dffffc0000000000 R15: 00000000000008d1
FS:  0000000000000000(0000) GS:ffff8801db300000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f908de7c000 CR3: 00000001cdf01000 CR4: 00000000001606f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Stack:
 ffff8801d958fa40c ffffffff821186bec 0000000000000206c ffff8801d958f9f8c
 ffffc900016b6278c ffffed003af56e45c ffff8801d7ab722cc ffffc900016b4020c
 00000001000008ffc ffff8801d7ab6e80c ffffc900016b6300c ffffc900016b4000c
Call Trace:
 [<ffffffff821186be>] __process_echoes+0x64e/0x780 drivers/tty/n_tty.c:738
 [<ffffffff82122074>] flush_echoes drivers/tty/n_tty.c:801 [inline]
 [<ffffffff82122074>] __receive_buf drivers/tty/n_tty.c:1617 [inline]
 [<ffffffff82122074>] n_tty_receive_buf_common+0xd34/0x2300 drivers/tty/n_tty.c:1711
 [<ffffffff82123673>] n_tty_receive_buf2+0x33/0x40 drivers/tty/n_tty.c:1746
 [<ffffffff8212917f>] tty_ldisc_receive_buf+0xaf/0x190 drivers/tty/tty_buffer.c:455
 [<ffffffff8212a183>] receive_buf drivers/tty/tty_buffer.c:474 [inline]
 [<ffffffff8212a183>] flush_to_ldisc+0x253/0x370 drivers/tty/tty_buffer.c:533
 [<ffffffff8118ae31>] process_one_work+0x7e1/0x1500 kernel/workqueue.c:2092
 [<ffffffff8118bc26>] worker_thread+0xd6/0x10a0 kernel/workqueue.c:2226
 [<ffffffff8119ad5d>] kthread+0x26d/0x300 kernel/kthread.c:211
 [<ffffffff839f34dc>] ret_from_fork+0x5c/0x70 arch/x86/entry/entry_64.S:373
Code: c66 c2e c0f c1f c84 c00 c00 c00 c00 c00 c0f c1f c00 c55 c48 c89 ce5 c65 c48 c8b c04 c25 c40 c7d c01 c00 c65 c8b c15 cbc cb2 ccb c7e c81 ce2 c00 c01 c1f c00 c48 c8b c75 c08 c<75> c2b c8b c90 c80 c12 c00 c00 c83 cfa c02 c75 c20 c48 c8b c88 c88 c12 c00 c00 c8b c

Crashes (6):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2018/04/29 01:29 https://android.googlesource.com/kernel/common android-4.9 71fce1edd26d d5a5d045 .config console log report syz C ci-android-49-kasan-gce-root
2018/07/02 03:42 https://android.googlesource.com/kernel/common android-4.9 00a0bcbfcfb6 dba0b50e .config console log report ci-android-49-kasan-gce-root
2018/06/28 13:47 https://android.googlesource.com/kernel/common android-4.9 00a0bcbfcfb6 dba0b50e .config console log report ci-android-49-kasan-gce-root
2018/06/13 03:17 https://android.googlesource.com/kernel/common android-4.9 db2c520bb56b 6dcbc435 .config console log report ci-android-49-kasan-gce-root
2018/05/18 11:33 https://android.googlesource.com/kernel/common android-4.9 73fdfa38c59d c992b767 .config console log report ci-android-49-kasan-gce-root
2018/04/24 14:16 https://android.googlesource.com/kernel/common android-4.9 320d53a9d07c 2bf86f40 .config console log report ci-android-49-kasan-gce-root
* Struck through repros no longer work on HEAD.