aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorMarcelo Tosatti <mtosatti@redhat.com>2009-11-11 17:29:49 -0200
committerMarcelo Tosatti <mtosatti@redhat.com>2010-03-01 12:35:38 -0300
commitcb84b55f6cde26c7c17beaf87da08645ae6ccbf9 (patch)
treeb40670344a303d3cfda44eff6c6816d561cc6c36 /arch
parentKVM: x86: make double/triple fault promotion generic to all exceptions (diff)
downloadlinux-dev-cb84b55f6cde26c7c17beaf87da08645ae6ccbf9.tar.xz
linux-dev-cb84b55f6cde26c7c17beaf87da08645ae6ccbf9.zip
KVM: x86: raise TSS exception for NULL CS and SS segments
Windows 2003 uses task switch to triple fault and reboot (the other exception being reserved pdptrs bits). Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/kvm/x86.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 8d860e0301a0..279318677911 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -4410,6 +4410,15 @@ static int is_vm86_segment(struct kvm_vcpu *vcpu, int seg)
(kvm_get_rflags(vcpu) & X86_EFLAGS_VM);
}
+static void kvm_check_segment_descriptor(struct kvm_vcpu *vcpu, int seg,
+ u16 selector)
+{
+ /* NULL selector is not valid for CS and SS */
+ if (seg == VCPU_SREG_CS || seg == VCPU_SREG_SS)
+ if (!selector)
+ kvm_queue_exception_e(vcpu, TS_VECTOR, selector >> 3);
+}
+
int kvm_load_segment_descriptor(struct kvm_vcpu *vcpu, u16 selector,
int type_bits, int seg)
{
@@ -4419,6 +4428,8 @@ int kvm_load_segment_descriptor(struct kvm_vcpu *vcpu, u16 selector,
return kvm_load_realmode_segment(vcpu, selector, seg);
if (load_segment_descriptor_to_kvm_desct(vcpu, selector, &kvm_seg))
return 1;
+
+ kvm_check_segment_descriptor(vcpu, seg, selector);
kvm_seg.type |= type_bits;
if (seg != VCPU_SREG_SS && seg != VCPU_SREG_CS &&