From nobody Sat May 11 04:27:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.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=1653396176; cv=none; d=zohomail.com; s=zohoarc; b=kUtD8CGkQ9PFwxVA1H0uV3A769BkKdfytdWPjFyEMFnkV+aJJL5inc5NZnbTfmRSh3xu7qDtA1dtMfHtJSuRG7C322BOYbzrfoHS1vhK+aJQ6HAn+nar0sjnbE9acN4rY+zlqlpn82yc7XpDqJABn4c9+sgraxPuBotwYG2GIWI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1653396176; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=TRpV/FA2LNe+eYM5/UmPZmduqH8N9Hx9yO7H7jdDFOM=; b=aabTn54fQJ6lUNV3EwF8eI9akRWMvFS8tOsmmTsbu0ohGt/ERrfpmw/y5UsWb7/Vaha5VHxYrqDLoZwD6kfSkePKch04HvLG/VWe4P30piDY6ZITTJUJh+8cCXS8lAUvaOBP2KIJLK4Mqxwh20BiXOyLlNqmm5R3Wwjyk/5oyAQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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.133.124]) by mx.zohomail.com with SMTPS id 1653396176351303.50820921732225; Tue, 24 May 2022 05:42:56 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [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-322-q5xxakYsPpqRLNK2M41bPA-1; Tue, 24 May 2022 08:42:51 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A7CDB3804078; Tue, 24 May 2022 12:42:49 +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 7086B2166B25; Tue, 24 May 2022 12:42:48 +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 3F9A7194EB8A; Tue, 24 May 2022 12:42:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 3975E194EB89 for ; Tue, 24 May 2022 12:42:47 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 1A744112131E; Tue, 24 May 2022 12:42:47 +0000 (UTC) Received: from virval.usersys.redhat.com (unknown [10.43.2.187]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EE6D0112131B for ; Tue, 24 May 2022 12:42:46 +0000 (UTC) Received: by virval.usersys.redhat.com (Postfix, from userid 500) id E4FBA2445E4; Tue, 24 May 2022 14:42:45 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1653396174; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=TRpV/FA2LNe+eYM5/UmPZmduqH8N9Hx9yO7H7jdDFOM=; b=TPRVgHnbPGyU6ZbalW+Oeq87dM2b8HBXFhsMoNC3XAPQE1zGNtLUGpLtcIgCFdoLFrVS+v MFvTezGDiyqYka6m9Xus5trb9qzoeMKf+e4oJi5GrRCDBusMx7wmzTR7OMblUYTpWEHskB 9JQEujNTMI1XPc8VzjVDF+qkyu+eW+0= X-MC-Unique: q5xxakYsPpqRLNK2M41bPA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH] qemu: Lock vm object in qemuProcessHandleMemoryFailure Date: Tue, 24 May 2022 14:42:43 +0200 Message-Id: <78db58aa254a69acef7dd527e8a2d35574c8c175.1653396163.git.jdenemar@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 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: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com 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: 1653396178120100001 Content-Type: text/plain; charset="utf-8" This event handler was accessing a vm object without locking it first. Signed-off-by: Jiri Denemark --- src/qemu/qemu_process.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 033d3d5bc6..6f70d5d065 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -1773,6 +1773,8 @@ qemuProcessHandleMemoryFailure(qemuMonitor *mon G_GNU= C_UNUSED, virDomainMemoryFailureActionType action; unsigned int flags =3D 0; =20 + virObjectLock(vm); + switch (mfp->recipient) { case QEMU_MONITOR_MEMORY_FAILURE_RECIPIENT_HYPERVISOR: recipient =3D VIR_DOMAIN_EVENT_MEMORY_FAILURE_RECIPIENT_HYPERVISOR; @@ -1809,6 +1811,9 @@ qemuProcessHandleMemoryFailure(qemuMonitor *mon G_GNU= C_UNUSED, flags |=3D VIR_DOMAIN_MEMORY_FAILURE_RECURSIVE; =20 event =3D virDomainEventMemoryFailureNewFromObj(vm, recipient, action,= flags); + + virObjectUnlock(vm); + virObjectEventStateQueue(driver->domainEventState, event); } =20 --=20 2.35.1