aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/x86.c
diff options
context:
space:
mode:
authorJan Kiszka <jan.kiszka@siemens.com>2010-02-15 04:45:41 -0500
committerAvi Kivity <avi@redhat.com>2010-04-25 05:38:14 -0400
commit03b82a30ea8b26199901b219848d706dbd70c609 (patch)
treea7fdac36e4ae40f130c3fc8bcbffc69df7ae5279 /arch/x86/kvm/x86.c
parent8fe546547cf6857a9d984bfe2f2194910f3fc5d0 (diff)
KVM: x86: Do not return soft events in vcpu_events
To avoid that user space migrates a pending software exception or interrupt, mask them out on KVM_GET_VCPU_EVENTS. Without this, user space would try to reinject them, and we would have to reconstruct the proper instruction length for VMX event injection. Now the pending event will be reinjected via executing the triggering instruction again. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/x86.c')
-rw-r--r--arch/x86/kvm/x86.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 1d27a57026a..2b1c9f2fb8d 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -2100,14 +2100,17 @@ static void kvm_vcpu_ioctl_x86_get_vcpu_events(struct kvm_vcpu *vcpu,
2100{ 2100{
2101 vcpu_load(vcpu); 2101 vcpu_load(vcpu);
2102 2102
2103 events->exception.injected = vcpu->arch.exception.pending; 2103 events->exception.injected =
2104 vcpu->arch.exception.pending &&
2105 !kvm_exception_is_soft(vcpu->arch.exception.nr);
2104 events->exception.nr = vcpu->arch.exception.nr; 2106 events->exception.nr = vcpu->arch.exception.nr;
2105 events->exception.has_error_code = vcpu->arch.exception.has_error_code; 2107 events->exception.has_error_code = vcpu->arch.exception.has_error_code;
2106 events->exception.error_code = vcpu->arch.exception.error_code; 2108 events->exception.error_code = vcpu->arch.exception.error_code;
2107 2109
2108 events->interrupt.injected = vcpu->arch.interrupt.pending; 2110 events->interrupt.injected =
2111 vcpu->arch.interrupt.pending && !vcpu->arch.interrupt.soft;
2109 events->interrupt.nr = vcpu->arch.interrupt.nr; 2112 events->interrupt.nr = vcpu->arch.interrupt.nr;
2110 events->interrupt.soft = vcpu->arch.interrupt.soft; 2113 events->interrupt.soft = 0;
2111 2114
2112 events->nmi.injected = vcpu->arch.nmi_injected; 2115 events->nmi.injected = vcpu->arch.nmi_injected;
2113 events->nmi.pending = vcpu->arch.nmi_pending; 2116 events->nmi.pending = vcpu->arch.nmi_pending;