aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/vmx.c
diff options
context:
space:
mode:
authorGleb Natapov <gleb@redhat.com>2012-12-20 09:57:44 -0500
committerMarcelo Tosatti <mtosatti@redhat.com>2013-01-02 16:36:28 -0500
commit89efbed02cfd7e9ce3324de0b44a70ee1c716fac (patch)
tree52e8a8121405ef85d4a8da53b9888a8de9419968 /arch/x86/kvm/vmx.c
parent045a282ca41505184e8fc805335d1f5aae0c8a03 (diff)
KVM: VMX: make rmode_segment_valid() more strict.
Currently it allows entering vm86 mode if segment limit is greater than 0xffff and db bit is set. Both of those can cause incorrect execution of instruction by cpu since in vm86 mode limit will be set to 0xffff and db will be forced to 0. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'arch/x86/kvm/vmx.c')
-rw-r--r--arch/x86/kvm/vmx.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 23d5aec78073..7ebcac25725b 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -3341,15 +3341,13 @@ static bool rmode_segment_valid(struct kvm_vcpu *vcpu, int seg)
3341 3341
3342 vmx_get_segment(vcpu, &var, seg); 3342 vmx_get_segment(vcpu, &var, seg);
3343 var.dpl = 0x3; 3343 var.dpl = 0x3;
3344 var.g = 0;
3345 var.db = 0;
3346 if (seg == VCPU_SREG_CS) 3344 if (seg == VCPU_SREG_CS)
3347 var.type = 0x3; 3345 var.type = 0x3;
3348 ar = vmx_segment_access_rights(&var); 3346 ar = vmx_segment_access_rights(&var);
3349 3347
3350 if (var.base != (var.selector << 4)) 3348 if (var.base != (var.selector << 4))
3351 return false; 3349 return false;
3352 if (var.limit < 0xffff) 3350 if (var.limit != 0xffff)
3353 return false; 3351 return false;
3354 if (ar != 0xf3) 3352 if (ar != 0xf3)
3355 return false; 3353 return false;