diff options
Diffstat (limited to 'arch/x86/kvm/x86.c')
| -rw-r--r-- | arch/x86/kvm/x86.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 02c8e095a239..941f932373d0 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
| @@ -3834,6 +3834,8 @@ static int kvm_vcpu_ioctl_enable_cap(struct kvm_vcpu *vcpu, | |||
| 3834 | case KVM_CAP_HYPERV_SYNIC2: | 3834 | case KVM_CAP_HYPERV_SYNIC2: |
| 3835 | if (cap->args[0]) | 3835 | if (cap->args[0]) |
| 3836 | return -EINVAL; | 3836 | return -EINVAL; |
| 3837 | /* fall through */ | ||
| 3838 | |||
| 3837 | case KVM_CAP_HYPERV_SYNIC: | 3839 | case KVM_CAP_HYPERV_SYNIC: |
| 3838 | if (!irqchip_in_kernel(vcpu->kvm)) | 3840 | if (!irqchip_in_kernel(vcpu->kvm)) |
| 3839 | return -EINVAL; | 3841 | return -EINVAL; |
| @@ -5114,6 +5116,13 @@ int kvm_read_guest_virt(struct kvm_vcpu *vcpu, | |||
| 5114 | { | 5116 | { |
| 5115 | u32 access = (kvm_x86_ops->get_cpl(vcpu) == 3) ? PFERR_USER_MASK : 0; | 5117 | u32 access = (kvm_x86_ops->get_cpl(vcpu) == 3) ? PFERR_USER_MASK : 0; |
| 5116 | 5118 | ||
| 5119 | /* | ||
| 5120 | * FIXME: this should call handle_emulation_failure if X86EMUL_IO_NEEDED | ||
| 5121 | * is returned, but our callers are not ready for that and they blindly | ||
| 5122 | * call kvm_inject_page_fault. Ensure that they at least do not leak | ||
| 5123 | * uninitialized kernel stack memory into cr2 and error code. | ||
| 5124 | */ | ||
| 5125 | memset(exception, 0, sizeof(*exception)); | ||
| 5117 | return kvm_read_guest_virt_helper(addr, val, bytes, vcpu, access, | 5126 | return kvm_read_guest_virt_helper(addr, val, bytes, vcpu, access, |
| 5118 | exception); | 5127 | exception); |
| 5119 | } | 5128 | } |
| @@ -6480,8 +6489,7 @@ restart: | |||
| 6480 | toggle_interruptibility(vcpu, ctxt->interruptibility); | 6489 | toggle_interruptibility(vcpu, ctxt->interruptibility); |
| 6481 | vcpu->arch.emulate_regs_need_sync_to_vcpu = false; | 6490 | vcpu->arch.emulate_regs_need_sync_to_vcpu = false; |
| 6482 | kvm_rip_write(vcpu, ctxt->eip); | 6491 | kvm_rip_write(vcpu, ctxt->eip); |
| 6483 | if (r == EMULATE_DONE && | 6492 | if (r == EMULATE_DONE && ctxt->tf) |
| 6484 | (ctxt->tf || (vcpu->guest_debug & KVM_GUESTDBG_SINGLESTEP))) | ||
| 6485 | kvm_vcpu_do_singlestep(vcpu, &r); | 6493 | kvm_vcpu_do_singlestep(vcpu, &r); |
| 6486 | if (!ctxt->have_exception || | 6494 | if (!ctxt->have_exception || |
| 6487 | exception_type(ctxt->exception.vector) == EXCPT_TRAP) | 6495 | exception_type(ctxt->exception.vector) == EXCPT_TRAP) |
| @@ -7093,10 +7101,10 @@ int kvm_emulate_hypercall(struct kvm_vcpu *vcpu) | |||
| 7093 | case KVM_HC_CLOCK_PAIRING: | 7101 | case KVM_HC_CLOCK_PAIRING: |
| 7094 | ret = kvm_pv_clock_pairing(vcpu, a0, a1); | 7102 | ret = kvm_pv_clock_pairing(vcpu, a0, a1); |
| 7095 | break; | 7103 | break; |
| 7104 | #endif | ||
| 7096 | case KVM_HC_SEND_IPI: | 7105 | case KVM_HC_SEND_IPI: |
| 7097 | ret = kvm_pv_send_ipi(vcpu->kvm, a0, a1, a2, a3, op_64_bit); | 7106 | ret = kvm_pv_send_ipi(vcpu->kvm, a0, a1, a2, a3, op_64_bit); |
| 7098 | break; | 7107 | break; |
| 7099 | #endif | ||
| 7100 | default: | 7108 | default: |
| 7101 | ret = -KVM_ENOSYS; | 7109 | ret = -KVM_ENOSYS; |
| 7102 | break; | 7110 | break; |
| @@ -7793,7 +7801,7 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu) | |||
| 7793 | * 1) We should set ->mode before checking ->requests. Please see | 7801 | * 1) We should set ->mode before checking ->requests. Please see |
| 7794 | * the comment in kvm_vcpu_exiting_guest_mode(). | 7802 | * the comment in kvm_vcpu_exiting_guest_mode(). |
| 7795 | * | 7803 | * |
| 7796 | * 2) For APICv, we should set ->mode before checking PIR.ON. This | 7804 | * 2) For APICv, we should set ->mode before checking PID.ON. This |
| 7797 | * pairs with the memory barrier implicit in pi_test_and_set_on | 7805 | * pairs with the memory barrier implicit in pi_test_and_set_on |
| 7798 | * (see vmx_deliver_posted_interrupt). | 7806 | * (see vmx_deliver_posted_interrupt). |
| 7799 | * | 7807 | * |
| @@ -7937,6 +7945,7 @@ static inline int vcpu_block(struct kvm *kvm, struct kvm_vcpu *vcpu) | |||
| 7937 | vcpu->arch.pv.pv_unhalted = false; | 7945 | vcpu->arch.pv.pv_unhalted = false; |
| 7938 | vcpu->arch.mp_state = | 7946 | vcpu->arch.mp_state = |
| 7939 | KVM_MP_STATE_RUNNABLE; | 7947 | KVM_MP_STATE_RUNNABLE; |
| 7948 | /* fall through */ | ||
| 7940 | case KVM_MP_STATE_RUNNABLE: | 7949 | case KVM_MP_STATE_RUNNABLE: |
| 7941 | vcpu->arch.apf.halted = false; | 7950 | vcpu->arch.apf.halted = false; |
| 7942 | break; | 7951 | break; |
