]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: SVM: avoid emulation with stale next_rip
authorWanpeng Li <kernellwpQ@gmail.com>
Sat, 12 Sep 2020 06:16:39 +0000 (02:16 -0400)
committerPaolo Bonzini <pbonzini@redhat.com>
Sat, 12 Sep 2020 06:19:23 +0000 (02:19 -0400)
commit396f2b1bd12d4bcae1289c2be06ea118c7d5f484
tree67741349b8710c32ef6367662ed7eb062955826f
parent67a88d880a5d738f0694aaa9fe492e4f536f7c6b
KVM: SVM: avoid emulation with stale next_rip

svm->next_rip is reset in svm_vcpu_run() only after calling
svm_exit_handlers_fastpath(), which will cause SVM's
skip_emulated_instruction() to write a stale RIP.

We can move svm_exit_handlers_fastpath towards the end of
svm_vcpu_run().  To align VMX with SVM, keep svm_complete_interrupts()
close as well.

Suggested-by: Sean Christopherson <sean.j.christopherson@intel.com>
Cc: Paul K. <kronenpj@kronenpj.dyndns.org>
Reviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: Wanpeng Li <wanpengli@tencent.com>
[Also move vmcb_mark_all_clean before any possible write to the VMCB.
 - Paolo]
arch/x86/kvm/svm/svm.c