Still happens on commit 0710f3ff91ecc4a715db6e4d0690472b13c4dac6:
BUG: KASAN: use-after-free in irq_bypass_register_consumer+0x4cb/0x4e0
virt/lib/irqbypass.c:198 at addr ffff88006777ddf8
Read of size 8 by task a.out/15766
CPU: 2 PID: 15766 Comm: a.out Not tainted 4.10.0+ #285
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
Call Trace:
__dump_stack lib/dump_stack.c:16 [inline]
dump_stack+0x2fb/0x3fd lib/dump_stack.c:52
kasan_object_err+0x1c/0x70 mm/kasan/report.c:166
print_address_description mm/kasan/report.c:204 [inline]
kasan_report_error mm/kasan/report.c:288 [inline]
kasan_report.part.2+0x1b0/0x460 mm/kasan/report.c:310
kasan_report mm/kasan/report.c:331 [inline]
__asan_report_load8_noabort+0x29/0x30 mm/kasan/report.c:331
irq_bypass_register_consumer+0x4cb/0x4e0 virt/lib/irqbypass.c:198
kvm_irqfd_assign arch/x86/kvm/../../../virt/kvm/eventfd.c:417 [inline]
kvm_irqfd+0x137d/0x1e20 arch/x86/kvm/../../../virt/kvm/eventfd.c:578
kvm_vm_ioctl+0x108c/0x1d70 arch/x86/kvm/../../../virt/kvm/kvm_main.c:3011
vfs_ioctl fs/ioctl.c:45 [inline]
do_vfs_ioctl+0x1bf/0x1790 fs/ioctl.c:685
SYSC_ioctl fs/ioctl.c:700 [inline]
SyS_ioctl+0x8f/0xc0 fs/ioctl.c:691
entry_SYSCALL_64_fastpath+0x1f/0xc2
RIP: 0033:0x4402b9
RSP: 002b:00007fb73c4f9d98 EFLAGS: 00000297 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00000000004402b9
RDX: 0000000020ae3000 RSI: 000000004020ae76 RDI: 0000000000000008
RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000297 R12: 0000000000000000
R13: 0000000000000000 R14: 00007fb73c4fa9c0 R15: 00007fb73c4fa700
Object at ffff88006777dc80, in cache kmalloc-512 size: 512
Allocated:
PID = 15766
save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
save_stack+0x43/0xd0 mm/kasan/kasan.c:513
set_track mm/kasan/kasan.c:525 [inline]
kasan_kmalloc+0xaa/0xd0 mm/kasan/kasan.c:616
kmem_cache_alloc_trace+0x10b/0x6e0 mm/slab.c:3638
kmalloc include/linux/slab.h:490 [inline]
kzalloc include/linux/slab.h:663 [inline]
kvm_irqfd_assign arch/x86/kvm/../../../virt/kvm/eventfd.c:296 [inline]
kvm_irqfd+0x16f/0x1e20 arch/x86/kvm/../../../virt/kvm/eventfd.c:578
kvm_vm_ioctl+0x108c/0x1d70 arch/x86/kvm/../../../virt/kvm/kvm_main.c:3011
vfs_ioctl fs/ioctl.c:45 [inline]
do_vfs_ioctl+0x1bf/0x1790 fs/ioctl.c:685
SYSC_ioctl fs/ioctl.c:700 [inline]
SyS_ioctl+0x8f/0xc0 fs/ioctl.c:691
entry_SYSCALL_64_fastpath+0x1f/0xc2
Freed:
PID = 670
save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
save_stack+0x43/0xd0 mm/kasan/kasan.c:513
set_track mm/kasan/kasan.c:525 [inline]
kasan_slab_free+0x6f/0xb0 mm/kasan/kasan.c:589
__cache_free mm/slab.c:3514 [inline]
kfree+0xd3/0x250 mm/slab.c:3831
irqfd_shutdown+0x150/0x1c0 arch/x86/kvm/../../../virt/kvm/eventfd.c:148
process_one_work+0xc06/0x1c40 kernel/workqueue.c:2096
worker_thread+0x223/0x19f0 kernel/workqueue.c:2230
kthread+0x334/0x400 kernel/kthread.c:229
ret_from_fork+0x31/0x40 arch/x86/entry/entry_64.S:430
Memory state around the buggy address:
ffff88006777dc80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88006777dd00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88006777dd80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff88006777de00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88006777de80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================
Here is correct link for reproducer program:
https://gist.githubusercontent.com/dvyukov/34114444518fa22baff19ae204cc46a6/raw/7826cbcd1cbc472dfa4972fe56371df3c94b70c7/gistfile1.txt