syzbot


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

Status: fixed on 2020/01/08 01:06
Reported-by: syzbot+7d027845265d531ba506@syzkaller.appspotmail.com
Fix commit: 0c9acb1af77a vcs: prevent write access to vcsu devices
First crash: 1154d, last: 1152d

Cause bisection: introduced by (bisect log) :
commit d21b0be246bf3bbf569e6e239f56abb529c7154e
Author: Nicolas Pitre <nicolas.pitre@linaro.org>
Date: Wed Jun 27 03:56:41 2018 +0000

  vt: introduce unicode mode for /dev/vcs

Crash: KASAN: slab-out-of-bounds Read in vcs_scr_readw (log)
Repro: C syz .config

Fix bisection: fixed by (bisect log) :
commit 0c9acb1af77a3cb8707e43f45b72c95266903cee
Author: Nicolas Pitre <nico@fluxnic.net>
Date: Tue Nov 5 09:33:16 2019 +0000

  vcs: prevent write access to vcsu devices

similar bugs (1):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.19 KASAN: slab-out-of-bounds Read in vcs_scr_readw C inconclusive 80 1144d 1153d 1/1 fixed on 2020/09/18 07:23

Sample crash report:
==================================================================
BUG: KASAN: slab-out-of-bounds in vcs_scr_readw+0xc2/0xd0 drivers/tty/vt/vt.c:4665
Read of size 2 at addr ffff8880a87f92c0 by task syz-executor318/9700

CPU: 0 PID: 9700 Comm: syz-executor318 Not tainted 5.4.0-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+0x197/0x210 lib/dump_stack.c:118
 print_address_description.constprop.0.cold+0xd4/0x30b mm/kasan/report.c:374
 __kasan_report.cold+0x1b/0x41 mm/kasan/report.c:506
 kasan_report+0x12/0x20 mm/kasan/common.c:638
 __asan_report_load2_noabort+0x14/0x20 mm/kasan/generic_report.c:133
 vcs_scr_readw+0xc2/0xd0 drivers/tty/vt/vt.c:4665
 vcs_write+0x646/0xcf0 drivers/tty/vt/vc_screen.c:545
 __vfs_write+0x8a/0x110 fs/read_write.c:494
 vfs_write+0x268/0x5d0 fs/read_write.c:558
 ksys_write+0x14f/0x290 fs/read_write.c:611
 __do_sys_write fs/read_write.c:623 [inline]
 __se_sys_write fs/read_write.c:620 [inline]
 __x64_sys_write+0x73/0xb0 fs/read_write.c:620
 do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x443e49
Code: 18 89 d0 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 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 7b d8 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007fffb2c50aa8 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00000000004002e0 RCX: 0000000000443e49
RDX: 0000000000001010 RSI: 0000000020006480 RDI: 0000000000000003
RBP: 00000000006cf018 R08: 0000000000000000 R09: 00000000004002e0
R10: 000000000000000f R11: 0000000000000246 R12: 0000000000401b50
R13: 0000000000401be0 R14: 0000000000000000 R15: 0000000000000000

Allocated by task 9678:
 save_stack+0x23/0x90 mm/kasan/common.c:71
 set_track mm/kasan/common.c:79 [inline]
 __kasan_kmalloc mm/kasan/common.c:512 [inline]
 __kasan_kmalloc.constprop.0+0xcf/0xe0 mm/kasan/common.c:485
 kasan_kmalloc+0x9/0x10 mm/kasan/common.c:526
 __do_kmalloc mm/slab.c:3656 [inline]
 __kmalloc+0x163/0x770 mm/slab.c:3665
 kmalloc include/linux/slab.h:561 [inline]
 kzalloc include/linux/slab.h:670 [inline]
 vc_allocate drivers/tty/vt/vt.c:1098 [inline]
 vc_allocate+0x3fc/0x760 drivers/tty/vt/vt.c:1066
 con_install+0x52/0x410 drivers/tty/vt/vt.c:3229
 tty_driver_install_tty drivers/tty/tty_io.c:1228 [inline]
 tty_init_dev drivers/tty/tty_io.c:1341 [inline]
 tty_init_dev+0xf7/0x460 drivers/tty/tty_io.c:1318
 tty_open_by_driver drivers/tty/tty_io.c:1985 [inline]
 tty_open+0x4a5/0xbb0 drivers/tty/tty_io.c:2033
 chrdev_open+0x245/0x6b0 fs/char_dev.c:414
 do_dentry_open+0x4e6/0x1380 fs/open.c:797
 vfs_open+0xa0/0xd0 fs/open.c:914
 do_last fs/namei.c:3412 [inline]
 path_openat+0x10e4/0x4710 fs/namei.c:3529
 do_filp_open+0x1a1/0x280 fs/namei.c:3559
 do_sys_open+0x3fe/0x5d0 fs/open.c:1097
 __do_sys_open fs/open.c:1115 [inline]
 __se_sys_open fs/open.c:1110 [inline]
 __x64_sys_open+0x7e/0xc0 fs/open.c:1110
 do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 9401:
 save_stack+0x23/0x90 mm/kasan/common.c:71
 set_track mm/kasan/common.c:79 [inline]
 kasan_set_free_info mm/kasan/common.c:334 [inline]
 __kasan_slab_free+0x102/0x150 mm/kasan/common.c:473
 kasan_slab_free+0xe/0x10 mm/kasan/common.c:482
 __cache_free mm/slab.c:3426 [inline]
 kfree+0x10a/0x2c0 mm/slab.c:3757
 tomoyo_init_log+0x15b5/0x2070 security/tomoyo/audit.c:293
 tomoyo_supervisor+0x33f/0xef0 security/tomoyo/common.c:2095
 tomoyo_audit_env_log security/tomoyo/environ.c:36 [inline]
 tomoyo_env_perm+0x18e/0x210 security/tomoyo/environ.c:63
 tomoyo_environ security/tomoyo/domain.c:670 [inline]
 tomoyo_find_next_domain+0x1354/0x1f6c security/tomoyo/domain.c:876
 tomoyo_bprm_check_security security/tomoyo/tomoyo.c:107 [inline]
 tomoyo_bprm_check_security+0x124/0x1a0 security/tomoyo/tomoyo.c:97
 security_bprm_check+0x63/0xb0 security/security.c:784
 search_binary_handler+0x71/0x570 fs/exec.c:1645
 exec_binprm fs/exec.c:1701 [inline]
 __do_execve_file.isra.0+0x1329/0x22b0 fs/exec.c:1821
 do_execveat_common fs/exec.c:1867 [inline]
 do_execve fs/exec.c:1884 [inline]
 __do_sys_execve fs/exec.c:1960 [inline]
 __se_sys_execve fs/exec.c:1955 [inline]
 __x64_sys_execve+0x8f/0xc0 fs/exec.c:1955
 do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff8880a87f8000
 which belongs to the cache kmalloc-8k of size 8192
The buggy address is located 4800 bytes inside of
 8192-byte region [ffff8880a87f8000, ffff8880a87fa000)
The buggy address belongs to the page:
page:ffffea0002a1fe00 refcount:1 mapcount:0 mapping:ffff8880aa4021c0 index:0x0 compound_mapcount: 0
raw: 00fffe0000010200 ffffea0002502a08 ffffea00024f5608 ffff8880aa4021c0
raw: 0000000000000000 ffff8880a87f8000 0000000100000001 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8880a87f9180: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff8880a87f9200: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff8880a87f9280: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
                                           ^
 ffff8880a87f9300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff8880a87f9380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================

Crashes (16):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets Title
ci-upstream-kasan-gce-selinux-root 2019/12/04 06:37 upstream 76bb8b05960c ae13a849 .config console log report syz C
ci-upstream-kasan-gce-root 2019/12/04 06:03 upstream 76bb8b05960c ae13a849 .config console log report syz C
ci-upstream-kasan-gce-root 2019/12/04 04:55 upstream 76bb8b05960c ae13a849 .config console log report syz C
ci-upstream-kasan-gce 2019/12/03 09:08 upstream 596cf45cbf6e ab342da3 .config console log report syz C
ci-upstream-kasan-gce 2019/12/03 08:02 upstream 596cf45cbf6e ab342da3 .config console log report syz C
ci-upstream-kasan-gce-selinux-root 2019/12/03 01:09 upstream 596cf45cbf6e ab342da3 .config console log report syz C
ci-upstream-kasan-gce-386 2019/12/03 10:23 upstream 596cf45cbf6e ab342da3 .config console log report syz C
ci-upstream-kasan-gce-386 2019/12/03 09:16 upstream 596cf45cbf6e ab342da3 .config console log report syz C
ci-upstream-kasan-gce-selinux-root 2019/12/04 04:47 upstream 76bb8b05960c ae13a849 .config console log report
ci-upstream-kasan-gce-root 2019/12/04 04:23 upstream 76bb8b05960c ae13a849 .config console log report
ci-upstream-kasan-gce-root 2019/12/04 00:59 upstream 76bb8b05960c ae13a849 .config console log report
ci-upstream-kasan-gce 2019/12/04 00:47 upstream 76bb8b05960c ae13a849 .config console log report
ci-upstream-kasan-gce-selinux-root 2019/12/03 23:29 upstream 76bb8b05960c ae13a849 .config console log report
ci-upstream-kasan-gce-selinux-root 2019/12/03 14:33 upstream 76bb8b05960c ab342da3 .config console log report
ci-upstream-kasan-gce-root 2019/12/03 07:19 upstream 596cf45cbf6e ab342da3 .config console log report
ci-upstream-kasan-gce-selinux-root 2019/12/03 00:20 upstream 596cf45cbf6e ab342da3 .config console log report
* Struck through repros no longer work on HEAD.