Re: BUG: unable to handle kernel NULL pointer dereference in irq_bypass_register_consumer

From: Eric Biggers
Date: Fri Jan 26 2018 - 18:26:01 EST


On Sun, Dec 17, 2017 at 06:37:02PM +0800, Wanpeng Li wrote:
> 2017-12-17 17:56 GMT+08:00 syzbot
> <bot+dcff49641d63583853a5806197d79145931ac740@xxxxxxxxxxxxxxxxxxxxxxxxx>:
> > Hello,
> >
> > syzkaller hit the following crash on
> > 41d8c16909ebda40f7b4982a7f5e2ad102705ade
> > git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/master
> > compiler: gcc (GCC) 7.1.1 20170620
> > .config is attached
> > Raw console output is attached.
> >
> > syzkaller reproducer is attached. See https://goo.gl/kgGztJ
> > for information about syzkaller reproducers
> >
> >
>
> I will have a look.
>
> Regards,
> Wanpeng Li
>
> > BUG: unable to handle kernel NULL pointer dereference at 0000000000000010
> > IP: irq_bypass_register_consumer+0xbe/0x200 virt/lib/irqbypass.c:198
> > PGD 20d26c067 P4D 20d26c067 PUD 20d26f067 PMD 0
> > Oops: 0000 [#1] SMP
> > Dumping ftrace buffer:
> > (ftrace buffer empty)
> > Modules linked in:
> > CPU: 1 PID: 8627 Comm: syz-executor7 Not tainted 4.15.0-rc3-next-20171213+
> > #66
> > Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
> > Google 01/01/2011
> > RIP: 0010:irq_bypass_register_consumer+0xbe/0x200 virt/lib/irqbypass.c:198
> > RSP: 0018:ffffc9000691fd50 EFLAGS: 00010293
> > RAX: ffff88021431e2c0 RBX: 0000000000000000 RCX: ffffffff825a774e
> > RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
> > RBP: ffffc9000691fd70 R08: ffffffff825a7710 R09: 0000000000000004
> > R10: ffffc9000691fd40 R11: 0000000000000004 R12: ffff88020d3d5368
> > R13: ffff88020ef7c980 R14: ffff88020eef2768 R15: ffff88020d370000
> > FS: 00007f2d09cf8700(0000) GS:ffff88021fd00000(0000) knlGS:0000000000000000
> > CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> > CR2: 0000000000000010 CR3: 00000002143f1000 CR4: 00000000001426e0
> > DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
> > DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
> > Call Trace:
> > kvm_irqfd_assign arch/x86/kvm/../../../virt/kvm/eventfd.c:417 [inline]
> > kvm_irqfd+0x6d4/0x860 arch/x86/kvm/../../../virt/kvm/eventfd.c:572
> > kvm_vm_ioctl+0x3e2/0x9f0 arch/x86/kvm/../../../virt/kvm/kvm_main.c:3000
> > vfs_ioctl fs/ioctl.c:46 [inline]
> > do_vfs_ioctl+0xaf/0x840 fs/ioctl.c:686
> > SYSC_ioctl fs/ioctl.c:701 [inline]
> > SyS_ioctl+0x8f/0xc0 fs/ioctl.c:692
> > entry_SYSCALL_64_fastpath+0x1f/0x96
> > RIP: 0033:0x452a39
> > RSP: 002b:00007f2d09cf7c58 EFLAGS: 00000212 ORIG_RAX: 0000000000000010
> > RAX: ffffffffffffffda RBX: 0000000000758020 RCX: 0000000000452a39
> > RDX: 0000000020080fe0 RSI: 000000004020ae76 RDI: 0000000000000003
> > RBP: 0000000000000562 R08: 0000000000000000 R09: 0000000000000000
> > R10: 0000000000000000 R11: 0000000000000212 R12: 00000000006f61d0
> > R13: 00000000ffffffff R14: 00007f2d09cf86d4 R15: 0000000000000000
> > Code: d1 fe 4d 8b 6c 24 10 4d 39 6e 10 74 2f 4d 39 f4 74 2a 4c 89 f3 e8 33
> > 2c d1 fe 48 8b 1b 48 81 fb 60 e1 19 83 74 43 e8 22 2c d1 fe <4c> 39 6b 10 0f
> > 94 c2 49 39 dc 0f 94 c0 08 c2 74 d9 e8 0c 2c d1
> > RIP: irq_bypass_register_consumer+0xbe/0x200 virt/lib/irqbypass.c:198 RSP:
> > ffffc9000691fd50
> > CR2: 0000000000000010
> > ---[ end trace 28b4667ba051ea9a ]---
> > Kernel panic - not syncing: Fatal exception
> > Dumping ftrace buffer:
> > (ftrace buffer empty)
> > Kernel Offset: disabled
> > Rebooting in 86400 seconds..

syzbot is no longer reporting this crash. It seems it was reported during the
time that KASAN was accidentally disabled in the syzbot config due to a change
to the kconfig menus in linux-next. So it's probably the same as this one
(which is still happening):

#syz dup: KASAN: use-after-free Write in irq_bypass_register_consumer