From nobody Tue Jun 18 11:35:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1689684132; cv=none; d=zohomail.com; s=zohoarc; b=XV0cI9L9cuayAy0wX0wQJrVSvV6xKneQ6bW5cdAvPkQqwuXVLHG/jxgOsqeFLseS2nXcC7okLXULRn3wfEP3UVbHMe0+0LgW0soPCfumtnWTW5Y7QFfPG6maMKoXIBUnObNmChs0D1ybxJsqlIkk+TCJwbhbmnV69P+5WXqQsy4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689684132; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=D3126hJxLGHkuw49TmVvvjc6OWOshxsQ4PWjIBka45M=; b=I51AHtfVeG8e28CebgU7G5YQWj6XR5GsE25MPae8UX+C2cOil86IWiB37adBhk7r2zqrdjnA+cSgB8Cgmv53ozHdh3kFcCc/ASNHpinQ+iSyYc9AUhFf+lFQKpIpjlz/mBzfvaKFqrItZ+F2g7bvqIYIfZpBCNzS4ddIkPRZR6A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1689684132001359.3960921588081; Tue, 18 Jul 2023 05:42:12 -0700 (PDT) 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-381-ZgpMdJiNM2G8P0VVtCsMRg-1; Tue, 18 Jul 2023 08:42:06 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D26AF185A7AD; Tue, 18 Jul 2023 12:42:02 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id B304E40C2072; Tue, 18 Jul 2023 12:42:02 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id EED68194658F; Tue, 18 Jul 2023 12:41:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 3998B194658D for ; Tue, 18 Jul 2023 12:41:56 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 1E5B340C2072; Tue, 18 Jul 2023 12:41:51 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.45.242.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6677F40C206F; Tue, 18 Jul 2023 12:41:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1689684131; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=D3126hJxLGHkuw49TmVvvjc6OWOshxsQ4PWjIBka45M=; b=detOm95UnqppOy1QT5bvPhN9njivGQirUirwVYISqDSi2d1J4yzlIBCHsEL+pkyj+XwmyB Uyvxd2ugNQH+Dqmu2D8s17cnChAjiuPCe+heHYp6iLI07jeaYnEFGGpxf9jAwsfq2ix3kq 4qtkfi0ncAmqdNlzYrvYaSUw0QlgJ7A= X-MC-Unique: ZgpMdJiNM2G8P0VVtCsMRg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 1/2] file reproducer Date: Tue, 18 Jul 2023 14:41:47 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: libvirt-security@redhat.com Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1689684132242100001 Content-Type: text/plain; charset="utf-8" To reproduce the issue run many instances of 'virsh vol-info /some/path/to/a/storage/pool' --- src/storage/storage_util.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c index d39aa92eae..a478a85a05 100644 --- a/src/storage/storage_util.c +++ b/src/storage/storage_util.c @@ -2289,6 +2289,8 @@ virStorageBackendVolRefreshLocal(virStoragePoolObj *p= ool G_GNUC_UNUSED, { int ret; + usleep(5000); + /* Refresh allocation / capacity / permissions info in case its change= d */ if ((ret =3D virStorageBackendUpdateVolInfo(vol, false, VIR_STORAGE_VOL_FS_OPEN_FLAG= S, --=20 2.41.0 From nobody Tue Jun 18 11:35:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1689684123; cv=none; d=zohomail.com; s=zohoarc; b=F8C0UUYrsJkXteElmP5VWGcxoUYRweKgFh9Z/oulURCAlWNUn2+HqTty+coG3w06ZRKK2dk8tEr8dAMz2DUvT6Xjs7Z0kso+SlEmJIQ3LiZpoq3CNYLtHViedUmP9mDS8impSY8roLTWcbIliSwAHbQOZ6fUSDLaSnj1UkIOIag= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689684123; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=/Hvqm8kJ2InypCVA2J+Ud7WIgvb1I/+Po2mhEQW9GRs=; b=FG7W4mlBajshDY9Xz//urzi7L1FSE4ffU1gz5nYQIbbjtYz54njmuEkeRVy5JsXsQgVd7k4v4JBhsnkNgMHncpjw1StX8olaHHxC3o7d490HwKrMfnPrPRjbIKLAxdFOa5eWrams5Nk2mGJbvL2hSQYXiEnzZ3yLoZRqir628uk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1689684123266102.66018732037844; Tue, 18 Jul 2023 05:42:03 -0700 (PDT) Received: from mimecast-mx02.redhat.com (66.187.233.73 [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-539-ea5dO3ohODee39OG0SUkSg-1; Tue, 18 Jul 2023 08:41:58 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 46E1C3C0FC9A; Tue, 18 Jul 2023 12:41:55 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 813FF1121314; Tue, 18 Jul 2023 12:41:54 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 63762194658F; Tue, 18 Jul 2023 12:41:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 4805D194658F for ; Tue, 18 Jul 2023 12:41:52 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 26B8140C2075; Tue, 18 Jul 2023 12:41:52 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.45.242.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7559C40C206F; Tue, 18 Jul 2023 12:41:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1689684122; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=/Hvqm8kJ2InypCVA2J+Ud7WIgvb1I/+Po2mhEQW9GRs=; b=iV9HLvzRxz/r0QWdJKbOBCki3g2FM4uLm6hlkBN0YjK7zkOgX9eOoVP3PuQuyDqZe8pZVX 2NZHmlGc5l/4w7q/LN5Hs9mP/vbEkEjx2hYDiBqJtMVBFMvOOhe2n5t1h/g8/TrgfVqmzJ t1pbAgYT299J2U+Tu4jqWiEkYI89iqY= X-MC-Unique: ea5dO3ohODee39OG0SUkSg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 2/2] storage: Fix returning of locked objects from 'virStoragePoolObjListSearch' Date: Tue, 18 Jul 2023 14:41:48 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: libvirt-security@redhat.com Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1689684123661100001 Content-Type: text/plain; charset="utf-8" 'virStoragePoolObjListSearch' explicitly documents that it's returning a pointer to a locked and ref'd pool that maches the lookup function. This was not the case as in commit 0c4b391e2a9 (released in libvirt-8.3.0) the code was accidentally converted to use 'VIR_LOCK_GUARD' which auto-unlocked it when leaving the scope, even when the code was originally "leaking" the lock. Revert the corresponding conversion and add a comment that this function is intentionally leaking a locked object. Fixes: 0c4b391e2a9 Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D2221851 Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/virstorageobj.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/conf/virstorageobj.c b/src/conf/virstorageobj.c index 7010e97d61..59fa5da372 100644 --- a/src/conf/virstorageobj.c +++ b/src/conf/virstorageobj.c @@ -454,11 +454,16 @@ virStoragePoolObjListSearchCb(const void *payload, virStoragePoolObj *obj =3D (virStoragePoolObj *) payload; struct _virStoragePoolObjListSearchData *data =3D (struct _virStoragePoolObjListSearchData *)opaque; - VIR_LOCK_GUARD lock =3D virObjectLockGuard(obj); + virObjectLock(obj); + + /* If we find the matching pool object we must return while the object= is + * locked as the caller wants to return a locked object. */ if (data->searcher(obj, data->opaque)) return 1; + virObjectUnlock(obj); + return 0; } --=20 2.41.0