Skip to content

Commit 7ec59a8

Browse files
vittyvkBrian Maly
authored andcommitted
KVM: x86: clear stale x86_emulate_ctxt->intercept value
After commit 07721fe ("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 c44b4c6 ("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: c44b4c6 ("KVM: emulate: clean up initializations in init_decode_cache") Fixes: 07721fe ("KVM: nVMX: Don't emulate instructions in guest mode") Cc: [email protected] Suggested-by: Paolo Bonzini <[email protected]> Signed-off-by: Vitaly Kuznetsov <[email protected]> Reviewed-by: Sean Christopherson <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]> (cherry picked from commit 342993f) Orabug: 31118691 Signed-off-by: Maciej S. Szmigiero <[email protected]> Reviewed-by: Mihai Carabas <[email protected]> Reviewed-by: Liam Merwick <[email protected]> Signed-off-by: Brian Maly <[email protected]>
1 parent e4486ae commit 7ec59a8

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

arch/x86/kvm/emulate.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4501,6 +4501,7 @@ int x86_decode_insn(struct x86_emulate_ctxt *ctxt, void *insn, int insn_len)
45014501
ctxt->fetch.ptr = ctxt->fetch.data;
45024502
ctxt->fetch.end = ctxt->fetch.data + insn_len;
45034503
ctxt->opcode_len = 1;
4504+
ctxt->intercept = x86_intercept_none;
45044505
if (insn_len > 0)
45054506
memcpy(ctxt->fetch.data, insn, insn_len);
45064507
else {

0 commit comments

Comments
 (0)