From nobody Sun Feb 8 17:22:28 2026 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=1692281149; cv=none; d=zohomail.com; s=zohoarc; b=nZi73gf2NMWA2sjSM0Xr6HQQ7VstEduPPYvWE89JjesgQ3oxTZfOYOiK8oH9zA1I4RyGC34Hg7nDFFbyo//m+m3fdAqFXi2A2c8fc7EsLE+hxpR7buMZzdA/XdIFIrH2AqGKVorR4B6SqLRNwZJXjTTUkMxFtJZRf3y25jnJW4E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1692281149; h=Content-Type:Content-Transfer-Encoding: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=jxkP98PAsHQ6qfXvz6MCE9x+I1THz+MqFs0bt/NR0LY=; b=Aqg4JuJeWJZ/dLxrJKh2Sqn6/8fKzi1ZDEG1VH7iDwHarNeAk9K33Aps65ZlAFaTf0DYtJC1vAYLPgIMUoNIOikoO9rbHHr/Pl8s37JY4Sh/1V2RYFuVspNmz/1JjZL5OmiTP85U7TjlJzx1jSFTU7D0S6v+X1QROwuYYQk+exo= 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 1692281148747741.3335677944175; Thu, 17 Aug 2023 07:05:48 -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-56-gy1yO6KJNCmt2rLR_hwovQ-1; Thu, 17 Aug 2023 10:05:41 -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 757758DC665; Thu, 17 Aug 2023 14:05:37 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 22CD32166B2D; Thu, 17 Aug 2023 14:05:35 +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 E837619465B9; Thu, 17 Aug 2023 14:05:24 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 54BA51946588 for ; Thu, 17 Aug 2023 14:05:22 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 50BAFC15E69; Thu, 17 Aug 2023 14:05:22 +0000 (UTC) Received: from localhost.localdomain (unknown [10.43.2.36]) by smtp.corp.redhat.com (Postfix) with ESMTP id EC75EC15BAE for ; Thu, 17 Aug 2023 14:05:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1692281147; 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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=jxkP98PAsHQ6qfXvz6MCE9x+I1THz+MqFs0bt/NR0LY=; b=QmegacdFlYXLlADcbWJn6r6UJxGurjYF/mkepOBI9YjTWlWoekPLegOJ0MzKj0LFHblcgW orM/mdv8pAME0kYNqFKCwpBmBBQJB8zR0sf1RYSj4CkLJbIDVIcUFgXtHsClck5730K08w FZ1ZwAzin9yDbKvQHq3UACNSgkVWNMs= X-MC-Unique: gy1yO6KJNCmt2rLR_hwovQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 6/9] qemu_driver: validate mem->model on MEMORY_DEVICE_SIZE_CHANGE event Date: Thu, 17 Aug 2023 16:05:13 +0200 Message-ID: <6e2fad4caf6d625715bc6b545c8bb62a6487aba6.1692281096.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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 3.1 on 10.11.54.6 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: 1692281264051100001 Content-Type: text/plain; charset="utf-8"; x-default="true" When guest acknowledges change in size of virtio-mem (portion that's exposed to the guest), QEMU emits MEMORY_DEVICE_SIZE_CHANGE event. We process it in processMemoryDeviceSizeChange(). So far, QEMU emits the even only for virtio-mem (as that's the only memory device model that allows live changes to its size). Nevertheless, if this ever changes, validate the memory model upon processing the event as the rest of the code blindly expects virtio-mem model. Signed-off-by: Michal Privoznik --- src/qemu/qemu_driver.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index f8039160f4..f0eda71c4f 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -3998,6 +3998,13 @@ processMemoryDeviceSizeChange(virQEMUDriver *driver, goto endjob; } =20 + if (mem->model !=3D VIR_DOMAIN_MEMORY_MODEL_VIRTIO_MEM) { + VIR_DEBUG("Received MEMORY_DEVICE_SIZE_CHANGE event for unexpected= memory model (%s), expected %s", + virDomainMemoryModelTypeToString(mem->model), + virDomainMemoryModelTypeToString(VIR_DOMAIN_MEMORY_MODEL= _VIRTIO_MEM)); + goto endjob; + } + /* If this looks weird it's because it is. The balloon size * as reported by QEMU does not include any of @currentsize. * It really contains just the balloon size. But in domain --=20 2.41.0