bisecting fixing commit since ddef1e8e3f6eb26034833b7255e3fa584d54a230 building syzkaller on af5c522d02400b35a930d6fbdf286f9ce2afc8ba testing commit ddef1e8e3f6eb26034833b7255e3fa584d54a230 with gcc (GCC) 8.1.0 kernel signature: 6c7fcd9dcc9a74572a155793ea5586d4ebc794559b68d4844be0d595ae09cade run #0: crashed: WARNING: bad unlock balance detected! run #1: crashed: KASAN: use-after-free Read in relay_switch_subbuf run #2: crashed: KASAN: use-after-free Read in relay_switch_subbuf run #3: crashed: KASAN: use-after-free Read in relay_switch_subbuf run #4: crashed: KASAN: use-after-free Read in relay_switch_subbuf run #5: crashed: KASAN: use-after-free Read in relay_switch_subbuf run #6: crashed: KASAN: use-after-free Read in relay_switch_subbuf run #7: crashed: KASAN: use-after-free Read in relay_switch_subbuf run #8: crashed: KASAN: use-after-free Read in debugfs_remove run #9: crashed: KASAN: use-after-free Read in relay_switch_subbuf testing current HEAD 98db2bf27b9ed2d5ed0b6c9c8a4bfcb127a19796 testing commit 98db2bf27b9ed2d5ed0b6c9c8a4bfcb127a19796 with gcc (GCC) 8.1.0 kernel signature: 1335876d26a6bdbab1a6985c85fa882c0fe247c1e0d76d0fc25118d5af811334 run #0: crashed: KASAN: use-after-free Read in relay_switch_subbuf run #1: crashed: KASAN: use-after-free Read in relay_switch_subbuf run #2: crashed: general protection fault in relay_open_buf run #3: crashed: KASAN: use-after-free Read in relay_switch_subbuf run #4: crashed: KASAN: use-after-free Read in relay_switch_subbuf run #5: crashed: KASAN: use-after-free Read in relay_switch_subbuf run #6: crashed: KASAN: use-after-free Read in relay_switch_subbuf run #7: crashed: KASAN: use-after-free Read in relay_switch_subbuf run #8: crashed: KASAN: use-after-free Read in relay_switch_subbuf run #9: crashed: KASAN: use-after-free Read in disk_unblock_events revisions tested: 2, total time: 25m37.194835814s (build: 17m55.071973404s, test: 7m6.699749947s) the crash still happens on HEAD commit msg: Linux 4.14.171 crash: KASAN: use-after-free Read in disk_unblock_events devpts: called with bogus options devpts: called with bogus options devpts: called with bogus options ================================================================== devpts: called with bogus options BUG: KASAN: use-after-free in disk_unblock_events+0x42/0x50 block/genhd.c:1644 Read of size 8 at addr ffff8880889b4988 by task blkid/8611 CPU: 0 PID: 8611 Comm: blkid Not tainted 4.14.171-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 disk_unblock_events+0x42/0x50 block/genhd.c:1644 __blkdev_get+0x738/0x1030 fs/block_dev.c:1556 blkdev_get+0x26d/0x860 fs/block_dev.c:1612 blkdev_open+0x19f/0x200 fs/block_dev.c:1770 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:0x7fc7f74e4120 RSP: 002b:00007ffdd6d109c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000002 RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fc7f74e4120 RDX: 00007ffdd6d11f45 RSI: 0000000000000000 RDI: 00007ffdd6d11f45 RBP: 0000000000000000 R08: 0000000000000078 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000001466030 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000005 Allocated by task 8595: 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_node_trace+0x14c/0x780 mm/slab.c:3661 kmalloc_node include/linux/slab.h:526 [inline] kzalloc_node include/linux/slab.h:672 [inline] alloc_disk_node+0x5e/0x380 block/genhd.c:1387 alloc_disk+0xe/0x10 block/genhd.c:1371 loop_add+0x3a8/0x810 drivers/block/loop.c:1869 loop_control_ioctl+0x1c9/0x2b0 drivers/block/loop.c:2027 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 Freed by task 8611: 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 disk_release+0x215/0x290 block/genhd.c:1230 device_release+0xd7/0x170 drivers/base/core.c:831 kobject_cleanup lib/kobject.c:646 [inline] kobject_release lib/kobject.c:675 [inline] kref_put include/linux/kref.h:70 [inline] kobject_put+0x10e/0x1b0 lib/kobject.c:692 put_disk+0x15/0x20 block/genhd.c:1452 __blkdev_get+0x6a5/0x1030 fs/block_dev.c:1549 blkdev_get+0x26d/0x860 fs/block_dev.c:1612 blkdev_open+0x19f/0x200 fs/block_dev.c:1770 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 The buggy address belongs to the object at ffff8880889b4400 which belongs to the cache kmalloc-2048 of size 2048 The buggy address is located 1416 bytes inside of 2048-byte region [ffff8880889b4400, ffff8880889b4c00) The buggy address belongs to the page: page:ffffea0002226d00 count:1 mapcount:0 mapping:ffff8880889b4400 index:0x0 compound_mapcount: 0 flags: 0x1fffc0000008100(slab|head) raw: 01fffc0000008100 ffff8880889b4400 0000000000000000 0000000100000003 raw: ffffea0002a0b920 ffffea00029ca0a0 ffff8880aa800c40 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8880889b4880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880889b4900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8880889b4980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8880889b4a00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880889b4a80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== devpts: called with bogus options devpts: called with bogus options devpts: called with bogus options