kvm: use-after-free in irq_bypass_register_consumer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

The following program triggers use-after-free in irq_bypass_register_consumer:
https://bit.googleplex.com/raw/5875575541465088/5629499534213120/

BUG: KASAN: use-after-free in irq_bypass_register_consumer+0x48c/0x4c0
virt/lib/irqbypass.c:198 at addr ffff88006b74b438
Read of size 8 by task a.out/24723
CPU: 1 PID: 24723 Comm: a.out Not tainted 4.10.0-rc5+ #201
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:15 [inline]
 dump_stack+0x2ee/0x3ef lib/dump_stack.c:51
 kasan_object_err+0x1c/0x70 mm/kasan/report.c:165
 print_address_description mm/kasan/report.c:203 [inline]
 kasan_report_error+0x17b/0x430 mm/kasan/report.c:287
 kasan_report mm/kasan/report.c:307 [inline]
 __asan_report_load8_noabort+0x3e/0x40 mm/kasan/report.c:328
 irq_bypass_register_consumer+0x48c/0x4c0 virt/lib/irqbypass.c:198
 kvm_irqfd_assign arch/x86/kvm/../../../virt/kvm/eventfd.c:417 [inline]
 kvm_irqfd+0x130e/0x1e30 arch/x86/kvm/../../../virt/kvm/eventfd.c:578
 kvm_vm_ioctl+0x107a/0x1d10 arch/x86/kvm/../../../virt/kvm/kvm_main.c:3007
 vfs_ioctl fs/ioctl.c:43 [inline]
 do_vfs_ioctl+0x1bf/0x1790 fs/ioctl.c:683
 SYSC_ioctl fs/ioctl.c:698 [inline]
 SyS_ioctl+0x8f/0xc0 fs/ioctl.c:689
 entry_SYSCALL_64_fastpath+0x1f/0xc2
RIP: 0033:0x4402b9
RSP: 002b:00007f7f07514d98 EFLAGS: 00000297 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00000000004402b9
RDX: 0000000020ae3000 RSI: 000000004020ae76 RDI: 0000000000000007
RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000297 R12: 0000000000000000
R13: 0000000000000000 R14: 00007f7f075159c0 R15: 00007f7f07515700
Object at ffff88006b74b2c0, in cache kmalloc-512 size: 512
Allocated:
PID = 24723
[<ffffffff812b1506>] save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:57
[<ffffffff81a0cdd3>] save_stack+0x43/0xd0 mm/kasan/kasan.c:502
[<ffffffff81a0d09a>] set_track mm/kasan/kasan.c:514 [inline]
[<ffffffff81a0d09a>] kasan_kmalloc+0xaa/0xd0 mm/kasan/kasan.c:605
[<ffffffff81a098eb>] kmem_cache_alloc_trace+0x10b/0x670 mm/slab.c:3629
[<ffffffff8108b95f>] kmalloc include/linux/slab.h:490 [inline]
[<ffffffff8108b95f>] kzalloc include/linux/slab.h:636 [inline]
[<ffffffff8108b95f>] kvm_irqfd_assign
arch/x86/kvm/../../../virt/kvm/eventfd.c:296 [inline]
[<ffffffff8108b95f>] kvm_irqfd+0x16f/0x1e30
arch/x86/kvm/../../../virt/kvm/eventfd.c:578
[<ffffffff81081b4a>] kvm_vm_ioctl+0x107a/0x1d10
arch/x86/kvm/../../../virt/kvm/kvm_main.c:3007
[<ffffffff81aa41cf>] vfs_ioctl fs/ioctl.c:43 [inline]
[<ffffffff81aa41cf>] do_vfs_ioctl+0x1bf/0x1790 fs/ioctl.c:683
[<ffffffff81aa582f>] SYSC_ioctl fs/ioctl.c:698 [inline]
[<ffffffff81aa582f>] SyS_ioctl+0x8f/0xc0 fs/ioctl.c:689
[<ffffffff841c9c81>] entry_SYSCALL_64_fastpath+0x1f/0xc2
Freed:
PID = 1556
[<ffffffff812b1506>] save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:57
[<ffffffff81a0cdd3>] save_stack+0x43/0xd0 mm/kasan/kasan.c:502
[<ffffffff81a0d70f>] set_track mm/kasan/kasan.c:514 [inline]
[<ffffffff81a0d70f>] kasan_slab_free+0x6f/0xb0 mm/kasan/kasan.c:578
[<ffffffff81a0b5c3>] __cache_free mm/slab.c:3505 [inline]
[<ffffffff81a0b5c3>] kfree+0xd3/0x250 mm/slab.c:3822
[<ffffffff8108b4f0>] irqfd_shutdown+0x150/0x1c0
arch/x86/kvm/../../../virt/kvm/eventfd.c:148
[<ffffffff814b4920>] process_one_work+0xbd0/0x1c10 kernel/workqueue.c:2098
[<ffffffff814b5b83>] worker_thread+0x223/0x1990 kernel/workqueue.c:2232
[<ffffffff814ce546>] kthread+0x326/0x3f0 kernel/kthread.c:227
[<ffffffff841c9ef1>] ret_from_fork+0x31/0x40 arch/x86/entry/entry_64.S:430

On commit fd694aaa46c7ed811b72eb47d5eb11ce7ab3f7f1.



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux