Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2765801rwb; Wed, 30 Nov 2022 10:32:21 -0800 (PST) X-Google-Smtp-Source: AA0mqf6Zd+IJv/sF7O2LVwMOvOpl6XF0ZdkTzTtgYzxzXPhsBuG58VKPjZUG2ZKzZq1aVDeGBXKY X-Received: by 2002:a17:906:40f:b0:7bb:8647:e0e4 with SMTP id d15-20020a170906040f00b007bb8647e0e4mr27824882eja.652.1669833141352; Wed, 30 Nov 2022 10:32:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669833141; cv=none; d=google.com; s=arc-20160816; b=t9+dNAyl+D59/U8wQIZuLjFHPSZxkLsJlAFQk4762hBY/KFi4jhdIOPXCQg+DA8UdF 7/Hd+IH8cIOkyYyibfNdWYqWQjs3wtJBrtfDGYyh9RhDSFVQVd13nvsiR0oC8sPXmzRD 4cRroDhOEiM80r9WHrcqscmLYclVVYRyWEAggr0KYtQyOgEYjEkU5YowdXXApBfTbUPo pSFfStsdsoOC2WEFBeAIcAig4s/1GodKC6kV1g/PIPMmt5X8YSOJpJZTLwQ+lyxlDR3n cwxsEV6g9fIg7v8L+hvQgqUjlB6Sny+zPJvqYN+JaplOptfk5uLaRaqvO1l32GilIywd sbUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:to:from:subject:message-id :dkim-signature; bh=eEzeshxptaTVoixaalRXIxJCQCpqLiinHusiDp7Xb4k=; b=v6muSBNs5wZGdv8uzHeogv9v8YM/KJOKm/ZhEcF8lm5XK7coNFjudhxYHuiRDSRjfk 7mQDazxM3FtMOg/Lhvl4f/tihSBjAd3l81Z6UJflP6kjr+4VbLgrOi/6cqwETdfWUnRa b6LvyM36UHEKnRsV9jsMxXY8NNhF9/2t99sdAR76we4JSej9YMXJlIebzmI81EBYm/0G YBtTJz0V0BnoosKyfcTRrqwVZ/MSQspx9aXKtRI/aBorjWJxWcEXDDTUODmP5adp7zMs y29DAHjSusgMsjSqyPiLX0Hy/bUX+FNpcxiQL1Avh0BdlaPNL15WR1LpwjsHyPlSCVDD eB5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=KkHUdf3A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dv4-20020a170906b80400b0078e176ef65csi1371857ejb.723.2022.11.30.10.32.01; Wed, 30 Nov 2022 10:32:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=KkHUdf3A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229679AbiK3RgX (ORCPT + 83 others); Wed, 30 Nov 2022 12:36:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229535AbiK3RgV (ORCPT ); Wed, 30 Nov 2022 12:36:21 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F112F22B04 for ; Wed, 30 Nov 2022 09:35:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1669829728; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eEzeshxptaTVoixaalRXIxJCQCpqLiinHusiDp7Xb4k=; b=KkHUdf3ABclNO6L1dbf5loJG4VRU4F6rLv5/ilGq9c9aefhM87e8xqcrqdmfzXe+xjif67 6UqzMVoBQilmYGpxaC3YoahrVKT11sAEDORirDzLW9UwS2mpe9cWt3LYJZXGBz0+GOJ/ZX au+cXqJUAbjcYZtkc1SOe03MQsOsORc= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-333-xcf41AieOXughk5dFSU2-g-1; Wed, 30 Nov 2022 12:35:24 -0500 X-MC-Unique: xcf41AieOXughk5dFSU2-g-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 00BBE811E7A; Wed, 30 Nov 2022 17:35:24 +0000 (UTC) Received: from starship (unknown [10.35.206.46]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0C518492B04; Wed, 30 Nov 2022 17:35:18 +0000 (UTC) Message-ID: <421c98ac2f863703795c8783090f645744673130.camel@redhat.com> Subject: Re: [PATCH] KVM: x86: fix uninitialized variable use on KVM_REQ_TRIPLE_FAULT From: Maxim Levitsky To: Paolo Bonzini , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Dan Carpenter Date: Wed, 30 Nov 2022 19:35:18 +0200 In-Reply-To: <20221130161531.891135-1-pbonzini@redhat.com> References: <20221130161531.891135-1-pbonzini@redhat.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.5 (3.36.5-2.fc32) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2022-11-30 at 11:15 -0500, Paolo Bonzini wrote: > If a triple fault was fixed by kvm_x86_ops.nested_ops->triple_fault (by > turning it into a vmexit), there is no need to leave vcpu_enter_guest(). > Any vcpu->requests will be caught later before the actual vmentry, > and in fact vcpu_enter_guest() was not initializing the "r" variable. > Depending on the compiler's whims, this could cause the > x86_64/triple_fault_event_test test to fail. > > Cc: Maxim Levitsky > Fixes: 92e7d5c83aff ("KVM: x86: allow L1 to not intercept triple fault") > Signed-off-by: Paolo Bonzini > --- > arch/x86/kvm/x86.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c > index 246bdc9a9154..7f850dfb4086 100644 > --- a/arch/x86/kvm/x86.c > +++ b/arch/x86/kvm/x86.c > @@ -10280,8 +10280,8 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu) > vcpu->run->exit_reason = KVM_EXIT_SHUTDOWN; > vcpu->mmio_needed = 0; > r = 0; > + goto out; > } > - goto out; > } > if (kvm_check_request(KVM_REQ_APF_HALT, vcpu)) { > /* Page is swapped out. Do synthetic halt */ I had the same patch waiting to be sent, so: Reviewed-by: Maxim Levitsky But we need to add the orignal reporter of this bug as well: Reported-by: Dan Carpenter Best regards, Maxim Levitsky