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

Status: upstream: reported C repro on 2020/09/08 10:18
First crash: 1350d, last: 1290d
Fix bisection: failed (error log, bisect log)
Fix bisection attempts (3)
Created Duration User Patch Repo Result
2020/12/07 12:22 22m bisect fix linux-4.19.y error job log (0)
2020/11/07 11:50 31m bisect fix linux-4.19.y job log (0) log
2020/10/08 10:22 54m bisect fix linux-4.19.y job log (0) log

Sample crash report:
BUG: KASAN: slab-out-of-bounds in slow_imageblit drivers/video/fbdev/core/cfbimgblt.c:173 [inline]
BUG: KASAN: slab-out-of-bounds in cfb_imageblit+0xe76/0x1040 drivers/video/fbdev/core/cfbimgblt.c:302
Read of size 1 at addr ffff8882197560c0 by task syz-executor148/9887

CPU: 1 PID: 9887 Comm: syz-executor148 Not tainted 4.19.143-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x1fc/0x2fe lib/dump_stack.c:118
 print_address_description.cold+0x54/0x219 mm/kasan/report.c:256
 kasan_report_error.cold+0x8a/0x1c7 mm/kasan/report.c:354
 kasan_report mm/kasan/report.c:412 [inline]
 __asan_report_load1_noabort+0x88/0x90 mm/kasan/report.c:430
 slow_imageblit drivers/video/fbdev/core/cfbimgblt.c:173 [inline]
 cfb_imageblit+0xe76/0x1040 drivers/video/fbdev/core/cfbimgblt.c:302
 vga_imageblit_expand drivers/video/fbdev/vga16fb.c:1207 [inline]
 vga16fb_imageblit+0x6b4/0x2260 drivers/video/fbdev/vga16fb.c:1260
 bit_putcs_unaligned drivers/video/fbdev/core/bitblit.c:139 [inline]
 bit_putcs+0x6e2/0xd10 drivers/video/fbdev/core/bitblit.c:188
 fbcon_putcs+0x336/0x4f0 drivers/video/fbdev/core/fbcon.c:1323
 con_flush drivers/tty/vt/vt.c:2559 [inline]
 do_con_write+0xbcd/0x1d90 drivers/tty/vt/vt.c:2809
 con_write+0x22/0xb0 drivers/tty/vt/vt.c:3145
 process_output_block drivers/tty/n_tty.c:593 [inline]
 n_tty_write+0x3c0/0xff0 drivers/tty/n_tty.c:2331
 do_tty_write drivers/tty/tty_io.c:960 [inline]
 tty_write+0x496/0x810 drivers/tty/tty_io.c:1044
 __vfs_write+0xf7/0x770 fs/read_write.c:485
 __kernel_write+0x109/0x370 fs/read_write.c:506
 write_pipe_buf+0x153/0x1f0 fs/splice.c:798
 splice_from_pipe_feed fs/splice.c:503 [inline]
 __splice_from_pipe+0x389/0x800 fs/splice.c:627
 splice_from_pipe fs/splice.c:662 [inline]
 default_file_splice_write+0xd8/0x180 fs/splice.c:810
 do_splice_from fs/splice.c:852 [inline]
 direct_splice_actor+0x115/0x160 fs/splice.c:1025
 splice_direct_to_actor+0x33f/0x8d0 fs/splice.c:980
 do_splice_direct+0x1a7/0x270 fs/splice.c:1068
 do_sendfile+0x550/0xc30 fs/read_write.c:1447
 __do_sys_sendfile64 fs/read_write.c:1508 [inline]
 __se_sys_sendfile64+0x147/0x160 fs/read_write.c:1494
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
RIP: 0033:0x446ad9
Code: e8 9c b4 02 00 48 83 c4 18 c3 0f 1f 80 00 00 00 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 0f 83 8b 07 fc ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007f123f15ad18 EFLAGS: 00000246 ORIG_RAX: 0000000000000028
RAX: ffffffffffffffda RBX: 00000000006dbc58 RCX: 0000000000446ad9
RDX: 0000000000000000 RSI: 0000000000000005 RDI: 0000000000000004
RBP: 00000000006dbc50 R08: 65732f636f72702f R09: 65732f636f72702f
R10: 0800000080004103 R11: 0000000000000246 R12: 00000000006dbc5c
R13: 00007f123f15ad20 R14: 00007f123f15ad20 R15: 20c49ba5e353f7cf

Allocated by task 1:
 kmem_cache_alloc_trace+0x12f/0x380 mm/slab.c:3625
 kmalloc include/linux/slab.h:515 [inline]
 do_register_framebuffer drivers/video/fbdev/core/fbmem.c:1668 [inline]
 register_framebuffer+0x73d/0x9e0 drivers/video/fbdev/core/fbmem.c:1831
 vga16fb_probe+0x6b4/0x7b7 drivers/video/fbdev/vga16fb.c:1373
 platform_drv_probe+0x8d/0x160 drivers/base/platform.c:584
 really_probe+0x58c/0x7e0 drivers/base/dd.c:503
 driver_probe_device+0xf9/0x200 drivers/base/dd.c:664
 __device_attach_driver+0x28b/0x310 drivers/base/dd.c:751
 bus_for_each_drv+0x159/0x1e0 drivers/base/bus.c:464
 __device_attach+0x226/0x440 drivers/base/dd.c:819
 bus_probe_device+0x1ea/0x2a0 drivers/base/bus.c:524
 device_add+0xac3/0x1610 drivers/base/core.c:2154
 platform_device_add+0x355/0x6e0 drivers/base/platform.c:420
 vga16fb_init+0x152/0x1c8 drivers/video/fbdev/vga16fb.c:1431
 do_one_initcall+0xf1/0x734 init/main.c:884
 do_initcall_level init/main.c:952 [inline]
 do_initcalls init/main.c:960 [inline]
 do_basic_setup init/main.c:978 [inline]
 kernel_init_freeable+0x9ab/0xa9d init/main.c:1145
 kernel_init+0xd/0x1bd init/main.c:1062
 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:415

Freed by task 0:
(stack is not available)

The buggy address belongs to the object at ffff8882197540c0
 which belongs to the cache kmalloc-8192 of size 8192
The buggy address is located 0 bytes to the right of
 8192-byte region [ffff8882197540c0, ffff8882197560c0)
The buggy address belongs to the page:
page:ffffea000865d500 count:1 mapcount:0 mapping:ffff88812c395080 index:0x0 compound_mapcount: 0
flags: 0x57ffe0000008100(slab|head)
raw: 057ffe0000008100 ffffea0008697908 ffffea0008629d08 ffff88812c395080
raw: 0000000000000000 ffff8882197540c0 0000000100000001 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff888219755f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff888219756000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff888219756080: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
 ffff888219756100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff888219756180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/09/08 10:17 linux-4.19.y c37da90efff5 abf9ba4f .config console log report syz C ci2-linux-4-19
* Struck through repros no longer work on HEAD.