Re: [syzbot] WARNING in handle_exception_nmi (2)

From: Sean Christopherson
Date: Mon Jun 13 2022 - 15:30:15 EST


On Sun, Jun 12, 2022, syzbot wrote:
> syzbot has found a reproducer for the following issue on:
>
> HEAD commit: 7a68065eb9cd Merge tag 'gpio-fixes-for-v5.19-rc2' of git:/..
> git tree: upstream
> console+strace: https://syzkaller.appspot.com/x/log.txt?x=177df408080000
> kernel config: https://syzkaller.appspot.com/x/.config?x=20ac3e0ebf0db3bd
> dashboard link: https://syzkaller.appspot.com/bug?extid=4688c50a9c8e68e7aaa1
> compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=12087173f00000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=16529343f00000
>
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: syzbot+4688c50a9c8e68e7aaa1@xxxxxxxxxxxxxxxxxxxxxxxxx
>
> ------------[ cut here ]------------
> WARNING: CPU: 0 PID: 3609 at arch/x86/kvm/vmx/vmx.c:4896 handle_exception_nmi+0xfdc/0x1190 arch/x86/kvm/vmx/vmx.c:4896
> Modules linked in:
> CPU: 0 PID: 3609 Comm: syz-executor169 Not tainted 5.19.0-rc1-syzkaller-00303-g7a68065eb9cd #0
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011

I'm pretty sure this is a bug in GCE's L0 KVM. Per syzbot's bisection, the WARN
repros all the way back to v5.11 on GCE. The test is doing VMWRITE from its L1
(effective L2) with a memory operand that takes a #PF. The #PF ends up in L1,
which triggers the splat as KVM (real L1) isn't intercepting #PFs.

I've repro'd this on a GCE host running a GCE kernel, and verified the same host
running a v5.18 kernel does _not_ trigger the splat.

I'll route this to someone internally.

> RIP: 0010:handle_exception_nmi+0xfdc/0x1190 arch/x86/kvm/vmx/vmx.c:4896
> Code: 0f 84 c8 f3 ff ff e8 33 5c 58 00 48 89 ef c7 85 84 0d 00 00 00 00 00 00 e8 21 35 ec ff 41 89 c4 e9 af f3 ff ff e8 14 5c 58 00 <0f> 0b e9 69 f6 ff ff e8 08 5c 58 00 be f5 ff ff ff bf 01 00 00 00
> RSP: 0018:ffffc9000309faf8 EFLAGS: 00010293
> RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
> RDX: ffff88801ba1d880 RSI: ffffffff8122171c RDI: 0000000000000001
> RBP: ffff88807cd88000 R08: 0000000000000001 R09: 0000000000000000
> R10: 0000000000000000 R11: 0000000000000001 R12: 00000000a0000975
> R13: ffff88807cd88248 R14: 0000000000000000 R15: 0000000080000300
> FS: 0000555556c8d300(0000) GS:ffff8880b9b00000(0000) knlGS:0000000000000000
> CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> CR2: 0000000000000000 CR3: 00000000229ca000 CR4: 00000000003526e0
> DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
> DR3: 00000000b8fecd19 DR6: 00000000fffe0ff0 DR7: 0000000000000400
> Call Trace:
> <TASK>
> __vmx_handle_exit arch/x86/kvm/vmx/vmx.c:6174 [inline]
> vmx_handle_exit+0x498/0x1950 arch/x86/kvm/vmx/vmx.c:6191
> vcpu_enter_guest arch/x86/kvm/x86.c:10361 [inline]
> vcpu_run arch/x86/kvm/x86.c:10450 [inline]
> kvm_arch_vcpu_ioctl_run+0x4208/0x66f0 arch/x86/kvm/x86.c:10654
> kvm_vcpu_ioctl+0x570/0xf30 arch/x86/kvm/../../../virt/kvm/kvm_main.c:3944
> vfs_ioctl fs/ioctl.c:51 [inline]
> __do_sys_ioctl fs/ioctl.c:870 [inline]
> __se_sys_ioctl fs/ioctl.c:856 [inline]
> __x64_sys_ioctl+0x193/0x200 fs/ioctl.c:856
> do_syscall_x64 arch/x86/entry/common.c:50 [inline]
> do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
> entry_SYSCALL_64_after_hwframe+0x46/0xb0
> RIP: 0033:0x7f56efaee199
> Code: 28 c3 e8 2a 14 00 00 66 2e 0f 1f 84 00 00 00 00 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 c0 ff ff ff f7 d8 64 89 01 48
> RSP: 002b:00007ffc37353158 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
> RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f56efaee199
> RDX: 0000000000000000 RSI: 000000000000ae80 RDI: 0000000000000005
> RBP: 00007f56efab1bf0 R08: 0000000000000000 R09: 0000000000000000
> R10: 0000000000000000 R11: 0000000000000246 R12: 00007f56efab1c80
> R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
> </TASK>
>