KVM: x86: Exit to userspace on emulation skip failure
authorSean Christopherson <sean.j.christopherson@intel.com>
Tue, 27 Aug 2019 21:40:34 +0000 (14:40 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 24 Sep 2019 12:31:07 +0000 (14:31 +0200)
commit738fece46dc5e1bb1309a827a2b69056143b3d13
tree33246d9a226b6b7953d686a9eaf9d1a1b674e964
parentc83fad65e2cae1aa570a519b33e8ebf00f6e7227
KVM: x86: Exit to userspace on emulation skip failure

Kill a few birds with one stone by forcing an exit to userspace on skip
emulation failure.  This removes a reference to EMULATE_FAIL, fixes a
bug in handle_ept_misconfig() where it would exit to userspace without
setting run->exit_reason, and fixes a theoretical bug in SVM's
task_switch_interception() where it would overwrite run->exit_reason on
a return of EMULATE_USER_EXIT.

Note, this technically doesn't fully fix task_switch_interception()
as it now incorrectly handles EMULATE_FAIL, but in practice there is no
bug as EMULATE_FAIL will never be returned for EMULTYPE_SKIP.

Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/svm.c
arch/x86/kvm/x86.c