bisecting fixing commit since fbc5fe7a54d02e11972e3b2a5ddb6ffc88162c8f building syzkaller on ab342da3f9aa45e3f2d9e872576ab5cd3e3c350b testing commit fbc5fe7a54d02e11972e3b2a5ddb6ffc88162c8f with gcc (GCC) 8.1.0 kernel signature: 67f78252608e20ffababc7f5a628107a762d48a850c9ad1e2e6372a067a47ac0 run #0: crashed: KASAN: use-after-free Read in tty_open run #1: crashed: KASAN: use-after-free Write in release_tty run #2: crashed: KASAN: use-after-free Write in release_tty run #3: crashed: KASAN: use-after-free Write in release_tty 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 Write in release_tty run #7: crashed: KASAN: use-after-free Write in release_tty run #8: crashed: KASAN: use-after-free Write in release_tty run #9: crashed: KASAN: use-after-free Write in release_tty testing current HEAD e0f8b8a65a473a8baa439cf865a694bbeb83fe90 testing commit e0f8b8a65a473a8baa439cf865a694bbeb83fe90 with gcc (GCC) 8.1.0 kernel signature: e183cd41f585a8d46b660c8572bd2b929385218232d6d4ab892ab3dae663afc0 run #0: crashed: KASAN: use-after-free Write in release_tty run #1: crashed: KASAN: use-after-free Write in release_tty run #2: crashed: KASAN: use-after-free Write in release_tty run #3: crashed: KASAN: use-after-free Write in release_tty 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 Write in release_tty run #7: crashed: KASAN: use-after-free Write in release_tty run #8: crashed: KASAN: use-after-free Write in release_tty run #9: crashed: KASAN: use-after-free Read in tty_open revisions tested: 2, total time: 24m32.871702372s (build: 17m8.50603974s, test: 6m29.282803548s) the crash still happens on HEAD commit msg: Linux 4.14.170 crash: KASAN: use-after-free Read in tty_open IPv6: ADDRCONF(NETDEV_UP): vxcan1: link is not ready IPv6: ADDRCONF(NETDEV_CHANGE): vxcan1: link becomes ready IPv6: ADDRCONF(NETDEV_CHANGE): vxcan0: link becomes ready 8021q: adding VLAN 0 to HW filter on device batadv0 ================================================================== BUG: KASAN: use-after-free in constant_test_bit arch/x86/include/asm/bitops.h:325 [inline] BUG: KASAN: use-after-free in tty_port_kopened include/linux/tty.h:671 [inline] BUG: KASAN: use-after-free in tty_open_by_driver drivers/tty/tty_io.c:1952 [inline] BUG: KASAN: use-after-free in tty_open+0x920/0x970 drivers/tty/tty_io.c:2021 Read of size 8 at addr ffff888078b22280 by task syz-executor.2/7342 CPU: 1 PID: 7342 Comm: syz-executor.2 Not tainted 4.14.170-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:17 [inline] dump_stack+0xf7/0x13b lib/dump_stack.c:58 print_address_description.cold.7+0x9/0x1c9 mm/kasan/report.c:252 kasan_report_error mm/kasan/report.c:351 [inline] kasan_report.cold.8+0x11a/0x2d3 mm/kasan/report.c:409 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:430 constant_test_bit arch/x86/include/asm/bitops.h:325 [inline] tty_port_kopened include/linux/tty.h:671 [inline] tty_open_by_driver drivers/tty/tty_io.c:1952 [inline] tty_open+0x920/0x970 drivers/tty/tty_io.c:2021 chrdev_open+0x1e9/0x5b0 fs/char_dev.c:423 do_dentry_open+0x620/0xdb0 fs/open.c:777 vfs_open+0xfc/0x240 fs/open.c:891 do_last fs/namei.c:3428 [inline] path_openat+0xdde/0x3be0 fs/namei.c:3569 do_filp_open+0x16b/0x220 fs/namei.c:3603 do_sys_open+0x1c2/0x340 fs/open.c:1084 SYSC_open fs/open.c:1102 [inline] SyS_open+0x19/0x20 fs/open.c:1097 do_syscall_64+0x1c7/0x5b0 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x42/0xb7 RIP: 0033:0x414411 RSP: 002b:00007f0960e8e7a0 EFLAGS: 00000293 ORIG_RAX: 0000000000000002 RAX: ffffffffffffffda RBX: 6666666666666667 RCX: 0000000000414411 RDX: 0000000000000000 RSI: 0000000000127200 RDI: 00007f0960e8e850 RBP: 000000000075bf20 R08: 000000000000000f R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000293 R12: 00007f0960e8f6d4 R13: 00000000004cae23 R14: 00000000004e4318 R15: 00000000ffffffff Allocated by task 7347: save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59 save_stack+0x43/0xd0 mm/kasan/kasan.c:447 set_track mm/kasan/kasan.c:459 [inline] kasan_kmalloc+0xc7/0xe0 mm/kasan/kasan.c:551 kmem_cache_alloc_trace+0x152/0x7a0 mm/slab.c:3618 kmalloc include/linux/slab.h:488 [inline] kzalloc include/linux/slab.h:661 [inline] vc_allocate+0x145/0x590 drivers/tty/vt/vt.c:772 con_install+0x4d/0x410 drivers/tty/vt/vt.c:2881 tty_driver_install_tty drivers/tty/tty_io.c:1225 [inline] tty_init_dev+0xdb/0x350 drivers/tty/tty_io.c:1338 tty_open_by_driver drivers/tty/tty_io.c:1973 [inline] tty_open+0x50a/0x970 drivers/tty/tty_io.c:2021 chrdev_open+0x1e9/0x5b0 fs/char_dev.c:423 do_dentry_open+0x620/0xdb0 fs/open.c:777 vfs_open+0xfc/0x240 fs/open.c:891 do_last fs/namei.c:3428 [inline] path_openat+0xdde/0x3be0 fs/namei.c:3569 do_filp_open+0x16b/0x220 fs/namei.c:3603 do_sys_open+0x1c2/0x340 fs/open.c:1084 SYSC_open fs/open.c:1102 [inline] SyS_open+0x19/0x20 fs/open.c:1097 do_syscall_64+0x1c7/0x5b0 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x42/0xb7 Freed by task 7346: save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59 save_stack+0x43/0xd0 mm/kasan/kasan.c:447 set_track mm/kasan/kasan.c:459 [inline] kasan_slab_free+0x71/0xc0 mm/kasan/kasan.c:524 __cache_free mm/slab.c:3496 [inline] kfree+0xcc/0x270 mm/slab.c:3815 vt_disallocate_all+0x23b/0x3c0 drivers/tty/vt/vt_ioctl.c:323 vt_ioctl+0x1a1f/0x21d0 drivers/tty/vt/vt_ioctl.c:816 tty_ioctl+0x434/0x1260 drivers/tty/tty_io.c:2661 vfs_ioctl fs/ioctl.c:46 [inline] file_ioctl fs/ioctl.c:500 [inline] do_vfs_ioctl+0x180/0xfb0 fs/ioctl.c:684 SYSC_ioctl fs/ioctl.c:701 [inline] SyS_ioctl+0x74/0x80 fs/ioctl.c:692 do_syscall_64+0x1c7/0x5b0 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x42/0xb7 The buggy address belongs to the object at ffff888078b22080 which belongs to the cache kmalloc-2048 of size 2048 The buggy address is located 512 bytes inside of 2048-byte region [ffff888078b22080, ffff888078b22880) The buggy address belongs to the page: page:ffffea0001e2c880 count:1 mapcount:0 mapping:ffff888078b22080 index:0x0 compound_mapcount: 0 flags: 0xfffe0000008100(slab|head) raw: 00fffe0000008100 ffff888078b22080 0000000000000000 0000000100000003 raw: ffffea0002004420 ffffea00024e31a0 ffff8880aa800c40 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff888078b22180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888078b22200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff888078b22280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888078b22300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888078b22380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================