diff options
author | Kevin Wolf <kwolf@redhat.com> | 2012-02-08 08:34:38 -0500 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2012-03-08 07:10:26 -0500 |
commit | 7f3d35fddd173e52886d03bc34b5b5d6f5bea343 (patch) | |
tree | 9561913495a92c398b9b8e372d4e9a5c1d55c7f4 /arch/x86/kvm/svm.c | |
parent | 9cc815e46911486f52bec60517d0f7b40d323bbc (diff) |
KVM: x86 emulator: Fix task switch privilege checks
Currently, all task switches check privileges against the DPL of the
TSS. This is only correct for jmp/call to a TSS. If a task gate is used,
the DPL of this take gate is used for the check instead. Exceptions,
external interrupts and iret shouldn't perform any check.
[avi: kill kvm-kmod remnants]
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/svm.c')
-rw-r--r-- | arch/x86/kvm/svm.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 0b7690ee20b..95cdeaf9c71 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c | |||
@@ -2799,7 +2799,10 @@ static int task_switch_interception(struct vcpu_svm *svm) | |||
2799 | (int_vec == OF_VECTOR || int_vec == BP_VECTOR))) | 2799 | (int_vec == OF_VECTOR || int_vec == BP_VECTOR))) |
2800 | skip_emulated_instruction(&svm->vcpu); | 2800 | skip_emulated_instruction(&svm->vcpu); |
2801 | 2801 | ||
2802 | if (kvm_task_switch(&svm->vcpu, tss_selector, reason, | 2802 | if (int_type != SVM_EXITINTINFO_TYPE_SOFT) |
2803 | int_vec = -1; | ||
2804 | |||
2805 | if (kvm_task_switch(&svm->vcpu, tss_selector, int_vec, reason, | ||
2803 | has_error_code, error_code) == EMULATE_FAIL) { | 2806 | has_error_code, error_code) == EMULATE_FAIL) { |
2804 | svm->vcpu.run->exit_reason = KVM_EXIT_INTERNAL_ERROR; | 2807 | svm->vcpu.run->exit_reason = KVM_EXIT_INTERNAL_ERROR; |
2805 | svm->vcpu.run->internal.suberror = KVM_INTERNAL_ERROR_EMULATION; | 2808 | svm->vcpu.run->internal.suberror = KVM_INTERNAL_ERROR_EMULATION; |