Commit 378a8b09 authored by Gleb Natapov's avatar Gleb Natapov Committed by Marcelo Tosatti

KVM: x86: fix use of uninitialized memory as segment descriptor in emulator.

If VMX reports segment as unusable, zero descriptor passed by the emulator
before returning. Such descriptor will be considered not present by the
emulator.
Signed-off-by: default avatarGleb Natapov <gleb@redhat.com>
Signed-off-by: default avatarMarcelo Tosatti <mtosatti@redhat.com>
parent 91b0aa2c
...@@ -4489,8 +4489,10 @@ static bool emulator_get_segment(struct x86_emulate_ctxt *ctxt, u16 *selector, ...@@ -4489,8 +4489,10 @@ static bool emulator_get_segment(struct x86_emulate_ctxt *ctxt, u16 *selector,
kvm_get_segment(emul_to_vcpu(ctxt), &var, seg); kvm_get_segment(emul_to_vcpu(ctxt), &var, seg);
*selector = var.selector; *selector = var.selector;
if (var.unusable) if (var.unusable) {
memset(desc, 0, sizeof(*desc));
return false; return false;
}
if (var.g) if (var.g)
var.limit >>= 12; var.limit >>= 12;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment