bisecting fixing commit since e0f8b8a65a473a8baa439cf865a694bbeb83fe90 building syzkaller on 084454aecdedb02f8bc64dc31c39a4d02e3be0ba testing commit e0f8b8a65a473a8baa439cf865a694bbeb83fe90 with gcc (GCC) 8.1.0 kernel signature: 6a6e97c80eb276729cdde623e05677990819e7de0fc3ade0c36baad0dbf77dec all runs: crashed: KASAN: use-after-free Read in disk_unblock_events testing current HEAD 5b7a52cd2eef952cee8a72512ef370bcdef46636 testing commit 5b7a52cd2eef952cee8a72512ef370bcdef46636 with gcc (GCC) 8.1.0 kernel signature: edfda2a6b3c962a43affa1860fa0b40a96e3586c8252cc52c16b622b345175e5 all runs: crashed: KASAN: use-after-free Read in disk_unblock_events revisions tested: 2, total time: 25m23.098366683s (build: 17m58.772729825s, test: 6m2.841656835s) the crash still happens on HEAD commit msg: Linux 4.14.202 crash: KASAN: use-after-free Read in disk_unblock_events batman_adv: batadv0: Interface activated: batadv_slave_1 IPv6: ADDRCONF(NETDEV_CHANGE): batadv_slave_1: link becomes ready IPv6: ADDRCONF(NETDEV_CHANGE): veth1_to_batadv: link becomes ready ================================================================== BUG: KASAN: use-after-free in disk_unblock_events+0x42/0x50 block/genhd.c:1644 Read of size 8 at addr ffff8880a8d989c8 by task systemd-udevd/3636 CPU: 0 PID: 3636 Comm: systemd-udevd Not tainted 4.14.202-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+0x6bd/0x1020 fs/block_dev.c:1556 blkdev_get+0x265/0x890 fs/block_dev.c:1611 blkdev_open+0x19f/0x200 fs/block_dev.c:1772 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+0x46/0xbb RIP: 0033:0x7fa7cbbf1840 RSP: 002b:00007fffa9d45308 EFLAGS: 00000246 ORIG_RAX: 0000000000000002 RAX: ffffffffffffffda RBX: 00007fffa9d453a0 RCX: 00007fa7cbbf1840 RDX: 000055ee51032fe3 RSI: 00000000000a0800 RDI: 000055ee52cdb760 RBP: 00007fffa9d45900 R08: 000055ee51032670 R09: 0000000000000010 R10: 0000000000000000 R11: 0000000000000246 R12: 00007fffa9d454b0 R13: 000055ee52c17a60 R14: 000055ee52cfae40 R15: 00007fffa9d45380 Allocated by task 8958: 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+0x3a9/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/0x1020 fs/block_dev.c:1449 blkdev_get+0x417/0x890 fs/block_dev.c:1611 blkdev_open+0x19f/0x200 fs/block_dev.c:1772 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+0x46/0xbb Freed by task 3636: 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+0x62a/0x1020 fs/block_dev.c:1549 blkdev_get+0x265/0x890 fs/block_dev.c:1611 blkdev_open+0x19f/0x200 fs/block_dev.c:1772 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+0x46/0xbb The buggy address belongs to the object at ffff8880a8d98440 which belongs to the cache kmalloc-2048 of size 2048 The buggy address is located 1416 bytes inside of 2048-byte region [ffff8880a8d98440, ffff8880a8d98c40) The buggy address belongs to the page: page:ffffea0002a36600 count:1 mapcount:0 mapping:ffff8880a8d98440 index:0x0 compound_mapcount: 0 flags: 0xfffe0000008100(slab|head) raw: 00fffe0000008100 ffff8880a8d98440 0000000000000000 0000000100000003 raw: ffffea00020a02a0 ffffea0002a7eca0 ffff8880aa800c40 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8880a8d98880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880a8d98900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8880a8d98980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8880a8d98a00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880a8d98a80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================