]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: x86: clear stale x86_emulate_ctxt->intercept value
authorVitaly Kuznetsov <vkuznets@redhat.com>
Tue, 3 Mar 2020 14:33:15 +0000 (15:33 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Mar 2020 06:17:51 +0000 (07:17 +0100)
commite1189666114c518de165354b165c4ec08b66893f
tree83399e53ab640533fe9de61426b0563b40aa64fe
parent623577810c3372b8c5dd93f0a028da5a2fcef44d
KVM: x86: clear stale x86_emulate_ctxt->intercept value

commit 9fd3f396d4b15059374fe9a606737ac1fffbc547 upstream.

After commit 705955e37f4b ("KVM: nVMX: Don't emulate instructions in guest
mode") Hyper-V guests on KVM stopped booting with:

 kvm_nested_vmexit:    rip fffff802987d6169 reason EPT_VIOLATION info1 181
    info2 0 int_info 0 int_info_err 0
 kvm_page_fault:       address febd0000 error_code 181
 kvm_emulate_insn:     0:fffff802987d6169: f3 a5
 kvm_emulate_insn:     0:fffff802987d6169: f3 a5 FAIL
 kvm_inj_exception:    #UD (0x0)

"f3 a5" is a "rep movsw" instruction, which should not be intercepted
at all.  Commit a455ab392774 ("KVM: emulate: clean up initializations in
init_decode_cache") reduced the number of fields cleared by
init_decode_cache() claiming that they are being cleared elsewhere,
'intercept', however, is left uncleared if the instruction does not have
any of the "slow path" flags (NotImpl, Stack, Op3264, Sse, Mmx, CheckPerm,
NearBranch, No16 and of course Intercept itself).

Fixes: a455ab392774 ("KVM: emulate: clean up initializations in init_decode_cache")
Fixes: 705955e37f4b ("KVM: nVMX: Don't emulate instructions in guest mode")
Cc: stable@vger.kernel.org
Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Reviewed-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/kvm/emulate.c