syzbot


KASAN: null-ptr-deref Write in n_tty_flush_buffer

Status: upstream: reported C repro on 2025/06/02 07:54
Bug presence: origin:lts
[Documentation on labels]
Reported-by: syzbot+6b46de683272d9ba4716@syzkaller.appspotmail.com
First crash: 6d14h, last: 4d01h
Bug presence (2)
Date Name Commit Repro Result
2025/06/02 lts (merge base) 02b72ccb5f9d C [report] KASAN: null-ptr-deref Write in n_tty_flush_buffer
2025/06/02 upstream (ToT) cd2e103d57e5 C Didn't crash
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-5-10 KASAN: null-ptr-deref Write in n_tty_flush_buffer C 1 8d12h 89d 0/2 upstream: reported C repro on 2025/03/10 22:54

Sample crash report:
==================================================================
BUG: KASAN: null-ptr-deref in reset_buffer_flags drivers/tty/n_tty.c:332 [inline]
BUG: KASAN: null-ptr-deref in n_tty_flush_buffer+0x6c/0x220 drivers/tty/n_tty.c:371
Write of size 24 at addr 0000000000000000 by task kworker/0:3/371

CPU: 0 PID: 371 Comm: kworker/0:3 Not tainted 6.1.138-syzkaller-00052-g4cf22d978348 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025
Workqueue: events vc_SAK
Call Trace:
 <TASK>
 __dump_stack+0x21/0x24 lib/dump_stack.c:88
 dump_stack_lvl+0xee/0x150 lib/dump_stack.c:106
 print_report+0x3d/0x60 mm/kasan/report.c:430
 kasan_report+0x122/0x150 mm/kasan/report.c:531
 check_region_inline mm/kasan/generic.c:-1 [inline]
 kasan_check_range+0x280/0x290 mm/kasan/generic.c:189
 memset+0x23/0x40 mm/kasan/shadow.c:44
 reset_buffer_flags drivers/tty/n_tty.c:332 [inline]
 n_tty_flush_buffer+0x6c/0x220 drivers/tty/n_tty.c:371
 tty_buffer_flush+0x31d/0x3e0 drivers/tty/tty_buffer.c:242
 tty_ldisc_flush+0x6c/0xc0 drivers/tty/tty_ldisc.c:389
 __do_SAK+0x132/0x640 drivers/tty/tty_io.c:3011
 vc_SAK+0x78/0x220 drivers/tty/vt/vt_ioctl.c:995
 process_one_work+0x71f/0xc40 kernel/workqueue.c:2299
 worker_thread+0xa29/0x11f0 kernel/workqueue.c:2446
 kthread+0x281/0x320 kernel/kthread.c:386
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295
 </TASK>
==================================================================
BUG: unable to handle page fault for address: 0000000000002260
#PF: supervisor write access in kernel mode
#PF: error_code(0x0002) - not-present page
PGD 0 P4D 0 
Oops: 0002 [#1] PREEMPT SMP KASAN
CPU: 0 PID: 371 Comm: kworker/0:3 Tainted: G    B              6.1.138-syzkaller-00052-g4cf22d978348 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025
Workqueue: events vc_SAK
RIP: 0010:memset_erms+0x9/0x10 arch/x86/lib/memset_64.S:64
Code: c1 e9 03 40 0f b6 f6 48 b8 01 01 01 01 01 01 01 01 48 0f af c6 f3 48 ab 89 d1 f3 aa 4c 89 c8 c3 90 49 89 f9 40 88 f0 48 89 d1 <f3> aa 4c 89 c8 c3 90 49 89 fa 40 0f b6 ce 48 b8 01 01 01 01 01 01
RSP: 0018:ffffc90000fa7b50 EFLAGS: 00010202
RAX: 0000000000000000 RBX: 0000000000000010 RCX: 0000000000000010
RDX: 0000000000000010 RSI: 0000000000000000 RDI: 0000000000002260
RBP: ffffc90000fa7b70 R08: 0000000000000000 R09: 0000000000002260
R10: fffffbfff0f2cafd R11: 1ffffffff0f2cafc R12: 000000000000005d
R13: 0000000000002260 R14: 0000000000000000 R15: 0000000000002260
FS:  0000000000000000(0000) GS:ffff8881f7000000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000002260 CR3: 000000012890b000 CR4: 00000000003506b0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <TASK>
 reset_buffer_flags drivers/tty/n_tty.c:334 [inline]
 n_tty_flush_buffer+0x7b/0x220 drivers/tty/n_tty.c:371
 tty_buffer_flush+0x31d/0x3e0 drivers/tty/tty_buffer.c:242
 tty_ldisc_flush+0x6c/0xc0 drivers/tty/tty_ldisc.c:389
 __do_SAK+0x132/0x640 drivers/tty/tty_io.c:3011
 vc_SAK+0x78/0x220 drivers/tty/vt/vt_ioctl.c:995
 process_one_work+0x71f/0xc40 kernel/workqueue.c:2299
 worker_thread+0xa29/0x11f0 kernel/workqueue.c:2446
 kthread+0x281/0x320 kernel/kthread.c:386
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295
 </TASK>
Modules linked in:
CR2: 0000000000002260
---[ end trace 0000000000000000 ]---
RIP: 0010:memset_erms+0x9/0x10 arch/x86/lib/memset_64.S:64
Code: c1 e9 03 40 0f b6 f6 48 b8 01 01 01 01 01 01 01 01 48 0f af c6 f3 48 ab 89 d1 f3 aa 4c 89 c8 c3 90 49 89 f9 40 88 f0 48 89 d1 <f3> aa 4c 89 c8 c3 90 49 89 fa 40 0f b6 ce 48 b8 01 01 01 01 01 01
RSP: 0018:ffffc90000fa7b50 EFLAGS: 00010202
RAX: 0000000000000000 RBX: 0000000000000010 RCX: 0000000000000010
RDX: 0000000000000010 RSI: 0000000000000000 RDI: 0000000000002260
RBP: ffffc90000fa7b70 R08: 0000000000000000 R09: 0000000000002260
R10: fffffbfff0f2cafd R11: 1ffffffff0f2cafc R12: 000000000000005d
R13: 0000000000002260 R14: 0000000000000000 R15: 0000000000002260
FS:  0000000000000000(0000) GS:ffff8881f7000000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000002260 CR3: 000000012890b000 CR4: 00000000003506b0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
----------------
Code disassembly (best guess):
   0:	c1 e9 03             	shr    $0x3,%ecx
   3:	40 0f b6 f6          	movzbl %sil,%esi
   7:	48 b8 01 01 01 01 01 	movabs $0x101010101010101,%rax
   e:	01 01 01
  11:	48 0f af c6          	imul   %rsi,%rax
  15:	f3 48 ab             	rep stos %rax,%es:(%rdi)
  18:	89 d1                	mov    %edx,%ecx
  1a:	f3 aa                	rep stos %al,%es:(%rdi)
  1c:	4c 89 c8             	mov    %r9,%rax
  1f:	c3                   	ret
  20:	90                   	nop
  21:	49 89 f9             	mov    %rdi,%r9
  24:	40 88 f0             	mov    %sil,%al
  27:	48 89 d1             	mov    %rdx,%rcx
* 2a:	f3 aa                	rep stos %al,%es:(%rdi) <-- trapping instruction
  2c:	4c 89 c8             	mov    %r9,%rax
  2f:	c3                   	ret
  30:	90                   	nop
  31:	49 89 fa             	mov    %rdi,%r10
  34:	40 0f b6 ce          	movzbl %sil,%ecx
  38:	48                   	rex.W
  39:	b8 01 01 01 01       	mov    $0x1010101,%eax
  3e:	01 01                	add    %eax,(%rcx)

Crashes (3):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/06/04 21:35 android14-6.1 4cf22d978348 e565f08d .config strace log report syz / log C [disk image] [vmlinux] [kernel image] ci2-android-6-1 KASAN: null-ptr-deref Write in n_tty_flush_buffer
2025/06/03 06:41 android14-6.1 5b87067cdd87 a30356b7 .config strace log report syz / log C [disk image] [vmlinux] [kernel image] ci2-android-6-1 KASAN: null-ptr-deref Write in n_tty_flush_buffer
2025/06/02 07:53 android14-6.1 db710ea87c32 3d2f584d .config strace log report syz / log C [disk image] [vmlinux] [kernel image] ci2-android-6-1 KASAN: null-ptr-deref Write in n_tty_flush_buffer
* Struck through repros no longer work on HEAD.