syzbot


KCSAN: data-race in n_tty_flush_buffer / n_tty_lookahead_flow_ctrl (7)

Status: moderation: reported on 2025/07/11 11:41
Subsystems: serial
[Documentation on labels]
Reported-by: syzbot+c6af600dec0bf367b910@syzkaller.appspotmail.com
First crash: 6d08h, last: 1d03h
Similar bugs (6)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KCSAN: data-race in n_tty_flush_buffer / n_tty_lookahead_flow_ctrl serial 6 1 1032d 1032d 0/29 auto-obsoleted due to no activity on 2022/10/24 16:46
upstream KCSAN: data-race in n_tty_flush_buffer / n_tty_lookahead_flow_ctrl (5) serial 6 11 335d 494d 0/29 auto-obsoleted due to no activity on 2024/09/20 19:47
upstream KCSAN: data-race in n_tty_flush_buffer / n_tty_lookahead_flow_ctrl (4) serial 6 1 573d 573d 0/29 auto-obsoleted due to no activity on 2024/01/26 04:56
upstream KCSAN: data-race in n_tty_flush_buffer / n_tty_lookahead_flow_ctrl (2) serial 6 14 807d 982d 0/29 auto-obsoleted due to no activity on 2023/06/06 13:18
upstream KCSAN: data-race in n_tty_flush_buffer / n_tty_lookahead_flow_ctrl (3) serial 6 6 698d 761d 0/29 auto-obsoleted due to no activity on 2023/09/23 08:11
upstream KCSAN: data-race in n_tty_flush_buffer / n_tty_lookahead_flow_ctrl (6) serial 6 13 76d 248d 0/29 auto-obsoleted due to no activity on 2025/06/27 12:49

Sample crash report:
==================================================================
BUG: KCSAN: data-race in n_tty_flush_buffer / n_tty_lookahead_flow_ctrl

write to 0xffffc90001e2d270 of 8 bytes by task 24920 on cpu 1:
 reset_buffer_flags drivers/tty/n_tty.c:322 [inline]
 n_tty_flush_buffer+0xa8/0x180 drivers/tty/n_tty.c:353
 tty_ldisc_hangup+0x77/0x370 drivers/tty/tty_ldisc.c:699
 __tty_hangup+0x395/0x510 drivers/tty/tty_io.c:621
 tty_vhangup+0x17/0x20 drivers/tty/tty_io.c:691
 pty_close+0x266/0x290 drivers/tty/pty.c:79
 tty_release+0x1ff/0xb10 drivers/tty/tty_io.c:1745
 __fput+0x29b/0x650 fs/file_table.c:465
 ____fput+0x1c/0x30 fs/file_table.c:493
 task_work_run+0x131/0x1a0 kernel/task_work.c:227
 get_signal+0xe13/0xf70 kernel/signal.c:2807
 arch_do_signal_or_restart+0x96/0x480 arch/x86/kernel/signal.c:337
 exit_to_user_mode_loop+0x7a/0x100 kernel/entry/common.c:111
 exit_to_user_mode_prepare include/linux/entry-common.h:330 [inline]
 syscall_exit_to_user_mode_work include/linux/entry-common.h:414 [inline]
 syscall_exit_to_user_mode include/linux/entry-common.h:449 [inline]
 do_syscall_64+0x1d6/0x200 arch/x86/entry/syscall_64.c:100
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

read-write to 0xffffc90001e2d270 of 8 bytes by task 7676 on cpu 0:
 n_tty_lookahead_flow_ctrl+0x48/0x130 drivers/tty/n_tty.c:1491
 tty_port_default_lookahead_buf+0x8e/0xc0 drivers/tty/tty_port.c:59
 lookahead_bufs drivers/tty/tty_buffer.c:428 [inline]
 flush_to_ldisc+0x281/0x360 drivers/tty/tty_buffer.c:498
 process_one_work kernel/workqueue.c:3238 [inline]
 process_scheduled_works+0x4cb/0x9d0 kernel/workqueue.c:3321
 worker_thread+0x582/0x770 kernel/workqueue.c:3402
 kthread+0x489/0x510 kernel/kthread.c:464
 ret_from_fork+0xda/0x150 arch/x86/kernel/process.c:148
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245

value changed: 0x0000000000001f3f -> 0x0000000000000000

Reported by Kernel Concurrency Sanitizer on:
CPU: 0 UID: 0 PID: 7676 Comm: kworker/u8:50 Not tainted 6.16.0-rc6-syzkaller-00002-g155a3c003e55 #0 PREEMPT(voluntary) 
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025
Workqueue: events_unbound flush_to_ldisc
==================================================================

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/07/16 16:45 upstream 155a3c003e55 124ec9cc .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in n_tty_flush_buffer / n_tty_lookahead_flow_ctrl
2025/07/11 11:41 upstream bc9ff192a6c9 3cda49cf .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in n_tty_flush_buffer / n_tty_lookahead_flow_ctrl
* Struck through repros no longer work on HEAD.