[syzbot] WARNING in vmx_queue_exception

18 views
Skip to first unread message

syzbot

unread,
Dec 25, 2021, 11:56:17 AM12/25/21
to b...@alien8.de, dave....@linux.intel.com, h...@zytor.com, jmat...@google.com, jo...@8bytes.org, k...@vger.kernel.org, linux-...@vger.kernel.org, mi...@redhat.com, pbon...@redhat.com, sea...@google.com, syzkall...@googlegroups.com, tg...@linutronix.de, vkuz...@redhat.com, wanp...@tencent.com, x...@kernel.org
Hello,

syzbot found the following issue on:

HEAD commit: 6e0567b73052 Merge tag 'for-linus' of git://git.kernel.org..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=128c1adbb00000
kernel config: https://syzkaller.appspot.com/x/.config?x=6104739ac5f067ea
dashboard link: https://syzkaller.appspot.com/bug?extid=82112403ace4cbd780d8
compiler: Debian clang version 11.0.1-2, GNU ld (GNU Binutils for Debian) 2.35.2

Unfortunately, I don't have any reproducer for this issue yet.

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+821124...@syzkaller.appspotmail.com

------------[ cut here ]------------
WARNING: CPU: 0 PID: 28019 at arch/x86/kvm/vmx/vmx.c:1616 vmx_queue_exception+0x2f2/0x440 arch/x86/kvm/vmx/vmx.c:1616
Modules linked in:
CPU: 1 PID: 28019 Comm: syz-executor.5 Not tainted 5.16.0-rc6-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
RIP: 0010:vmx_queue_exception+0x2f2/0x440 arch/x86/kvm/vmx/vmx.c:1616
Code: 41 5e 41 5f 5d e9 de b3 fd ff e8 79 22 60 00 eb 05 e8 72 22 60 00 48 83 c4 18 5b 41 5c 41 5d 41 5e 41 5f 5d c3 e8 5e 22 60 00 <0f> 0b e9 78 fe ff ff 89 f9 80 e1 07 38 c1 0f 8c 35 fd ff ff e8 15
RSP: 0018:ffffc90010587450 EFLAGS: 00010287
RAX: ffffffff812469b2 RBX: 0000000000000001 RCX: 0000000000040000
RDX: ffffc900051ea000 RSI: 0000000000001923 RDI: 0000000000001924
RBP: 0000000000000000 R08: ffffffff81246824 R09: ffffed100645904d
R10: ffffed100645904d R11: 0000000000000000 R12: ffff8880322c8000
R13: dffffc0000000000 R14: 0000000000000006 R15: 0000000080000006
FS: 00007fe6788f8700(0000) GS:ffff8880b9a00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f4f4bcd8058 CR3: 0000000087d66000 CR4: 00000000003526f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
kvm_inject_exception arch/x86/kvm/x86.c:9071 [inline]
inject_pending_event arch/x86/kvm/x86.c:9145 [inline]
vcpu_enter_guest+0x19aa/0x9df0 arch/x86/kvm/x86.c:9801
vcpu_run+0x4d3/0xe50 arch/x86/kvm/x86.c:10055
kvm_arch_vcpu_ioctl_run+0x494/0xb20 arch/x86/kvm/x86.c:10250
kvm_vcpu_ioctl+0x894/0xe20 arch/x86/kvm/../../../virt/kvm/kvm_main.c:3727
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:874 [inline]
__se_sys_ioctl+0xfb/0x170 fs/ioctl.c:860
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x44/0xd0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x44/0xae
RIP: 0033:0x7fe679fa3e99
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 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 bc ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fe6788f8168 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007fe67a0b7030 RCX: 00007fe679fa3e99
RDX: 0000000000000000 RSI: 000000000000ae80 RDI: 000000000000000f
RBP: 00007fe679ffdff1 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ffe39ef7acf R14: 00007fe6788f8300 R15: 0000000000022000
</TASK>


---
This report 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 syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

Sean Christopherson

unread,
Dec 28, 2021, 3:53:54 PM12/28/21
to syzbot, b...@alien8.de, dave....@linux.intel.com, h...@zytor.com, jmat...@google.com, jo...@8bytes.org, k...@vger.kernel.org, linux-...@vger.kernel.org, mi...@redhat.com, pbon...@redhat.com, syzkall...@googlegroups.com, tg...@linutronix.de, vkuz...@redhat.com, wanp...@tencent.com, x...@kernel.org
This is all but guaranteed to be "fixed" by commit cd0e615c49e5 ("KVM: nVMX:
Synthesize TRIPLE_FAULT for L2 if emulation is required"). The GCE instance has
unrestricted guest enabled, which means the only way for emulation_required to be
set is by disabling it in vmcs12. That's also supported by the fact that this
just recently showed up, as commit c8607e4a086f ("KVM: x86: nVMX: don't fail
nested VM entry on invalid guest state if !from_vmentry") likely allowed syzkaller
to get emulation_required set while L2 is active.

But, "fixed" is in quotes because is that only covers the nested case, there are
a multitude of ways that userspace can trigger the WARN when running non-nested
with kvm_intel.unrestricted_guest=0. The easiest "fix" would be to simply delete
the WARN. The downside is that instead of getting a WARN or explicit error, the
vCPU will go into the weeds if userspace or KVM screws up.

The alternative is to add a pre-check in KVM_RUN to detect userspace abuse/bugs,
which would allow KVM to keep the WARN to detect KVM bugs. A check in KVM_RUN is
necessary because KVM can't force specific ordering between KVM_SET_VCPU_EVENTS
and KVM_SET_SREGS, e.g. clearing exception.pending in KVM_SET_SREGS doesn't prevent
userspace from setting it in KVM_SET_VCPU_EVENTS, and disallowing KVM_SET_VCPU_EVENTS
with emulation_required would prevent userspace from queuing an exception and then
stuffing sregs.

I'll send a patch and test for the clean fix, it's not really gross, just annoying
that unrestricted_guest=0 requires so much dedicated handling :-/
Reply all
Reply to author
Forward
0 new messages