syzbot


KASAN: slab-out-of-bounds Write in do_con_write (2)

Status: moderation: reported on 2025/08/23 16:55
Subsystems: serial
[Documentation on labels]
Reported-by: syzbot+f16f353b701fe8be7445@syzkaller.appspotmail.com
First crash: 13d, last: 5d01h
Similar bugs (1)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: slab-out-of-bounds Write in do_con_write serial 23 4 128d 206d 0/29 auto-obsoleted due to no activity on 2025/08/04 16:13

Sample crash report:
==================================================================
BUG: KASAN: slab-out-of-bounds in vc_con_write_normal drivers/tty/vt/vt.c:3086 [inline]
BUG: KASAN: slab-out-of-bounds in do_con_write+0x3839/0x8280 drivers/tty/vt/vt.c:3178
Write of size 2 at addr ffff8880790e5fda by task syz.2.3254/24495

CPU: 0 UID: 0 PID: 24495 Comm: syz.2.3254 Tainted: G     U              syzkaller #0 PREEMPT(full) 
Tainted: [U]=USER
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2025
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:94 [inline]
 dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120
 print_address_description mm/kasan/report.c:378 [inline]
 print_report+0xcd/0x630 mm/kasan/report.c:482
 kasan_report+0xe0/0x110 mm/kasan/report.c:595
 vc_con_write_normal drivers/tty/vt/vt.c:3086 [inline]
 do_con_write+0x3839/0x8280 drivers/tty/vt/vt.c:3178
 con_write+0x23/0xb0 drivers/tty/vt/vt.c:3516
 process_output_block drivers/tty/n_tty.c:561 [inline]
 n_tty_write+0x41c/0x11e0 drivers/tty/n_tty.c:2377
 iterate_tty_write drivers/tty/tty_io.c:1006 [inline]
 file_tty_write.constprop.0+0x504/0x9b0 drivers/tty/tty_io.c:1081
 tty_write drivers/tty/tty_io.c:1102 [inline]
 redirected_tty_write drivers/tty/tty_io.c:1125 [inline]
 redirected_tty_write+0xd4/0x150 drivers/tty/tty_io.c:1105
 new_sync_write fs/read_write.c:593 [inline]
 vfs_write+0x7d0/0x11d0 fs/read_write.c:686
 ksys_write+0x12a/0x250 fs/read_write.c:738
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0xcd/0x490 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f429e78ebe9
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f429f635038 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00007f429e9b6090 RCX: 00007f429e78ebe9
RDX: 0000000000000004 RSI: 0000200000000440 RDI: 0000000000000005
RBP: 00007f429e811e19 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f429e9b6128 R14: 00007f429e9b6090 R15: 00007ffeb4e40248
 </TASK>

Allocated by task 20335:
 kasan_save_stack+0x33/0x60 mm/kasan/common.c:47
 kasan_save_track+0x14/0x30 mm/kasan/common.c:68
 poison_kmalloc_redzone mm/kasan/common.c:388 [inline]
 __kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:405
 kasan_kmalloc include/linux/kasan.h:260 [inline]
 __do_kmalloc_node mm/slub.c:4365 [inline]
 __kmalloc_noprof+0x223/0x510 mm/slub.c:4377
 kmalloc_noprof include/linux/slab.h:909 [inline]
 kzalloc_noprof include/linux/slab.h:1039 [inline]
 vc_do_resize+0x1de/0x10e0 drivers/tty/vt/vt.c:1182
 vc_resize include/linux/vt_kern.h:49 [inline]
 vgacon_init+0x37c/0x440 drivers/video/console/vgacon.c:392
 visual_init+0x320/0x620 drivers/tty/vt/vt.c:1019
 do_bind_con_driver.isra.0+0x57a/0xbf0 drivers/tty/vt/vt.c:3915
 do_unbind_con_driver+0x571/0x6d0 drivers/tty/vt/vt.c:4024
 vt_unbind drivers/tty/vt/vt.c:4110 [inline]
 store_bind+0x421/0x760 drivers/tty/vt/vt.c:4145
 dev_attr_store+0x58/0x80 drivers/base/core.c:2437
 sysfs_kf_write+0xf2/0x150 fs/sysfs/file.c:145
 kernfs_fop_write_iter+0x354/0x510 fs/kernfs/file.c:334
 do_iter_readv_writev+0x65f/0x9e0 fs/read_write.c:827
 vfs_writev+0x35f/0xde0 fs/read_write.c:1057
 do_writev+0x132/0x340 fs/read_write.c:1103
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0xcd/0x490 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

The buggy address belongs to the object at ffff8880790e4000
 which belongs to the cache kmalloc-4k of size 4096
The buggy address is located 4154 bytes to the right of
 allocated 4000-byte region [ffff8880790e4000, ffff8880790e4fa0)

The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x790e0
head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff)
page_type: f5(slab)
raw: 00fff00000000040 ffff88801b842140 dead000000000100 dead000000000122
raw: 0000000000000000 0000000000040004 00000000f5000000 0000000000000000
head: 00fff00000000040 ffff88801b842140 dead000000000100 dead000000000122
head: 0000000000000000 0000000000040004 00000000f5000000 0000000000000000
head: 00fff00000000003 ffffea0001e43801 00000000ffffffff 00000000ffffffff
head: ffffffffffffffff 0000000000000000 00000000ffffffff 0000000000000008
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 16093, tgid 16092 (syz.3.1996), ts 660513891155, free_ts 660324387286
 set_page_owner include/linux/page_owner.h:32 [inline]
 post_alloc_hook+0x1c0/0x230 mm/page_alloc.c:1851
 prep_new_page mm/page_alloc.c:1859 [inline]
 get_page_from_freelist+0x132b/0x38e0 mm/page_alloc.c:3858
 __alloc_frozen_pages_noprof+0x261/0x23f0 mm/page_alloc.c:5148
 alloc_pages_mpol+0x1fb/0x550 mm/mempolicy.c:2416
 alloc_slab_page mm/slub.c:2487 [inline]
 allocate_slab mm/slub.c:2655 [inline]
 new_slab+0x247/0x330 mm/slub.c:2709
 ___slab_alloc+0xcf2/0x1740 mm/slub.c:3891
 __slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3981
 __slab_alloc_node mm/slub.c:4056 [inline]
 slab_alloc_node mm/slub.c:4217 [inline]
 __do_kmalloc_node mm/slub.c:4364 [inline]
 __kvmalloc_node_noprof+0x3b1/0x620 mm/slub.c:5052
 snd_rawmidi_runtime_create sound/core/rawmidi.c:175 [inline]
 open_substream+0x30c/0x990 sound/core/rawmidi.c:345
 rawmidi_open_priv+0x543/0x6e0 sound/core/rawmidi.c:397
 snd_rawmidi_open+0x4cc/0xbf0 sound/core/rawmidi.c:485
 snd_open+0x22d/0x4c0 sound/core/sound.c:166
 chrdev_open+0x234/0x6a0 fs/char_dev.c:414
 do_dentry_open+0x982/0x1530 fs/open.c:965
 vfs_open+0x82/0x3f0 fs/open.c:1095
 do_open fs/namei.c:3887 [inline]
 path_openat+0x1de4/0x2cb0 fs/namei.c:4046
page last free pid 16087 tgid 16086 stack trace:
 reset_page_owner include/linux/page_owner.h:25 [inline]
 free_pages_prepare mm/page_alloc.c:1395 [inline]
 __free_frozen_pages+0x7d5/0x10f0 mm/page_alloc.c:2895
 sg_remove_scat+0x1bb/0x560 drivers/scsi/sg.c:1954
 sg_finish_rem_req+0x322/0x590 drivers/scsi/sg.c:1844
 sg_common_write.constprop.0+0xa5e/0x1c90 drivers/scsi/sg.c:803
 sg_write+0x813/0xe10 drivers/scsi/sg.c:703
 vfs_write+0x2a0/0x11d0 fs/read_write.c:684
 ksys_write+0x12a/0x250 fs/read_write.c:738
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0xcd/0x490 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

Memory state around the buggy address:
 ffff8880790e5e80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff8880790e5f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff8880790e5f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
                                                    ^
 ffff8880790e6000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff8880790e6080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================

Crashes (3):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/08/28 11:24 upstream 07d9df80082b bee60a83 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto KASAN: slab-out-of-bounds Write in do_con_write
2025/08/27 04:43 upstream fab1beda7597 e12e5ba4 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto KASAN: slab-out-of-bounds Write in do_con_write
2025/08/19 16:54 upstream be48bcf004f9 523f460e .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto KASAN: slab-out-of-bounds Write in do_con_write
* Struck through repros no longer work on HEAD.