Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp3158396rwj; Mon, 19 Dec 2022 14:04:02 -0800 (PST) X-Google-Smtp-Source: AA0mqf51th3c8jsEqALCdZVfvUIH4GGLl92M4+V9zmEzYFHHPSloahK/9MEoM07Zv0K6DcW9Z+qw X-Received: by 2002:a17:90b:33c8:b0:219:94b2:78a with SMTP id lk8-20020a17090b33c800b0021994b2078amr44868652pjb.30.1671487442194; Mon, 19 Dec 2022 14:04:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671487442; cv=none; d=google.com; s=arc-20160816; b=guX2LDUh4ymnYNj/kEFFpqg2zd1yC6cvKXgSxS2l5W0q7wCCCYGI/ccvlr5Gg8pmKR ZHGdHY9ABz27m2PfEYpJcO8uKAJ48I1R56JOGc9+IaENJVM2K63N/PlYGGhwaFidyy4H hu1U/4Y/grJXDmaXpHIBkHBWrQ5U3YB4MGuzbDmhdlOShFwjH3GMVVdW+AA/XScekOT1 /eniv0sb2JitvW62csOW5S/dK/h/folDyP3oxgpThCI1d5UXKYhSIHRlsuvx3mYvmoKH 7hMKRZwR+Mkx1NVKt7nMsZWCRiRA3PoYmTlXNLQeneFh2BsO5U0JS1mZ4AKAuuopOamA 85nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=AP0DPgy6juzYjbnmoSK4DSIse02YvBVHuic1zb1crI0=; b=vJ2r7WFfsVgbhx6v1goJEudM1+hfNnVvIKxKCJXoZvCiFdz8PkQrRvkQmfVAecQMy+ 6OyVdoDCXy2PPcnzINSGcj6ORdD7tJhkBSirzkO46ARa2pFMg7cQL/XEXOqZZRfowOQH e5FYc1V+txOkH0Aw/7L647lMTHoJCCLSI1gJ7Eek7SPXjQG0yhcEM/Q8Lhx5f9wShLwI cR8jHNeHu0dJxA6biHonHoOq6dsJ0pveE6hD6/VPR+jwNqISBTREDCnIc7jYUh52ox6x B1IRl+aeGxGNoyS6Sos7/hA3no8TXeBzWVz2jbbadyEKp61hGsvFEEOp8ezWXGu28sKV KqhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=n2Cb9Gin; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id oe15-20020a17090b394f00b0020087bc6415si17269687pjb.16.2022.12.19.14.03.52; Mon, 19 Dec 2022 14:04:02 -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=@google.com header.s=20210112 header.b=n2Cb9Gin; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232465AbiLSU5E (ORCPT + 70 others); Mon, 19 Dec 2022 15:57:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232473AbiLSU4x (ORCPT ); Mon, 19 Dec 2022 15:56:53 -0500 Received: from mail-pl1-x634.google.com (mail-pl1-x634.google.com [IPv6:2607:f8b0:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 03ADFA1A6 for ; Mon, 19 Dec 2022 12:56:53 -0800 (PST) Received: by mail-pl1-x634.google.com with SMTP id l10so10221576plb.8 for ; Mon, 19 Dec 2022 12:56:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=AP0DPgy6juzYjbnmoSK4DSIse02YvBVHuic1zb1crI0=; b=n2Cb9GinsIjyEaT+YGxcLDI2zefP9STnyh6mk+easKE+YmRAE9neZPO5KKQ0un7hzA 1WfQoF2Qy0Oo6ffwsDhxOVc59fCZU/OEXw2pDj+gQV0719Bol/qBcaBjr/N/1fCixHbV ii3Mixw1qykkBdRq56vPuUoU5eSuiWj0Y/li7hPZ1nkZn0PUrxr1Ssco3G6XWTYk0jUX q4f7k/NwuXW5lT7SorZpgTcJN3pVISAhO39PNgwLfXd7DlNY8/GHIY8XYdFgsXUjmFu0 W9mV9ZnGjHaq6eAnzo7i3kzYthj9wRa40zLu/snuft72nTrG+Y3Azx55N1JgbakviMQY s+6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=AP0DPgy6juzYjbnmoSK4DSIse02YvBVHuic1zb1crI0=; b=Vbgv8s2rzvbK+ZcMmytE4oKknC585Vj4NmyOVNN/satdsYbCvxt4VjVZy5DoOPZvj1 Zkyba78EhqdmK60cTMAKaVrTf4taHsOHkwE9ZZodHG2I/TJD1WdDk8RxEeNj5TWAQi7E nXkEfruLTMYshPQt0653BJ6CCuI7BrF3020aSqNaO7PrEjz+BlndRdkYwZhiF8Aih+Ws d6RHBCYYEDx9PTpB7yh6SD8KXQzr/FEDsvU8NA349VPb6ICCg6S5aZvoVJQTWqA6OMMZ AAPTjxFhHNh6chFYBQTohDGG2CPgGOaYIrl8L69iHUms5ZWov9E2YFzCUpdtA6A6utcn PTQQ== X-Gm-Message-State: AFqh2kpKQ374rss5x1KZgIGpQGMBz5Uti7ZI4FQVayPMjnG7+g3gjXip mJT0m34aTbIKpKwM2HPdwSQ4yQ== X-Received: by 2002:a17:902:e5cd:b0:189:b910:c6d2 with SMTP id u13-20020a170902e5cd00b00189b910c6d2mr1353085plf.1.1671483412369; Mon, 19 Dec 2022 12:56:52 -0800 (PST) Received: from google.com (7.104.168.34.bc.googleusercontent.com. [34.168.104.7]) by smtp.gmail.com with ESMTPSA id q18-20020a17090311d200b00188f07c9eedsm7601657plh.176.2022.12.19.12.56.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Dec 2022 12:56:51 -0800 (PST) Date: Mon, 19 Dec 2022 20:56:48 +0000 From: Sean Christopherson To: coverity-bot Cc: linux-kernel@vger.kernel.org, x86@kernel.org, Borislav Petkov , Ingo Molnar , "H. Peter Anvin" , Thomas Gleixner , Paolo Bonzini , Sean Christopherson , kvm@vger.kernel.org, Dave Hansen , "Gustavo A. R. Silva" , linux-next@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: Coverity: handle_vmclear(): Error handling issues Message-ID: References: <202212010825.C23022D@keescook> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202212010825.C23022D@keescook> X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL 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 Thu, Dec 01, 2022, coverity-bot wrote: > Hello! > > This is an experimental semi-automated report about issues detected by > Coverity from a scan of next-20221201 as part of the linux-next scan project: > https://scan.coverity.com/projects/linux-next-weekly-scan > > You're getting this email because you were associated with the identified > lines of code (noted below) that were touched by commits: > > Fri Dec 14 17:59:46 2018 +0100 > 55d2375e58a6 ("KVM: nVMX: Move nested code to dedicated files") > > Coverity reported the following: > > *** CID 1527765: Error handling issues (CHECKED_RETURN) > arch/x86/kvm/vmx/nested.c:5269 in handle_vmclear() > 5263 */ > 5264 if (likely(!guest_cpuid_has_evmcs(vcpu) || > 5265 !evmptr_is_valid(nested_get_evmptr(vcpu)))) { > 5266 if (vmptr == vmx->nested.current_vmptr) > 5267 nested_release_vmcs12(vcpu); > 5268 > vvv CID 1527765: Error handling issues (CHECKED_RETURN) > vvv Calling "kvm_vcpu_write_guest" without checking return value (as is done elsewhere 7 out of 8 times). > 5269 kvm_vcpu_write_guest(vcpu, > 5270 vmptr + offsetof(struct vmcs12, > 5271 launch_state), > 5272 &zero, sizeof(zero)); > 5273 } else if (vmx->nested.hv_evmcs && vmptr == vmx->nested.hv_evmcs_vmptr) { > 5274 nested_release_evmcs(vcpu); > > If this is a false positive, please let us know so we can mark it as > such, or teach the Coverity rules to be smarter. If not, please make > sure fixes get into linux-next. :) For patches fixing this, please > include these lines (but double-check the "Fixes" first): > > Reported-by: coverity-bot > Addresses-Coverity-ID: 1527765 ("Error handling issues") > Fixes: 55d2375e58a6 ("KVM: nVMX: Move nested code to dedicated files") Nit on the bot, if it's going to provide a Fixes without human verification, then it should probably try to bisect (which I realize could get quite nasty). Both this VMCLEAR issue and the SMM issue report bogus Fixes due to code movement. If the blamed commit on this won't hadn't been so obviously wrong I likely would have copy+pasted without ever verifying. Maybe just omit the Fixes entirely and rely on the above "touched by commits" to provide the developer with the hint?