syzbot


INFO: task hung in tty_set_termios

Status: fixed on 2018/07/09 18:05
Subsystems: serial
[Documentation on labels]
Reported-by: syzbot+adcaec3db47dacacf451@syzkaller.appspotmail.com
Fix commit: ebec3f8f5271 n_tty: Access echo_* variables carefully.
First crash: 2270d, last: 2270d
Similar bugs (5)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.19 INFO: task hung in tty_set_termios (2) 3 739d 849d 0/1 auto-obsoleted due to no activity on 2022/10/05 22:41
upstream INFO: task hung in tty_set_termios (3) serial 1 161d 161d 0/27 auto-obsoleted due to no activity on 2024/04/06 00:03
android-49 INFO: task hung in tty_set_termios 1 2183d 2183d 0/3 auto-closed as invalid on 2019/02/22 14:59
linux-4.19 INFO: task hung in tty_set_termios 1 1305d 1305d 0/1 auto-closed as invalid on 2021/03/18 18:50
upstream INFO: task hung in tty_set_termios (2) serial 2 994d 1032d 0/27 auto-closed as invalid on 2021/12/25 14:45

Sample crash report:
INFO: task syz-executor0:14547 blocked for more than 120 seconds.
      Not tainted 4.16.0-rc7+ #6
"echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
syz-executor0   D24696 14547   4431 0x00000004
Call Trace:
 context_switch kernel/sched/core.c:2862 [inline]
 __schedule+0x8fb/0x1ec0 kernel/sched/core.c:3440
 schedule+0xf5/0x430 kernel/sched/core.c:3499
 __rwsem_down_write_failed_common+0x7c0/0x1540 kernel/locking/rwsem-xadd.c:566
 rwsem_down_write_failed+0xe/0x10 kernel/locking/rwsem-xadd.c:595
 call_rwsem_down_write_failed+0x17/0x30 arch/x86/lib/rwsem.S:117
 __down_write arch/x86/include/asm/rwsem.h:142 [inline]
 down_write+0xa2/0x120 kernel/locking/rwsem.c:72
 tty_set_termios+0xe5/0xa60 drivers/tty/tty_ioctl.c:328
 set_termios+0x392/0x6d0 drivers/tty/tty_ioctl.c:414
 tty_mode_ioctl+0x9fc/0xb30 drivers/tty/tty_ioctl.c:749
 n_tty_ioctl_helper+0x40/0x360 drivers/tty/tty_ioctl.c:940
 n_tty_ioctl+0x14d/0x2d0 drivers/tty/n_tty.c:2441
 tty_ioctl+0x336/0x1610 drivers/tty/tty_io.c:2655
 vfs_ioctl fs/ioctl.c:46 [inline]
 do_vfs_ioctl+0x1b1/0x1520 fs/ioctl.c:686
 SYSC_ioctl fs/ioctl.c:701 [inline]
 SyS_ioctl+0x8f/0xc0 fs/ioctl.c:692
 do_syscall_64+0x281/0x940 arch/x86/entry/common.c:287
 entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x4548b9
RSP: 002b:00007f537ed6cc68 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007f537ed6d6d4 RCX: 00000000004548b9
RDX: 0000000020000140 RSI: 0000000000005402 RDI: 0000000000000015
RBP: 000000000072bf58 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000ffffffff
R13: 00000000000002f9 R14: 00000000006f67f8 R15: 0000000000000001

Showing all locks held in the system:
2 locks held by khungtaskd/868:
 #0:  (rcu_read_lock){....}, at: [<00000000b945f5c3>] check_hung_uninterruptible_tasks kernel/hung_task.c:175 [inline]
 #0:  (rcu_read_lock){....}, at: [<00000000b945f5c3>] watchdog+0x1c5/0xd60 kernel/hung_task.c:249
 #1:  (tasklist_lock){.+.+}, at: [<000000004f3eb2e0>] debug_show_all_locks+0xd3/0x3d0 kernel/locking/lockdep.c:4470
2 locks held by getty/4358:
 #0:  (&tty->ldisc_sem){++++}, at: [<00000000ffde600d>] ldsem_down_read+0x37/0x40 drivers/tty/tty_ldsem.c:365
 #1:  (&ldata->atomic_read_lock){+.+.}, at: [<000000002718afc6>] n_tty_read+0x2ef/0x1a40 drivers/tty/n_tty.c:2131
2 locks held by getty/4359:
 #0:  (&tty->ldisc_sem){++++}, at: [<00000000ffde600d>] ldsem_down_read+0x37/0x40 drivers/tty/tty_ldsem.c:365
 #1:  (&ldata->atomic_read_lock){+.+.}, at: [<000000002718afc6>] n_tty_read+0x2ef/0x1a40 drivers/tty/n_tty.c:2131
2 locks held by getty/4360:
 #0:  (&tty->ldisc_sem){++++}, at: [<00000000ffde600d>] ldsem_down_read+0x37/0x40 drivers/tty/tty_ldsem.c:365
 #1:  (&ldata->atomic_read_lock){+.+.}, at: [<000000002718afc6>] n_tty_read+0x2ef/0x1a40 drivers/tty/n_tty.c:2131
2 locks held by getty/4361:
 #0:  (&tty->ldisc_sem){++++}, at: [<00000000ffde600d>] ldsem_down_read+0x37/0x40 drivers/tty/tty_ldsem.c:365
 #1:  (&ldata->atomic_read_lock){+.+.}, at: [<000000002718afc6>] n_tty_read+0x2ef/0x1a40 drivers/tty/n_tty.c:2131
2 locks held by getty/4362:
 #0:  (&tty->ldisc_sem){++++}, at: [<00000000ffde600d>] ldsem_down_read+0x37/0x40 drivers/tty/tty_ldsem.c:365
 #1:  (&ldata->atomic_read_lock){+.+.}, at: [<000000002718afc6>] n_tty_read+0x2ef/0x1a40 drivers/tty/n_tty.c:2131
2 locks held by getty/4363:
 #0:  (&tty->ldisc_sem){++++}, at: [<00000000ffde600d>] ldsem_down_read+0x37/0x40 drivers/tty/tty_ldsem.c:365
 #1:  (&ldata->atomic_read_lock){+.+.}, at: [<000000002718afc6>] n_tty_read+0x2ef/0x1a40 drivers/tty/n_tty.c:2131
2 locks held by getty/4364:
 #0:  (&tty->ldisc_sem){++++}, at: [<00000000ffde600d>] ldsem_down_read+0x37/0x40 drivers/tty/tty_ldsem.c:365
 #1:  (&ldata->atomic_read_lock){+.+.}, at: [<000000002718afc6>] n_tty_read+0x2ef/0x1a40 drivers/tty/n_tty.c:2131
2 locks held by syz-executor0/14547:
 #0:  (&tty->ldisc_sem){++++}, at: [<00000000ffde600d>] ldsem_down_read+0x37/0x40 drivers/tty/tty_ldsem.c:365
 #1:  (&o_tty->termios_rwsem/1){++++}, at: [<000000008247af10>] tty_set_termios+0xe5/0xa60 drivers/tty/tty_ioctl.c:328
1 lock held by syz-executor1/14545:
 #0:  (event_mutex){+.+.}, at: [<000000009aaa04ba>] perf_trace_destroy+0x28/0x100 kernel/trace/trace_event_perf.c:234
3 locks held by syz-executor6/14579:
 #0:  (&sig->cred_guard_mutex){+.+.}, at: [<000000004a34bd2f>] SYSC_perf_event_open+0x12ca/0x2e00 kernel/events/core.c:9990
 #1:  (&pmus_srcu){....}, at: [<0000000054b313f9>] perf_event_alloc+0xf55/0x2b00 kernel/events/core.c:9551
 #2:  (event_mutex){+.+.}, at: [<0000000088baf472>] perf_trace_init+0x58/0xab0 kernel/trace/trace_event_perf.c:216
1 lock held by syz-executor5/14549:
 #0:  (&type->s_umount_key#28){++++}, at: [<0000000015cce8cc>] SYSC_syncfs fs/sync.c:165 [inline]
 #0:  (&type->s_umount_key#28){++++}, at: [<0000000015cce8cc>] SyS_syncfs+0x86/0xe0 fs/sync.c:155
1 lock held by syz-executor5/14552:
 #0:  (&type->s_umount_key#28){++++}, at: [<000000003f27d1e3>] iterate_supers+0xe1/0x250 fs/super.c:596
1 lock held by syz-executor5/14563:
 #0:  (&type->s_umount_key#28){++++}, at: [<0000000015cce8cc>] SYSC_syncfs fs/sync.c:165 [inline]
 #0:  (&type->s_umount_key#28){++++}, at: [<0000000015cce8cc>] SyS_syncfs+0x86/0xe0 fs/sync.c:155
1 lock held by syz-executor5/14564:
 #0:  (&type->s_umount_key#28){++++}, at: [<00000000a3899c5a>] thaw_super+0x2c/0x260 fs/super.c:1499
3 locks held by syz-executor4/14559:
 #0:  (&sig->cred_guard_mutex){+.+.}, at: [<000000004a34bd2f>] SYSC_perf_event_open+0x12ca/0x2e00 kernel/events/core.c:9990
 #1:  (&pmus_srcu){....}, at: [<0000000054b313f9>] perf_event_alloc+0xf55/0x2b00 kernel/events/core.c:9551
 #2:  (event_mutex){+.+.}, at: [<0000000088baf472>] perf_trace_init+0x58/0xab0 kernel/trace/trace_event_perf.c:216
1 lock held by syz-executor2/14562:
 #0:  (lock#6){+.+.}, at: [<00000000c6fcc0be>] lru_add_drain_all+0xb2/0x540 mm/swap.c:683
1 lock held by syz-executor7/14582:
 #0:  (&vcpu->mutex){+.+.}, at: [<00000000b1f9d6b0>] kvm_vcpu_ioctl+0x1d1/0xff0 arch/x86/kvm/../../../virt/kvm/kvm_main.c:2542

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

NMI backtrace for cpu 1
CPU: 1 PID: 868 Comm: khungtaskd Not tainted 4.16.0-rc7+ #6
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0x194/0x24d lib/dump_stack.c:53
 nmi_cpu_backtrace+0x1d2/0x210 lib/nmi_backtrace.c:103
 nmi_trigger_cpumask_backtrace+0x123/0x180 lib/nmi_backtrace.c:62
 arch_trigger_cpumask_backtrace+0x14/0x20 arch/x86/kernel/apic/hw_nmi.c:38
 trigger_all_cpu_backtrace include/linux/nmi.h:138 [inline]
 check_hung_task kernel/hung_task.c:132 [inline]
 check_hung_uninterruptible_tasks kernel/hung_task.c:190 [inline]
 watchdog+0x90c/0xd60 kernel/hung_task.c:249
 kthread+0x33c/0x400 kernel/kthread.c:238
 ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:406
Sending NMI from CPU 1 to CPUs 0:
NMI backtrace for cpu 0
CPU: 0 PID: 5 Comm: kworker/u4:0 Not tainted 4.16.0-rc7+ #6
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: events_unbound flush_to_ldisc
RIP: 0010:__sanitizer_cov_trace_pc+0xd/0x50 kernel/kcov.c:94
RSP: 0018:ffff8801d9acf068 EFLAGS: 00000217
RAX: ffff8801d9abc140 RBX: ffffc90004f3c000 RCX: ffffffff82f384b2
RDX: 0000000000000004 RSI: 1ffff1003b357954 RDI: ffffc90004f3d4b4
RBP: ffff8801d9acf068 R08: 1ffff1003b359db5 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: 00000005e23f7253
R13: dffffc0000000000 R14: 0000000000000254 R15: 0000000000001a37
FS:  0000000000000000(0000) GS:ffff8801db200000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f537ed2adb8 CR3: 0000000007a22004 CR4: 00000000001626f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 __process_echoes+0x648/0x770 drivers/tty/n_tty.c:736
 commit_echoes+0x147/0x1b0 drivers/tty/n_tty.c:764
 n_tty_receive_char_fast drivers/tty/n_tty.c:1416 [inline]
 n_tty_receive_buf_fast drivers/tty/n_tty.c:1576 [inline]
 __receive_buf drivers/tty/n_tty.c:1611 [inline]
 n_tty_receive_buf_common+0x1156/0x2520 drivers/tty/n_tty.c:1709
 n_tty_receive_buf2+0x33/0x40 drivers/tty/n_tty.c:1744
 tty_ldisc_receive_buf+0xa7/0x180 drivers/tty/tty_buffer.c:456
 tty_port_default_receive_buf+0x106/0x160 drivers/tty/tty_port.c:38
 receive_buf drivers/tty/tty_buffer.c:475 [inline]
 flush_to_ldisc+0x3c4/0x590 drivers/tty/tty_buffer.c:524
 process_one_work+0xc47/0x1bb0 kernel/workqueue.c:2113
 worker_thread+0x223/0x1990 kernel/workqueue.c:2247
 kthread+0x33c/0x400 kernel/kthread.c:238
 ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:406
Code: ff 48 8b bd d0 fe ff ff e8 61 47 38 00 e9 c3 fc ff ff 90 90 90 90 90 90 90 90 90 90 90 90 55 65 48 8b 04 25 c0 ed 01 00 48 89 e5 <65> 8b 15 1c 24 90 7e 81 e2 00 01 1f 00 48 8b 4d 08 75 2b 8b 90 

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2018/03/30 11:21 upstream c2a9838452a4 d47f0ed6 .config console log report ci-upstream-kasan-gce-root
* Struck through repros no longer work on HEAD.