bisecting fixing commit since 174651bdf802a2139065e8e31ce950e2f3fc4a94 building syzkaller on ab342da3f9aa45e3f2d9e872576ab5cd3e3c350b testing commit 174651bdf802a2139065e8e31ce950e2f3fc4a94 with gcc (GCC) 8.1.0 kernel signature: e4e90a61cc933f2f6c5d29813b50a83be7c2e0cd run #0: crashed: KASAN: use-after-free Write in release_tty run #1: crashed: KASAN: use-after-free Read in tty_open run #2: crashed: KASAN: use-after-free Read in tty_open run #3: crashed: KASAN: use-after-free Read in tty_open run #4: crashed: KASAN: use-after-free Write in release_tty run #5: crashed: KASAN: use-after-free Write in release_tty run #6: crashed: KASAN: use-after-free Read in tty_open run #7: crashed: KASAN: use-after-free Read in tty_open run #8: crashed: KASAN: use-after-free Read in tty_open run #9: crashed: KASAN: use-after-free Read in tty_open testing current HEAD c7ecf3e3a71c216327980f26b1e895ce9b07ad31 testing commit c7ecf3e3a71c216327980f26b1e895ce9b07ad31 with gcc (GCC) 8.1.0 kernel signature: bfe193a112303c7ea30b415146db06744545b064 run #0: crashed: KASAN: use-after-free Read in tty_open run #1: crashed: KASAN: use-after-free Read in tty_open run #2: crashed: KASAN: use-after-free Read in tty_open run #3: crashed: KASAN: use-after-free Read in tty_open run #4: crashed: KASAN: use-after-free Read in tty_open run #5: crashed: KASAN: use-after-free Read in tty_open run #6: crashed: KASAN: use-after-free Write in release_tty run #7: crashed: KASAN: use-after-free Read in tty_open run #8: crashed: KASAN: use-after-free Write in release_tty run #9: crashed: KASAN: use-after-free Write in release_tty revisions tested: 2, total time: 26m33.176582512s (build: 17m22.989591392s, test: 8m3.735322608s) the crash still happens on HEAD commit msg: Linux 4.19.92 crash: KASAN: use-after-free Write in release_tty ================================================================== BUG: KASAN: use-after-free in con_shutdown+0x76/0x80 drivers/tty/vt/vt.c:3253 Write of size 8 at addr ffff88807c7e6208 by task syz-executor.4/23659 CPU: 0 PID: 23659 Comm: syz-executor.4 Not tainted 4.19.92-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+0x123/0x177 lib/dump_stack.c:118 print_address_description.cold.8+0x9/0x1ff mm/kasan/report.c:256 kasan_report_error mm/kasan/report.c:354 [inline] kasan_report.cold.9+0x242/0x309 mm/kasan/report.c:412 __asan_report_store8_noabort+0x17/0x20 mm/kasan/report.c:438 con_shutdown+0x76/0x80 drivers/tty/vt/vt.c:3253 release_tty+0xb6/0x440 drivers/tty/tty_io.c:1509 tty_release_struct+0x33/0x50 drivers/tty/tty_io.c:1624 tty_release+0x97e/0xc60 drivers/tty/tty_io.c:1784 __fput+0x249/0x7f0 fs/file_table.c:278 ____fput+0x9/0x10 fs/file_table.c:309 task_work_run+0x108/0x180 kernel/task_work.c:113 tracehook_notify_resume include/linux/tracehook.h:193 [inline] exit_to_usermode_loop+0x1a9/0x200 arch/x86/entry/common.c:167 prepare_exit_to_usermode arch/x86/entry/common.c:198 [inline] syscall_return_slowpath arch/x86/entry/common.c:271 [inline] do_syscall_64+0x413/0x4e0 arch/x86/entry/common.c:296 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x414211 Code: 75 14 b8 03 00 00 00 0f 05 48 3d 01 f0 ff ff 0f 83 04 1b 00 00 c3 48 83 ec 08 e8 0a fc ff ff 48 89 04 24 b8 03 00 00 00 0f 05 <48> 8b 3c 24 48 89 c2 e8 53 fc ff ff 48 89 d0 48 83 c4 08 48 3d 01 RSP: 002b:00007ffd1f573470 EFLAGS: 00000293 ORIG_RAX: 0000000000000003 RAX: 0000000000000000 RBX: 0000000000000004 RCX: 0000000000414211 RDX: 0000000000000001 RSI: 0000000000000000 RDI: 0000000000000003 RBP: 0000000000000000 R08: ffffffffffffffff R09: ffffffffffffffff R10: 00007ffd1f573550 R11: 0000000000000293 R12: 000000000075bfc8 R13: 000000000001d17f R14: 00000000007601a0 R15: 000000000075bfd4 Allocated by task 23144: save_stack+0x43/0xd0 mm/kasan/kasan.c:448 set_track mm/kasan/kasan.c:460 [inline] kasan_kmalloc+0xc7/0xe0 mm/kasan/kasan.c:553 kmem_cache_alloc_trace+0x152/0x740 mm/slab.c:3625 kmalloc include/linux/slab.h:515 [inline] kzalloc include/linux/slab.h:709 [inline] vc_allocate+0x1c0/0x6f0 drivers/tty/vt/vt.c:1088 con_install+0x4d/0x410 drivers/tty/vt/vt.c:3204 tty_driver_install_tty drivers/tty/tty_io.c:1226 [inline] tty_init_dev+0xdb/0x3c0 drivers/tty/tty_io.c:1339 tty_open_by_driver drivers/tty/tty_io.c:1981 [inline] tty_open+0x523/0x990 drivers/tty/tty_io.c:2029 chrdev_open+0x1ed/0x5c0 fs/char_dev.c:423 do_dentry_open+0x3f1/0x1010 fs/open.c:796 vfs_open+0x9a/0xc0 fs/open.c:905 do_last fs/namei.c:3418 [inline] path_openat+0x691/0x3c00 fs/namei.c:3534 do_filp_open+0x177/0x250 fs/namei.c:3564 do_sys_open+0x1dd/0x350 fs/open.c:1088 __do_sys_open fs/open.c:1106 [inline] __se_sys_open fs/open.c:1101 [inline] __x64_sys_open+0x79/0xb0 fs/open.c:1101 do_syscall_64+0xd0/0x4e0 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe Freed by task 23667: save_stack+0x43/0xd0 mm/kasan/kasan.c:448 set_track mm/kasan/kasan.c:460 [inline] __kasan_slab_free+0x102/0x150 mm/kasan/kasan.c:521 kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528 __cache_free mm/slab.c:3503 [inline] kfree+0xcf/0x220 mm/slab.c:3822 vt_disallocate_all+0x247/0x3f0 drivers/tty/vt/vt_ioctl.c:323 vt_ioctl+0x186f/0x2130 drivers/tty/vt/vt_ioctl.c:816 tty_ioctl+0x452/0x1290 drivers/tty/tty_io.c:2669 vfs_ioctl fs/ioctl.c:46 [inline] file_ioctl fs/ioctl.c:501 [inline] do_vfs_ioctl+0x196/0x10c0 fs/ioctl.c:688 ksys_ioctl+0x62/0x90 fs/ioctl.c:705 __do_sys_ioctl fs/ioctl.c:712 [inline] __se_sys_ioctl fs/ioctl.c:710 [inline] __x64_sys_ioctl+0x6e/0xb0 fs/ioctl.c:710 do_syscall_64+0xd0/0x4e0 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe The buggy address belongs to the object at ffff88807c7e6100 which belongs to the cache kmalloc-2048 of size 2048 The buggy address is located 264 bytes inside of 2048-byte region [ffff88807c7e6100, ffff88807c7e6900) The buggy address belongs to the page: page:ffffea0001f1f980 count:1 mapcount:0 mapping:ffff88812c29cc40 index:0x0 compound_mapcount: 0 flags: 0xfffe0000008100(slab|head) raw: 00fffe0000008100 ffffea0001cb3b88 ffffea00027c9288 ffff88812c29cc40 raw: 0000000000000000 ffff88807c7e6100 0000000100000003 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff88807c7e6100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88807c7e6180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88807c7e6200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88807c7e6280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88807c7e6300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================