From: Gleb Natapov Date: Mon, 21 Jan 2013 13:36:48 +0000 (+0200) Subject: KVM: x86: fix use of uninitialized memory as segment descriptor in emulator. X-Git-Tag: v3.2.93~71 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d3ee5f88de38c7eb067db3d86f54b619b812cb45;p=thirdparty%2Fkernel%2Fstable.git KVM: x86: fix use of uninitialized memory as segment descriptor in emulator. commit 378a8b099fc207ddcb91b19a8c1457667e0af398 upstream. 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: Gleb Natapov Signed-off-by: Marcelo Tosatti Signed-off-by: Ben Hutchings --- diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index eecee5083f715..51bfca6d775b7 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -4611,8 +4611,10 @@ static bool emulator_get_segment(struct x86_emulate_ctxt *ctxt, u16 *selector, kvm_get_segment(emul_to_vcpu(ctxt), &var, seg); *selector = var.selector; - if (var.unusable) + if (var.unusable) { + memset(desc, 0, sizeof(*desc)); return false; + } if (var.g) var.limit >>= 12;