From nobody Tue Apr 30 05:42:41 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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=1575988588; cv=none; d=zohomail.com; s=zohoarc; b=K7/aNoYBk101TRE+dUY99PBr8pTcANbleCXi4xV3f3Nuwku+FfBROeyjsKuekeH9+lC6ScWjkPfBmuZY69ELsA1xj8KcQp8/J7jg5WFcrvL74HyEYwgB8EIS4bvQip7pB7Ua3alcyra0UVYN+/GSU+6qrircVJrB1+1D8Szt9Gs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575988588; 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=zLH0MW4oaZ/vHTDYBYDj8rWz0x73s15iMI81KWAu15U=; b=f+c3pnKEG/V7vg2q5B0olk8pV4IMVUUp2fgAvUky5m1c0j0uhxnNEIpTTRMMD4HDup9N2KcaR1OJ3Xu5/YiLSQXwsaqsU+M1B3OWmT3NMlokwxc/VK7rzoB7u/qhizefjf0mOkNQvbhu3HiWcHytoJCSfFXCfVPFegGJW+mi8ZA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1575988588114993.308849302338; Tue, 10 Dec 2019 06:36:28 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-131-_hk8p089Pbmggyfh_yeMog-1; Tue, 10 Dec 2019 09:36:25 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7D361800EC0; Tue, 10 Dec 2019 14:36:19 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 420F119756; Tue, 10 Dec 2019 14:36:19 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 242FA8356B; Tue, 10 Dec 2019 14:36:18 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xBAEaG7q029214 for ; Tue, 10 Dec 2019 09:36:16 -0500 Received: by smtp.corp.redhat.com (Postfix) id C4B8019756; Tue, 10 Dec 2019 14:36:16 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.43.2.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2497419C6A; Tue, 10 Dec 2019 14:36:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575988586; 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=zLH0MW4oaZ/vHTDYBYDj8rWz0x73s15iMI81KWAu15U=; b=UoLdmvwpseo13j61by2epi5xy35RD4HVZmhJnLPJbJI4NBqzeEUoXlr63vrcPfrPcUMBfb 3eWvl16DJ1PGyxdj/5UAIyqBrdiGnfkuRVXIHhd+79n9aICfVE2IxsEOACR9jeQeVbxBCq GsHzjf1wrxcmow4BERq6UYFKbjZd4T4= From: Pavel Mores To: libvir-list@redhat.com Date: Tue, 10 Dec 2019 15:36:08 +0100 Message-Id: <20191210143608.28865-2-pmores@redhat.com> In-Reply-To: <20191210143608.28865-1-pmores@redhat.com> References: <20191210143608.28865-1-pmores@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: Pavel Mores Subject: [libvirt] [PATCH v2 1/1] qemu: fix concurrency crash bug in snapshot revert X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: _hk8p089Pbmggyfh_yeMog-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" This commit aims to fix https://bugzilla.redhat.com/show_bug.cgi?id=3D1610207 The cause was apparently incorrect handling of jobs in snapshot revert code which allowed a thread executing snapshot delete to begin job while snapshot revert was still running on another thread. The snapshot delete thread then waited on a condition variable in qemuMonitorSend() while the revert thread finished, changing (and effectively corrupting) the qemuMonitor structure under the delete thread which led to its crash. The incorrect handling of jobs in revert code was due to the fact that although qemuDomainRevertToSnapshot() correctly begins a job at the start, the job was implicitly ended when qemuProcessStop() was called because the job lives in the QEMU driver's private data (qemuDomainObjPrivate) that was purged during qemuProcessStop(). This fix prevents qemuProcessStop() from clearing jobs as the idea of qemuProcessStop() clearing jobs seems wrong in the first place. It was (inadvertently) introduced in commit 888aa4b6b9db65e3db273341e79846, which is effectively reverted by the second hunk of this commit. To preserve the desired effects of the faulty commit, the first hunk is included as suggested by Michal. Signed-off-by: Pavel Mores Reviewed-by: Daniel Henrique Barboza Reviewed-by: Michal Privoznik --- src/qemu/qemu_domain.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 6f53e17b6a..e4a1bccc18 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -403,6 +403,8 @@ qemuDomainObjRestoreJob(virDomainObjPtr obj, static void qemuDomainObjFreeJob(qemuDomainObjPrivatePtr priv) { + qemuDomainObjResetJob(priv); + qemuDomainObjResetAsyncJob(priv); VIR_FREE(priv->job.current); VIR_FREE(priv->job.completed); virCondDestroy(&priv->job.cond); @@ -2161,9 +2163,6 @@ qemuDomainObjPrivateDataClear(qemuDomainObjPrivatePtr= priv) virBitmapFree(priv->migrationCaps); priv->migrationCaps =3D NULL; =20 - qemuDomainObjResetJob(priv); - qemuDomainObjResetAsyncJob(priv); - virHashRemoveAll(priv->blockjobs); virHashRemoveAll(priv->dbusVMStates); =20 --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list