Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 80B68C5478C for ; Wed, 28 Feb 2024 13:04:39 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.686597.1068798 (Exim 4.92) (envelope-from ) id 1rfJbo-0004lF-AX; Wed, 28 Feb 2024 13:04:28 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 686597.1068798; Wed, 28 Feb 2024 13:04:28 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rfJbo-0004l8-7h; Wed, 28 Feb 2024 13:04:28 +0000 Received: by outflank-mailman (input) for mailman id 686597; Wed, 28 Feb 2024 13:04:27 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rfJbn-0004l2-Fz for xen-devel@lists.xenproject.org; Wed, 28 Feb 2024 13:04:27 +0000 Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [2a00:1450:4864:20::535]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id e5ddefb1-d639-11ee-a1ee-f123f15fe8a2; Wed, 28 Feb 2024 14:04:25 +0100 (CET) Received: by mail-ed1-x535.google.com with SMTP id 4fb4d7f45d1cf-5655c7dd3b1so1590576a12.0 for ; Wed, 28 Feb 2024 05:04:25 -0800 (PST) Received: from [10.156.60.236] (ip-037-024-206-209.um08.pools.vodafone-ip.de. [37.24.206.209]) by smtp.gmail.com with ESMTPSA id jx11-20020a170906ca4b00b00a3f480154a3sm1828200ejb.65.2024.02.28.05.04.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 28 Feb 2024 05:04:24 -0800 (PST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: e5ddefb1-d639-11ee-a1ee-f123f15fe8a2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1709125465; x=1709730265; darn=lists.xenproject.org; h=content-transfer-encoding:in-reply-to:autocrypt:from:cc:references :to:content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=F4c1l7EwRkTAAhcVJbRO5x9wRcKnN4wAaQmkchFWJoQ=; b=IUWM8bN8myae8/2B1LLExvev0bgEpagLqxLr7HEAdUnhY4YpYX7+Ec2s808gnlFd/I BOOU/NI19UtgYVc4r+K9MRnTHj/sOQ77YBs8QU3XNRKDCLtzLqhkUSxgffc05KkWNZ82 HVPViJfOrB/JnPaAijAogHtpgSlJrpgPzuesKJt4QdG5nYjk4jcjKAtqYP0pmnfvyMrD sdP8N/bnGveihHwdW64af1LU5eAjHDKVjiDN3M5n0PEawCer12Zyv3BndAjAWghsr4CX M7B8I3/RM1c8DtAsDROeXsw5kMUGQ1EVDPxKNYrBpyGzgo9bHUYgPAa5LNpjPoZ9X6S1 394Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709125465; x=1709730265; h=content-transfer-encoding:in-reply-to:autocrypt:from:cc:references :to:content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=F4c1l7EwRkTAAhcVJbRO5x9wRcKnN4wAaQmkchFWJoQ=; b=WEEE3cHt1Ob8FSotDLGZ1hy7Kfb118NSeWxBaZ4XiTeMAs/yck4u8LVPEcuE3EHtJR Ci/H1OzCVX4qXW7N5qKFrAcUU/aNDiYrUD4G+3g8fuRTudv2ngTNolATzTru+dry4bqV X1kC8NW9P35OB85RoBZPTgkGSL8HDcPEZbBdjdwfUyhDOU6O0esb2u6KkGT/JQpTwoAr gG0qxeofK1hIkE1XieHgxZnGeco7Ak0DMvUJ8iEyKYPuWJKUzIm/gku+4oh6ekTcL1Lq tmkr+LcD1SE/EhOmKOv+WVJNc8rDKQupKY5pTQUz4ZVCMDMx1Ntozxh+4LSvzbog0g+V ejig== X-Gm-Message-State: AOJu0YygD8TBpNxmSgYp71NbnMkkobMOdfnDIL3b/WvGO8B42KV0FiSi rom9HYkxYJE+Awr6cBagKY+eR7jcfPxKdWhh7grHxD9a64g/nNEAVrZitzFSGQ== X-Google-Smtp-Source: AGHT+IFJ5qXRpw9LURj7SzE9CzWlF5Db2zX+HB/mIyRJvu85ptcaDkmOUAEoF5LAyypvRjqlQ4buBg== X-Received: by 2002:a17:906:a05a:b0:a3e:69ff:141f with SMTP id bg26-20020a170906a05a00b00a3e69ff141fmr2127953ejb.33.1709125464856; Wed, 28 Feb 2024 05:04:24 -0800 (PST) Message-ID: Date: Wed, 28 Feb 2024 14:04:23 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Fwd: New Defects reported by Coverity Scan for XenProject Content-Language: en-US To: Andrew Cooper References: <65df054dd791_2895d52c84469bd9989838e@prd-scan-dashboard-0.mail> <27fad7c4-905b-4181-9882-f383eb194032@citrix.com> Cc: xen-devel , =?UTF-8?Q?Roger_Pau_Monn=C3=A9?= , Stewart Hildebrand From: Jan Beulich Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGm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ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 28.02.2024 13:19, Andrew Cooper wrote: > Take 2, hopefully with Stewart's correct email address this time. > > ~Andrew > > On 28/02/2024 12:17 pm, Andrew Cooper wrote: >> Not sure how well this is going to be formatted, but there's one new and >> potentially interesting issue found by Coverity. To be honest I didn't consider this interesting at all, but instead a false positive due to limited insight that the tool has. But maybe I was wrong and you see something I didn't see? vpci_process_pending() is vCPU-local (run from the guest resume path), and hence there simply are no two threads who want to look at the field. Storing NULL into it is merely a kind of progress indicator, relevant to the given vCPU only. Jan >> ----8<---- >> >> New defect(s) Reported-by: Coverity Scan >> Showing 1 of 1 defect(s) >> >> >> ** CID 1592633: (LOCK_EVASION) >> /xen/drivers/vpci/header.c: 229 in vpci_process_pending() >> /xen/drivers/vpci/header.c: 189 in vpci_process_pending() >> /xen/drivers/vpci/header.c: 239 in vpci_process_pending() >> >> >> ________________________________________________________________________________________________________ >> *** CID 1592633: (LOCK_EVASION) >> /xen/drivers/vpci/header.c: 229 in vpci_process_pending() >> 223 224 /* Clean all the rangesets */ >> 225 for ( i = 0; i < ARRAY_SIZE(header->bars); i++ ) >> 226 if ( !rangeset_is_empty(header->bars[i].mem) ) >> 227 rangeset_purge(header->bars[i].mem); >> 228 >>>>> CID 1592633: (LOCK_EVASION) >>>>> Thread1 sets "pdev" to a new value. Now the two threads have an >>>>> inconsistent view of "pdev" and updates to fields of "pdev" or >>>>> fields correlated with "pdev" may be lost. >> 229 v->vpci.pdev = NULL; >> 230 231 read_unlock(&v->domain->pci_lock); >> 232 233 if ( !is_hardware_domain(v->domain) ) >> 234 domain_crash(v->domain); >> /xen/drivers/vpci/header.c: 189 in vpci_process_pending() >> 183 return false; >> 184 185 read_lock(&v->domain->pci_lock); >> 186 187 if ( !pdev->vpci || (v->domain != pdev->domain) ) >> 188 { >>>>> CID 1592633: (LOCK_EVASION) >>>>> Thread1 sets "pdev" to a new value. Now the two threads have an >>>>> inconsistent view of "pdev" and updates to fields of "pdev" or >>>>> fields correlated with "pdev" may be lost. >> 189 v->vpci.pdev = NULL; >> 190 read_unlock(&v->domain->pci_lock); >> 191 return false; >> 192 } >> 193 194 header = &pdev->vpci->header; >> /xen/drivers/vpci/header.c: 239 in vpci_process_pending() >> 233 if ( !is_hardware_domain(v->domain) ) >> 234 domain_crash(v->domain); >> 235 236 return false; >> 237 } >> 238 } >>>>> CID 1592633: (LOCK_EVASION) >>>>> Thread1 sets "pdev" to a new value. Now the two threads have an >>>>> inconsistent view of "pdev" and updates to fields of "pdev" or >>>>> fields correlated with "pdev" may be lost. >> 239 v->vpci.pdev = NULL; >> 240 241 spin_lock(&pdev->vpci->lock); >> 242 modify_decoding(pdev, v->vpci.cmd, v->vpci.rom_only); >> 243 spin_unlock(&pdev->vpci->lock); >> 244 >> >