]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: VMX: Exit to userspace if vCPU has injected exception and invalid state
authorSean Christopherson <seanjc@google.com>
Mon, 2 May 2022 22:18:50 +0000 (22:18 +0000)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 6 May 2022 17:08:06 +0000 (13:08 -0400)
commit453c77fbcfcbbf28afbaf64ca2cc88b29b26d3da
tree4c7e6096188275732decbefffaeff9601cd787f9
parent5e3d6beae810e4c70a741e032a4481f1422c769d
KVM: VMX: Exit to userspace if vCPU has injected exception and invalid state

Exit to userspace with an emulation error if KVM encounters an injected
exception with invalid guest state, in addition to the existing check of
bailing if there's a pending exception (KVM doesn't support emulating
exceptions except when emulating real mode via vm86).

In theory, KVM should never get to such a situation as KVM is supposed to
exit to userspace before injecting an exception with invalid guest state.
But in practice, userspace can intervene and manually inject an exception
and/or stuff registers to force invalid guest state while a previously
injected exception is awaiting reinjection.

Fixes: dff4d2a1b44b ("KVM: VMX: Reject KVM_RUN if emulation is required with pending exception")
Reported-by: syzbot+cfafed3bb76d3e37581b@syzkaller.appspotmail.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20220502221850.131873-1-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/vmx/vmx.c