bisecting fixing commit since e0f8b8a65a473a8baa439cf865a694bbeb83fe90 building syzkaller on 084454aecdedb02f8bc64dc31c39a4d02e3be0ba testing commit e0f8b8a65a473a8baa439cf865a694bbeb83fe90 with gcc (GCC) 8.1.0 kernel signature: cbf1e359446d9dbfae382e8d20130a945418ba7d7964ec16c13e2a3585284cdc all runs: crashed: KASAN: use-after-free Read in disk_unblock_events testing current HEAD 050272a0423e68207fd2367831ae610680129062 testing commit 050272a0423e68207fd2367831ae610680129062 with gcc (GCC) 8.1.0 kernel signature: 8663701859b920aa4cdce06eb212fb2ea61da5ac0512b0942244d3f2ec2f6bb8 all runs: crashed: KASAN: use-after-free Read in disk_unblock_events revisions tested: 2, total time: 25m50.205270744s (build: 17m28.214497583s, test: 6m53.947132607s) the crash still happens on HEAD commit msg: Linux 4.14.177 crash: KASAN: use-after-free Read in disk_unblock_events NOHZ: local_softirq_pending 08 ================================================================== BUG: KASAN: use-after-free in disk_unblock_events+0x42/0x50 block/genhd.c:1644 Read of size 8 at addr ffff888095154e88 by task systemd-udevd/8066 CPU: 0 PID: 8066 Comm: systemd-udevd Not tainted 4.14.177-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:888 do_last fs/namei.c:3428 [inline] path_openat+0xdde/0x3bd0 fs/namei.c:3569 do_filp_open+0x16b/0x220 fs/namei.c:3603 do_sys_open+0x1c2/0x340 fs/open.c:1081 SYSC_open fs/open.c:1099 [inline] SyS_open+0x19/0x20 fs/open.c:1094 do_syscall_64+0x1c7/0x5b0 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x42/0xb7 RIP: 0033:0x7fe128a76840 RSP: 002b:00007ffcedb2b6d8 EFLAGS: 00000246 ORIG_RAX: 0000000000000002 RAX: ffffffffffffffda RBX: 000055678cea9ef0 RCX: 00007fe128a76840 RDX: 000055678c70cfe3 RSI: 00000000000a0800 RDI: 000055678cea0890 RBP: 00007ffcedb2b850 R08: 000055678c70c670 R09: 0000000000000010 R10: 000055678c70cd0c R11: 0000000000000246 R12: 00007ffcedb2b7a0 R13: 000055678cea9600 R14: 0000000000000003 R15: 000000000000000e Allocated by task 10686: 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_probe+0x133/0x160 drivers/block/loop.c:1976 kobj_lookup+0x20a/0x410 drivers/base/map.c:124 get_gendisk+0x2d/0x1d0 block/genhd.c:785 __blkdev_get+0x382/0x1030 fs/block_dev.c:1451 blkdev_get+0x3f0/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:888 do_last fs/namei.c:3428 [inline] path_openat+0xdde/0x3bd0 fs/namei.c:3569 do_filp_open+0x16b/0x220 fs/namei.c:3603 do_sys_open+0x1c2/0x340 fs/open.c:1081 SYSC_open fs/open.c:1099 [inline] SyS_open+0x19/0x20 fs/open.c:1094 do_syscall_64+0x1c7/0x5b0 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x42/0xb7 Freed by task 8066: 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+0x10d/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:888 do_last fs/namei.c:3428 [inline] path_openat+0xdde/0x3bd0 fs/namei.c:3569 do_filp_open+0x16b/0x220 fs/namei.c:3603 do_sys_open+0x1c2/0x340 fs/open.c:1081 SYSC_open fs/open.c:1099 [inline] SyS_open+0x19/0x20 fs/open.c:1094 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 ffff888095154900 which belongs to the cache kmalloc-2048 of size 2048 The buggy address is located 1416 bytes inside of 2048-byte region [ffff888095154900, ffff888095155100) The buggy address belongs to the page: page:ffffea0002545500 count:1 mapcount:0 mapping:ffff888095154080 index:0x0 compound_mapcount: 0 flags: 0xfffe0000008100(slab|head) raw: 00fffe0000008100 ffff888095154080 0000000000000000 0000000100000003 raw: ffffea00025fb1a0 ffffea0002533e20 ffff8880aa800c40 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff888095154d80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888095154e00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff888095154e80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888095154f00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888095154f80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================