syzbot


KASAN: slab-out-of-bounds Read in vgacon_save_screen

Status: moderation: reported on 2025/03/13 15:20
Subsystems: fbdev
[Documentation on labels]
Reported-by: syzbot+f6305e999e42a7c17ed7@syzkaller.appspotmail.com
First crash: 4d05h, last: 4d05h

Sample crash report:
==================================================================
BUG: KASAN: slab-out-of-bounds in scr_memcpyw include/linux/vt_buffer.h:38 [inline]
BUG: KASAN: slab-out-of-bounds in vgacon_save_screen drivers/video/console/vgacon.c:1132 [inline]
BUG: KASAN: slab-out-of-bounds in vgacon_save_screen+0x1b3/0x220 drivers/video/console/vgacon.c:1114
Read of size 4000 at addr ffff88814779df60 by task kworker/0:5/5895

CPU: 0 UID: 0 PID: 5895 Comm: kworker/0:5 Not tainted 6.14.0-rc5-syzkaller-00268-g1110ce6a1e34 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025
Workqueue: events console_callback
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:408 [inline]
 print_report+0xc3/0x670 mm/kasan/report.c:521
 kasan_report+0xd9/0x110 mm/kasan/report.c:634
 check_region_inline mm/kasan/generic.c:183 [inline]
 kasan_check_range+0xef/0x1a0 mm/kasan/generic.c:189
 __asan_memcpy+0x23/0x60 mm/kasan/shadow.c:105
 scr_memcpyw include/linux/vt_buffer.h:38 [inline]
 vgacon_save_screen drivers/video/console/vgacon.c:1132 [inline]
 vgacon_save_screen+0x1b3/0x220 drivers/video/console/vgacon.c:1114
 save_screen+0xc2/0x160 drivers/tty/vt/vt.c:883
 redraw_screen+0x653/0x760 drivers/tty/vt/vt.c:942
 complete_change_console+0x109/0x600 drivers/tty/vt/vt_ioctl.c:1140
 change_console+0x1ac/0x560 drivers/tty/vt/vt_ioctl.c:1265
 console_callback+0x1a2/0x4c0 drivers/tty/vt/vt.c:3126
 process_one_work+0x9c5/0x1ba0 kernel/workqueue.c:3238
 process_scheduled_works kernel/workqueue.c:3319 [inline]
 worker_thread+0x6c8/0xf00 kernel/workqueue.c:3400
 kthread+0x3af/0x750 kernel/kthread.c:464
 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:148
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
 </TASK>

Allocated by task 6766:
 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:377 [inline]
 __kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:394
 kasan_kmalloc include/linux/kasan.h:260 [inline]
 __do_kmalloc_node mm/slub.c:4294 [inline]
 __kmalloc_node_track_caller_noprof+0x222/0x510 mm/slub.c:4313
 kmalloc_reserve+0xef/0x2c0 net/core/skbuff.c:537
 __alloc_skb+0x164/0x380 net/core/skbuff.c:606
 alloc_skb include/linux/skbuff.h:1331 [inline]
 nsim_dev_trap_skb_build drivers/net/netdevsim/dev.c:748 [inline]
 nsim_dev_trap_report drivers/net/netdevsim/dev.c:805 [inline]
 nsim_dev_trap_report_work+0x2af/0xd00 drivers/net/netdevsim/dev.c:851
 process_one_work+0x9c5/0x1ba0 kernel/workqueue.c:3238
 process_scheduled_works kernel/workqueue.c:3319 [inline]
 worker_thread+0x6c8/0xf00 kernel/workqueue.c:3400
 kthread+0x3af/0x750 kernel/kthread.c:464
 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:148
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244

Freed by task 6766:
 kasan_save_stack+0x33/0x60 mm/kasan/common.c:47
 kasan_save_track+0x14/0x30 mm/kasan/common.c:68
 kasan_save_free_info+0x3b/0x60 mm/kasan/generic.c:576
 poison_slab_object mm/kasan/common.c:247 [inline]
 __kasan_slab_free+0x51/0x70 mm/kasan/common.c:264
 kasan_slab_free include/linux/kasan.h:233 [inline]
 slab_free_hook mm/slub.c:2353 [inline]
 slab_free mm/slub.c:4609 [inline]
 kfree+0x2c4/0x4d0 mm/slub.c:4757
 skb_kfree_head net/core/skbuff.c:996 [inline]
 skb_free_head+0x108/0x1d0 net/core/skbuff.c:1008
 skb_release_data+0x560/0x730 net/core/skbuff.c:1035
 skb_release_all net/core/skbuff.c:1100 [inline]
 __kfree_skb net/core/skbuff.c:1114 [inline]
 consume_skb net/core/skbuff.c:1346 [inline]
 consume_skb+0xbf/0x100 net/core/skbuff.c:1340
 nsim_dev_trap_report drivers/net/netdevsim/dev.c:821 [inline]
 nsim_dev_trap_report_work+0x8cf/0xd00 drivers/net/netdevsim/dev.c:851
 process_one_work+0x9c5/0x1ba0 kernel/workqueue.c:3238
 process_scheduled_works kernel/workqueue.c:3319 [inline]
 worker_thread+0x6c8/0xf00 kernel/workqueue.c:3400
 kthread+0x3af/0x750 kernel/kthread.c:464
 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:148
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244

The buggy address belongs to the object at ffff88814779c000
 which belongs to the cache kmalloc-4k of size 4096
The buggy address is located 3936 bytes to the right of
 allocated 4096-byte region [ffff88814779c000, ffff88814779d000)

The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x147798
head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
anon flags: 0x57ff00000000040(head|node=1|zone=2|lastcpupid=0x7ff)
page_type: f5(slab)
raw: 057ff00000000040 ffff88801b042140 0000000000000000 dead000000000001
raw: 0000000000000000 0000000000040004 00000000f5000000 0000000000000000
head: 057ff00000000040 ffff88801b042140 0000000000000000 dead000000000001
head: 0000000000000000 0000000000040004 00000000f5000000 0000000000000000
head: 057ff00000000003 ffffea00051de601 ffffffffffffffff 0000000000000000
head: 0000000000000008 0000000000000000 00000000ffffffff 0000000000000000
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 1, tgid 1 (swapper/0), ts 17298163022, free_ts 0
 set_page_owner include/linux/page_owner.h:32 [inline]
 post_alloc_hook+0x181/0x1b0 mm/page_alloc.c:1551
 prep_new_page mm/page_alloc.c:1559 [inline]
 get_page_from_freelist+0xfce/0x2f80 mm/page_alloc.c:3477
 __alloc_frozen_pages_noprof+0x221/0x2470 mm/page_alloc.c:4740
 alloc_pages_mpol+0x1fc/0x540 mm/mempolicy.c:2270
 alloc_slab_page mm/slub.c:2423 [inline]
 allocate_slab mm/slub.c:2587 [inline]
 new_slab+0x23d/0x330 mm/slub.c:2640
 ___slab_alloc+0xc5d/0x1720 mm/slub.c:3826
 __slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3916
 __slab_alloc_node mm/slub.c:3991 [inline]
 slab_alloc_node mm/slub.c:4152 [inline]
 __kmalloc_cache_noprof+0xfa/0x410 mm/slub.c:4320
 kmalloc_noprof include/linux/slab.h:901 [inline]
 kzalloc_noprof include/linux/slab.h:1037 [inline]
 kobject_uevent_env+0x265/0x1870 lib/kobject_uevent.c:540
 device_add+0x10e0/0x1a70 drivers/base/core.c:3646
 platform_device_add+0x316/0x810 drivers/base/platform.c:716
 vim2m_init+0x16/0x80 drivers/media/test-drivers/vim2m.c:1411
 do_one_initcall+0x128/0x700 init/main.c:1257
 do_initcall_level init/main.c:1319 [inline]
 do_initcalls init/main.c:1335 [inline]
 do_basic_setup init/main.c:1354 [inline]
 kernel_init_freeable+0x5c7/0x900 init/main.c:1568
 kernel_init+0x1c/0x2b0 init/main.c:1457
 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:148
page_owner free stack trace missing

Memory state around the buggy address:
 ffff88814779de00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88814779de80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88814779df00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
                                                       ^
 ffff88814779df80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88814779e000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/03/09 15:10 upstream 1110ce6a1e34 163f510d .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto KASAN: slab-out-of-bounds Read in vgacon_save_screen
* Struck through repros no longer work on HEAD.