[Android 5.10] KASAN: null-ptr-deref Write in n_tty_flush_buffer

3 views
Skip to first unread message

syzbot

unread,
Mar 10, 2025, 6:54:24 PM3/10/25
to syzkaller-a...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 3f5f2283d684 Merge branch 'android13-5.10' into android13-..
git tree: android13-5.10-lts
console+strace: https://syzkaller.appspot.com/x/log.txt?x=15213b8c580000
kernel config: https://syzkaller.appspot.com/x/.config?x=b0867136c1e117ab
dashboard link: https://syzkaller.appspot.com/bug?extid=fe15bc1f89172cafb5ef
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=142ab074580000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=11909478580000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/c230530df949/disk-3f5f2283.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/c932e3e9294e/vmlinux-3f5f2283.xz
kernel image: https://storage.googleapis.com/syzbot-assets/117ea6e7ceda/bzImage-3f5f2283.xz

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

==================================================================
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+0x71/0x250 drivers/tty/n_tty.c:370
Write of size 24 at addr 0000000000000000 by task kworker/1:2/343

CPU: 1 PID: 343 Comm: kworker/1:2 Not tainted 5.10.234-syzkaller-00023-g3f5f2283d684 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025
Workqueue: events vc_SAK
Call Trace:
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack_lvl+0x1e2/0x24b lib/dump_stack.c:118
__kasan_report mm/kasan/report.c:439 [inline]
kasan_report+0x167/0x1c0 mm/kasan/report.c:452
kasan_check_range+0x293/0x2a0 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+0x71/0x250 drivers/tty/n_tty.c:370
tty_buffer_flush+0x2eb/0x380 drivers/tty/tty_buffer.c:239
tty_ldisc_flush+0x6a/0xc0 drivers/tty/tty_ldisc.c:415
__do_SAK+0x25e/0x640 drivers/tty/tty_io.c:3001
vc_SAK+0x78/0x240 drivers/tty/vt/vt_ioctl.c:994
process_one_work+0x6dc/0xbd0 kernel/workqueue.c:2301
worker_thread+0xaea/0x1510 kernel/workqueue.c:2447
kthread+0x34b/0x3d0 kernel/kthread.c:313
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298
==================================================================
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: 1 PID: 343 Comm: kworker/1:2 Tainted: G B 5.10.234-syzkaller-00023-g3f5f2283d684 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/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:ffffc90000c87b68 EFLAGS: 00010202
RAX: 0000000000000000 RBX: 0000000000002260 RCX: 0000000000000010
RDX: 0000000000000010 RSI: 0000000000000000 RDI: 0000000000002260
RBP: ffffc90000c87b88 R08: ffffffff813e2b8b R09: 0000000000002260
R10: fffffbfff0e11248 R11: dffffc0000000001 R12: 000000000000005d
R13: 0000000000002260 R14: 0000000000000000 R15: 0000000000000010
FS: 0000000000000000(0000) GS:ffff8881f7100000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000002260 CR3: 0000000120ffc000 CR4: 00000000003506a0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
reset_buffer_flags drivers/tty/n_tty.c:334 [inline]
n_tty_flush_buffer+0x80/0x250 drivers/tty/n_tty.c:370
tty_buffer_flush+0x2eb/0x380 drivers/tty/tty_buffer.c:239
tty_ldisc_flush+0x6a/0xc0 drivers/tty/tty_ldisc.c:415
__do_SAK+0x25e/0x640 drivers/tty/tty_io.c:3001
vc_SAK+0x78/0x240 drivers/tty/vt/vt_ioctl.c:994
process_one_work+0x6dc/0xbd0 kernel/workqueue.c:2301
worker_thread+0xaea/0x1510 kernel/workqueue.c:2447
kthread+0x34b/0x3d0 kernel/kthread.c:313
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298
Modules linked in:
CR2: 0000000000002260
---[ end trace 20d90acc21350611 ]---
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:ffffc90000c87b68 EFLAGS: 00010202
RAX: 0000000000000000 RBX: 0000000000002260 RCX: 0000000000000010
RDX: 0000000000000010 RSI: 0000000000000000 RDI: 0000000000002260
RBP: ffffc90000c87b88 R08: ffffffff813e2b8b R09: 0000000000002260
R10: fffffbfff0e11248 R11: dffffc0000000001 R12: 000000000000005d
R13: 0000000000002260 R14: 0000000000000000 R15: 0000000000000010
FS: 0000000000000000(0000) GS:ffff8881f7100000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000002260 CR3: 0000000120ffc000 CR4: 00000000003506a0
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)


---
This report 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 issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup
Reply all
Reply to author
Forward
0 new messages