Re: general protection fault in kvm_ioapic_scan_entry
From: Eric Biggers
Date: Tue Feb 26 2019 - 18:49:31 EST
On Tue, Aug 14, 2018 at 12:50:02AM -0700, syzbot wrote:
> Hello,
>
> syzbot found the following crash on:
>
> HEAD commit: 1c2f2531cf8b Add linux-next specific files for 20180809
> git tree: linux-next
> console output: https://syzkaller.appspot.com/x/log.txt?x=16016cf8400000
> kernel config: https://syzkaller.appspot.com/x/.config?x=44657afb75515c8b
> dashboard link: https://syzkaller.appspot.com/bug?extid=20eae20afcbd851b8601
> compiler: gcc (GCC) 8.0.1 20180413 (experimental)
> syzkaller repro:https://syzkaller.appspot.com/x/repro.syz?x=12038e22400000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=163caee2400000
>
> IMPORTANT: if you fix the bug, please add the following tag to the commit:
> Reported-by: syzbot+20eae20afcbd851b8601@xxxxxxxxxxxxxxxxxxxxxxxxx
>
> random: sshd: uninitialized urandom read (32 bytes read)
> urandom_read: 1 callbacks suppressed
> random: sshd: uninitialized urandom read (32 bytes read)
> kasan: CONFIG_KASAN_INLINE enabled
> kasan: GPF could be caused by NULL-ptr deref or user memory access
> general protection fault: 0000 [#1] SMP KASAN
> CPU: 1 PID: 4332 Comm: syz-executor255 Not tainted 4.18.0-rc8-next-20180809+
> #35
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
> Google 01/01/2011
> RIP: 0010:do_raw_spin_lock+0x27/0x200 kernel/locking/spinlock_debug.c:111
> Code: 00 00 00 48 b8 00 00 00 00 00 fc ff df 55 48 89 e5 41 56 41 55 41 54
> 53 48 89 fb 48 83 c7 04 48 89 fa 48 c1 ea 03 48 83 ec 08 <0f> b6 14 02 48 89
> f8 83 e0 07 83 c0 03 38 d0 7c 08 84 d2 0f 85 7b
> RSP: 0018:ffff8801cf1a7430 EFLAGS: 00010286
> RAX: dffffc0000000000 RBX: 00000000000001b0 RCX: 0000000000000000
> RDX: 0000000000000036 RSI: 0000000000000000 RDI: 00000000000001b4
> RBP: ffff8801cf1a7458 R08: 0000000000000001 R09: 0000000000000000
> R10: ffffed0035c51089 R11: ffff8801ae28844f R12: ffff8801ae288430
> R13: 0000000000000000 R14: dffffc0000000000 R15: 0000000000000000
> FS: 00000000014a5880(0000) GS:ffff8801db100000(0000) knlGS:0000000000000000
> CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> CR2: 0000000020000000 CR3: 00000001b4a66000 CR4: 00000000001426e0
> DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
> DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
> Call Trace:
> __raw_spin_lock include/linux/spinlock_api_smp.h:143 [inline]
> _raw_spin_lock+0x32/0x40 kernel/locking/spinlock.c:144
> spin_lock include/linux/spinlock.h:329 [inline]
> kvm_ioapic_scan_entry+0x7f/0x3c0 arch/x86/kvm/ioapic.c:246
> vcpu_scan_ioapic arch/x86/kvm/x86.c:7253 [inline]
> vcpu_enter_guest+0x494b/0x6360 arch/x86/kvm/x86.c:7389
> vcpu_run arch/x86/kvm/x86.c:7660 [inline]
> kvm_arch_vcpu_ioctl_run+0x33e/0x1690 arch/x86/kvm/x86.c:7837
> kvm_vcpu_ioctl+0x7b8/0x1300 arch/x86/kvm/../../../virt/kvm/kvm_main.c:2590
> vfs_ioctl fs/ioctl.c:46 [inline]
> file_ioctl fs/ioctl.c:501 [inline]
> do_vfs_ioctl+0x1de/0x1720 fs/ioctl.c:685
> ksys_ioctl+0xa9/0xd0 fs/ioctl.c:702
> __do_sys_ioctl fs/ioctl.c:709 [inline]
> __se_sys_ioctl fs/ioctl.c:707 [inline]
> __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:707
> do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
> entry_SYSCALL_64_after_hwframe+0x49/0xbe
> RIP: 0033:0x4402f9
> Code: 18 89 d0 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 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
> 0f 83 fb 13 fc ff c3 66 2e 0f 1f 84 00 00 00 00
> RSP: 002b:00007ffdb31251d8 EFLAGS: 00000213 ORIG_RAX: 0000000000000010
> RAX: ffffffffffffffda RBX: 00000000004002c8 RCX: 00000000004402f9
> RDX: 0000000000000000 RSI: 000000000000ae80 RDI: 0000000000000003
> RBP: 00000000006ca018 R08: 00000000004002c8 R09: 00000000004002c8
> R10: 00000000004002c8 R11: 0000000000000213 R12: 0000000000401b80
> R13: 0000000000401c10 R14: 0000000000000000 R15: 0000000000000000
> Modules linked in:
> Dumping ftrace buffer:
> (ftrace buffer empty)
> ---[ end trace c89a962150abb5ce ]---
> RIP: 0010:do_raw_spin_lock+0x27/0x200 kernel/locking/spinlock_debug.c:111
> Code: 00 00 00 48 b8 00 00 00 00 00 fc ff df 55 48 89 e5 41 56 41 55 41 54
> 53 48 89 fb 48 83 c7 04 48 89 fa 48 c1 ea 03 48 83 ec 08 <0f> b6 14 02 48 89
> f8 83 e0 07 83 c0 03 38 d0 7c 08 84 d2 0f 85 7b
> RSP: 0018:ffff8801cf1a7430 EFLAGS: 00010286
> RAX: dffffc0000000000 RBX: 00000000000001b0 RCX: 0000000000000000
> RDX: 0000000000000036 RSI: 0000000000000000 RDI: 00000000000001b4
> RBP: ffff8801cf1a7458 R08: 0000000000000001 R09: 0000000000000000
> R10: ffffed0035c51089 R11: ffff8801ae28844f R12: ffff8801ae288430
> R13: 0000000000000000 R14: dffffc0000000000 R15: 0000000000000000
> FS: 00000000014a5880(0000) GS:ffff8801db100000(0000) knlGS:0000000000000000
> CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> CR2: 0000000020000000 CR3: 00000001b4a66000 CR4: 00000000001426e0
> DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
> DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
>
>
> ---
> This bug is generated by a bot. It may contain errors.
> See https://goo.gl/tpsmEJ for more information about syzbot.
> syzbot engineers can be reached at syzkaller@xxxxxxxxxxxxxxxxx
>
> syzbot will keep track of this bug report. See:
> https://goo.gl/tpsmEJ#bug-status-tracking for how to communicate with
> syzbot.
> syzbot can test patches for this bug, for details see:
> https://goo.gl/tpsmEJ#testing-patches
>
This was fixed by:
commit dcbd3e49c2f0b2c2d8a321507ff8f3de4af76d7c
Author: Wanpeng Li <wanpengli@xxxxxxxxxxx>
Date: Mon Dec 17 10:43:23 2018 +0800
KVM: X86: Fix NULL deref in vcpu_scan_ioapic
#syz fix: KVM: X86: Fix NULL deref in vcpu_scan_ioapic