From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755321AbdESNbE (ORCPT ); Fri, 19 May 2017 09:31:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33910 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750768AbdESNbC (ORCPT ); Fri, 19 May 2017 09:31:02 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com EC3C180469 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=david@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com EC3C180469 Subject: Re: [PATCH 2/4] KVM: x86: zero base3 of unusable segments To: =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: Paolo Bonzini , Dan Carpenter References: <20170518173732.12185-1-rkrcmar@redhat.com> <20170518173732.12185-3-rkrcmar@redhat.com> From: David Hildenbrand Organization: Red Hat GmbH Message-ID: <30aa71c2-065c-6cd4-298b-a50fbc3d6feb@redhat.com> Date: Fri, 19 May 2017 15:30:59 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.0 MIME-Version: 1.0 In-Reply-To: <20170518173732.12185-3-rkrcmar@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Fri, 19 May 2017 13:31:02 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 18.05.2017 19:37, Radim Krčmář wrote: > 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 > Fixes: 1aa366163b8b ("KVM: x86 emulator: consolidate segment accessors") > Signed-off-by: Radim Krčmář > --- > arch/x86/kvm/x86.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c > index b54125b590e8..eed8272dd52e 100644 > --- a/arch/x86/kvm/x86.c > +++ b/arch/x86/kvm/x86.c > @@ -5053,6 +5053,8 @@ static bool emulator_get_segment(struct x86_emulate_ctxt *ctxt, u16 *selector, > > if (var.unusable) { > memset(desc, 0, sizeof(*desc)); > + if (base3) > + *base3 = 0; > return false; > } > > Reviewed-by: David Hildenbrand -- Thanks, David