bisecting fixing commit since b94de4d19498b454645b72d08a05d32fa9074fb5 building syzkaller on cba33199be220cbf61f7c0c8223d88a25a913d6f testing commit b94de4d19498b454645b72d08a05d32fa9074fb5 compiler: gcc version 8.4.1 20210217 (GCC) kernel signature: e95d3696aa3fff3da8d6605f6ff757db1fd255cf761487d365eddb70e6fa6f88 all runs: crashed: KASAN: use-after-free Read in kvm_vm_ioctl_unregister_coalesced_mmio testing current HEAD 53bd76690e27f37c9df221a651a52cea04214da9 testing commit 53bd76690e27f37c9df221a651a52cea04214da9 compiler: gcc version 8.4.1 20210217 (GCC) kernel signature: 0cf8915d0e4e084501f3a796f68f26fd5720f6c5861e8e02870d7a91acfcd363 all runs: crashed: KASAN: use-after-free Read in kvm_vm_ioctl_unregister_coalesced_mmio revisions tested: 2, total time: 28m45.271920214s (build: 21m30.795413806s, test: 6m27.295995748s) the crash still happens on HEAD commit msg: Linux 4.19.200 crash: KASAN: use-after-free Read in kvm_vm_ioctl_unregister_coalesced_mmio R13: 00007ffe70e5a17f R14: 00007fe6fe106300 R15: 0000000000022000 kvm: failed to shrink bus, removing it completely batman_adv: batadv0: Interface activated: batadv_slave_0 ================================================================== batman_adv: The newly added mac address (aa:aa:aa:aa:aa:3e) already exists on: batadv_slave_1 BUG: KASAN: use-after-free in kvm_vm_ioctl_unregister_coalesced_mmio+0x1f2/0x2a0 arch/x86/kvm/../../../virt/kvm/coalesced_mmio.c:178 Read of size 8 at addr ffff8881f2c5d900 by task syz-executor.2/9170 batman_adv: It is strongly recommended to keep mac addresses unique to avoid problems! CPU: 0 PID: 9170 Comm: syz-executor.2 Not tainted 4.19.200-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+0x17c/0x226 lib/dump_stack.c:118 print_address_description.cold.6+0x9/0x211 mm/kasan/report.c:256 batman_adv: The newly added mac address (aa:aa:aa:aa:aa:3e) already exists on: batadv_slave_1 kasan_report_error mm/kasan/report.c:354 [inline] kasan_report mm/kasan/report.c:412 [inline] kasan_report.cold.7+0x242/0x2fe mm/kasan/report.c:396 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:433 batman_adv: It is strongly recommended to keep mac addresses unique to avoid problems! kvm_vm_ioctl_unregister_coalesced_mmio+0x1f2/0x2a0 arch/x86/kvm/../../../virt/kvm/coalesced_mmio.c:178 kvm_vm_ioctl+0x5ac/0x1770 arch/x86/kvm/../../../virt/kvm/kvm_main.c:3275 batman_adv: The newly added mac address (aa:aa:aa:aa:aa:3e) already exists on: batadv_slave_1 batman_adv: It is strongly recommended to keep mac addresses unique to avoid problems! vfs_ioctl fs/ioctl.c:46 [inline] file_ioctl fs/ioctl.c:501 [inline] do_vfs_ioctl+0x196/0x10c0 fs/ioctl.c:688 batman_adv: The newly added mac address (aa:aa:aa:aa:aa:3e) already exists on: batadv_slave_1 batman_adv: It is strongly recommended to keep mac addresses unique to avoid problems! 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 batman_adv: The newly added mac address (aa:aa:aa:aa:aa:3e) already exists on: batadv_slave_1 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x465889 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fe6fe106188 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 000000000055bf00 RCX: 0000000000465889 RDX: 0000000020000180 RSI: 000000004010ae68 RDI: 0000000000000004 RBP: 00007fe6fe1061d0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001 R13: 00007ffe70e5a17f R14: 00007fe6fe106300 R15: 0000000000022000 Allocated by task 9170: save_stack mm/kasan/kasan.c:448 [inline] set_track mm/kasan/kasan.c:460 [inline] kasan_kmalloc.part.1+0x62/0xf0 mm/kasan/kasan.c:553 kasan_kmalloc+0xaf/0xc0 mm/kasan/kasan.c:538 kmem_cache_alloc_trace+0x152/0x3a0 mm/slab.c:3625 kmalloc include/linux/slab.h:515 [inline] kzalloc include/linux/slab.h:709 [inline] kvm_vm_ioctl_register_coalesced_mmio+0x4f/0x320 arch/x86/kvm/../../../virt/kvm/coalesced_mmio.c:146 kvm_vm_ioctl+0xa0e/0x1770 arch/x86/kvm/../../../virt/kvm/kvm_main.c:3266 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 Freed by task 9170: save_stack mm/kasan/kasan.c:448 [inline] set_track mm/kasan/kasan.c:460 [inline] __kasan_slab_free+0x13c/0x220 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 coalesced_mmio_destructor+0x100/0x150 arch/x86/kvm/../../../virt/kvm/coalesced_mmio.c:101 kvm_iodevice_destructor include/kvm/iodev.h:73 [inline] kvm_io_bus_unregister_dev.cold.38+0xbd/0x10e arch/x86/kvm/../../../virt/kvm/kvm_main.c:3898 kvm_vm_ioctl_unregister_coalesced_mmio+0x15b/0x2a0 arch/x86/kvm/../../../virt/kvm/coalesced_mmio.c:180 kvm_vm_ioctl+0x5ac/0x1770 arch/x86/kvm/../../../virt/kvm/kvm_main.c:3275 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 batman_adv: It is strongly recommended to keep mac addresses unique to avoid problems! 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 ffff8881f2c5d900 which belongs to the cache kmalloc-64 of size 64 The buggy address is located 0 bytes inside of 64-byte region [ffff8881f2c5d900, ffff8881f2c5d940) The buggy address belongs to the page: page:ffffea0007cb1740 count:1 mapcount:0 mapping:ffff8881f6000340 index:0x0 IPv6: ADDRCONF(NETDEV_UP): batadv_slave_1: link is not ready flags: 0x17ff00000000100(slab) raw: 017ff00000000100 ffffea0007cdaf08 ffffea0007cb2488 ffff8881f6000340 raw: 0000000000000000 ffff8881f2c5d000 0000000100000020 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8881f2c5d800: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc batman_adv: batadv0: Interface activated: batadv_slave_1 ffff8881f2c5d880: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc >ffff8881f2c5d900: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ^ ffff8881f2c5d980: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc ffff8881f2c5da00: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ================================================================== list_del corruption, ffff8881f2c5d900->prev is LIST_POISON2 (dead000000000200) FAULT_INJECTION: forcing a failure. name failslab, interval 1, probability 0, space 0, times 0 ------------[ cut here ]------------ Bluetooth: hci3: command 0x0419 tx timeout kernel BUG at lib/list_debug.c:50! CPU: 1 PID: 9180 Comm: syz-executor.0 Tainted: G B 4.19.200-syzkaller #0 invalid opcode: 0000 [#1] PREEMPT SMP KASAN Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 CPU: 0 PID: 9170 Comm: syz-executor.2 Tainted: G B 4.19.200-syzkaller #0 Call Trace: Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x17c/0x226 lib/dump_stack.c:118 RIP: 0010:__list_del_entry_valid.cold.1+0x12/0x4a lib/list_debug.c:48 fail_dump lib/fault-inject.c:51 [inline] should_fail.cold.2+0x5/0xa lib/fault-inject.c:149 Code: f7 ff 0f 0b 48 89 f1 48 c7 c7 40 21 50 88 48 89 de e8 86 fb f7 ff 0f 0b 4c 89 e2 48 89 de 48 c7 c7 80 22 50 88 e8 72 fb f7 ff <0f> 0b 4c 89 ea 48 89 de 48 c7 c7 20 22 50 88 e8 5e fb f7 ff 0f 0b RSP: 0018:ffff8881d19af958 EFLAGS: 00010282 RAX: 000000000000004e RBX: ffff8881f2c5d900 RCX: 0000000000000000 RDX: 0000000000000000 RSI: ffffffff88501f80 RDI: ffffffff8bad8720 __should_failslab+0xba/0xf0 mm/failslab.c:32 RBP: ffff8881d19af970 R08: ffffed103ec84e99 R09: ffffed103ec84e98 should_failslab+0x9/0x20 mm/slab_common.c:1590 R10: ffffed103ec84e98 R11: ffff8881f64274c7 R12: dead000000000200 slab_pre_alloc_hook mm/slab.h:424 [inline] slab_alloc mm/slab.c:3383 [inline] __do_kmalloc mm/slab.c:3725 [inline] __kmalloc+0x2b5/0x3d0 mm/slab.c:3736 R13: ffff8881f2c5db00 R14: ffff8881f2c5db00 R15: dffffc0000000000 FS: 00007fe6fe106700(0000) GS:ffff8881f6400000(0000) knlGS:0000000000000000 kmalloc include/linux/slab.h:520 [inline] kvm_io_bus_unregister_dev+0x116/0x2f0 arch/x86/kvm/../../../virt/kvm/kvm_main.c:3886 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 kvm_vm_ioctl_unregister_coalesced_mmio+0x15b/0x2a0 arch/x86/kvm/../../../virt/kvm/coalesced_mmio.c:180 CR2: 00007f6cae67a000 CR3: 00000001ec9a8004 CR4: 00000000001626f0 kvm_vm_ioctl+0x5ac/0x1770 arch/x86/kvm/../../../virt/kvm/kvm_main.c:3275 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: __list_del_entry include/linux/list.h:117 [inline] list_del include/linux/list.h:125 [inline] coalesced_mmio_destructor+0x1a/0x150 arch/x86/kvm/../../../virt/kvm/coalesced_mmio.c:99 kvm_iodevice_destructor include/kvm/iodev.h:73 [inline] kvm_vm_ioctl_unregister_coalesced_mmio+0x199/0x2a0 arch/x86/kvm/../../../virt/kvm/coalesced_mmio.c:181 kvm_vm_ioctl+0x5ac/0x1770 arch/x86/kvm/../../../virt/kvm/kvm_main.c:3275 vfs_ioctl fs/ioctl.c:46 [inline] file_ioctl fs/ioctl.c:501 [inline] do_vfs_ioctl+0x196/0x10c0 fs/ioctl.c:688 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 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_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 do_syscall_64+0xd0/0x4e0 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x465889 RIP: 0033:0x465889 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fe6fe106188 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RSP: 002b:00007f327f476188 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 000000000055bf00 RCX: 0000000000465889 RAX: ffffffffffffffda RBX: 000000000055bf00 RCX: 0000000000465889 RDX: 0000000020000180 RSI: 000000004010ae68 RDI: 0000000000000004 RBP: 00007fe6fe1061d0 R08: 0000000000000000 R09: 0000000000000000 RDX: 0000000020000180 RSI: 000000004010ae68 RDI: 0000000000000004 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001 RBP: 00007f327f4761d0 R08: 0000000000000000 R09: 0000000000000000 R13: 00007ffe70e5a17f R14: 00007fe6fe106300 R15: 0000000000022000 Modules linked in: R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001 ---[ end trace ab4c2d7891dcfddd ]--- R13: 00007ffebe64b01f R14: 00007f327f476300 R15: 0000000000022000 Bluetooth: hci0: command 0x0419 tx timeout RIP: 0010:__list_del_entry_valid.cold.1+0x12/0x4a lib/list_debug.c:48 Bluetooth: hci5: command 0x0419 tx timeout Code: f7 ff 0f 0b 48 89 f1 48 c7 c7 40 21 50 88 48 89 de e8 86 fb f7 ff 0f 0b 4c 89 e2 48 89 de 48 c7 c7 80 22 50 88 e8 72 fb f7 ff <0f> 0b 4c 89 ea 48 89 de 48 c7 c7 20 22 50 88 e8 5e fb f7 ff 0f 0b Bluetooth: hci1: command 0x0419 tx timeout RSP: 0018:ffff8881d19af958 EFLAGS: 00010282 Bluetooth: hci2: command 0x0419 tx timeout RAX: 000000000000004e RBX: ffff8881f2c5d900 RCX: 0000000000000000 IPv6: ADDRCONF(NETDEV_CHANGE): batadv_slave_0: link becomes ready IPv6: ADDRCONF(NETDEV_CHANGE): veth0_to_batadv: link becomes ready RDX: 0000000000000000 RSI: ffffffff88501f80 RDI: ffffffff8bad8720 IPv6: ADDRCONF(NETDEV_CHANGE): batadv_slave_1: link becomes ready RBP: ffff8881d19af970 R08: ffffed103ec84e99 R09: ffffed103ec84e98 IPv6: ADDRCONF(NETDEV_CHANGE): veth1_to_batadv: link becomes ready R10: ffffed103ec84e98 R11: ffff8881f64274c7 R12: dead000000000200 Bluetooth: hci4: command 0x0419 tx timeout R13: ffff8881f2c5db00 R14: ffff8881f2c5db00 R15: dffffc0000000000 ieee80211 phy8: Selected rate control algorithm 'minstrel_ht' FS: 00007fe6fe106700(0000) GS:ffff8881f6400000(0000) knlGS:0000000000000000 IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 kvm: failed to shrink bus, removing it completely CR2: 00007fff4cb10c8c CR3: 00000001ec9a8001 CR4: 00000000001626f0 ieee80211 phy9: Selected rate control algorithm 'minstrel_ht' wlan0: Created IBSS using preconfigured BSSID 50:50:50:50:50:50 list_del corruption, ffff8881f3d6fb80->prev is LIST_POISON2 (dead000000000200) wlan0: Creating new IBSS network, BSSID 50:50:50:50:50:50 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 ieee80211 phy10: Selected rate control algorithm 'minstrel_ht' DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 ------------[ cut here ]------------