[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fwd: New Defects reported by Coverity Scan for XenProject


  • To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 28 Feb 2024 14:04:23 +0100
  • Autocrypt: addr=jbeulich@xxxxxxxx; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJebwkX+zF2jG5I1BfnO9g7KlotcA/v5ClMjgo6Gl MDY4HxoSRu3i1cqqSDtVlt+AOVBJBACrZcnHAUSuCXBPy0jOlBhxPqRWv6ND4c9PH1xjQ3NP nxJuMBS8rnNg22uyfAgmBKNLpLgAGVRMZGaGoJObGf72s6TeIqKJo/LtggAS9qAUiuKVnygo 3wjfkS9A3DRO+SpU7JqWdsveeIQyeyEJ/8PTowmSQLakF+3fote9ybzd880fSmFuIEJldWxp Y2ggPGpiZXVsaWNoQHN1c2UuY29tPsJgBBMRAgAgBQJZN5xEAhsDBgsJCAcDAgQVAggDBBYC AwECHgECF4AACgkQoDSui/t3IH4J+wCfQ5jHdEjCRHj23O/5ttg9r9OIruwAn3103WUITZee e7Sbg12UgcQ5lv7SzsFNBFk3nEQQCACCuTjCjFOUdi5Nm244F+78kLghRcin/awv+IrTcIWF hUpSs1Y91iQQ7KItirz5uwCPlwejSJDQJLIS+QtJHaXDXeV6NI0Uef1hP20+y8qydDiVkv6l IreXjTb7DvksRgJNvCkWtYnlS3mYvQ9NzS9PhyALWbXnH6sIJd2O9lKS1Mrfq+y0IXCP10eS FFGg+Av3IQeFatkJAyju0PPthyTqxSI4lZYuJVPknzgaeuJv/2NccrPvmeDg6Coe7ZIeQ8Yj t0ARxu2xytAkkLCel1Lz1WLmwLstV30g80nkgZf/wr+/BXJW/oIvRlonUkxv+IbBM3dX2OV8 AmRv1ySWPTP7AAMFB/9PQK/VtlNUJvg8GXj9ootzrteGfVZVVT4XBJkfwBcpC/XcPzldjv+3 HYudvpdNK3lLujXeA5fLOH+Z/G9WBc5pFVSMocI71I8bT8lIAzreg0WvkWg5V2WZsUMlnDL9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL
  • Cc: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Stewart Hildebrand <Stewart.Hildebrand@xxxxxxx>
  • Delivery-date: Wed, 28 Feb 2024 13:04:32 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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
>>
> 




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.