Skip to content

Commit 77d977d

Browse files
rkrcmargregkh
authored andcommitted
KVM: x86: zero base3 of unusable segments
commit f0367ee1d64d27fa08be2407df5c125442e885e3 upstream. Static checker noticed that base3 could be used uninitialized if the segment was not present (useable). Random stack values probably would not pass VMCS entry checks. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Fixes: 1aa3661 ("KVM: x86 emulator: consolidate segment accessors") Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: David Hildenbrand <david@redhat.com> Signed-off-by: Radim Krčmář <rkrcmar@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 3b1609f commit 77d977d

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

arch/x86/kvm/x86.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4844,6 +4844,8 @@ static bool emulator_get_segment(struct x86_emulate_ctxt *ctxt, u16 *selector,
48444844

48454845
if (var.unusable) {
48464846
memset(desc, 0, sizeof(*desc));
4847+
if (base3)
4848+
*base3 = 0;
48474849
return false;
48484850
}
48494851

0 commit comments

Comments
 (0)