From nobody Sun Feb 8 23:35:18 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 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=1576079961; cv=none; d=zohomail.com; s=zohoarc; b=hgfVVcdSu85hMWyJv7KrFsSsgNetLgewdFn0jZbOLvt+nyNFnjD2c/CdD1j2E11v6SaSxiJ7U2zDIY7n51XtyePUQpAQKpWY+YG74u/kcO9J+NfXxPifqdHdSpRUey9Wdthny/n++dbjut0GoMDHksK633Y/n/D2cKgpNSUwhII= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576079961; 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=Pi/nQcom668aB8UTldQjaRecYIKoOnK68ok3QfD7RO4=; b=czp29Fqn//krWlTZYiYuE4lM+s2RrdXqZbB/J9y4qeqWXIY8i/Bopl5tkXeIHcNuhnNrNRjmAcCOCQhOFBW0rx+ZTOcRqhhgE0y59ybN0JcRawotxLk46YFMOtBqeCk5Md830+oPxEmb/GS9ouLMIWDdswnA5ACGwWevuCf5prs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 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-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 15760799611271008.229110270261; Wed, 11 Dec 2019 07:59:21 -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-83-ovxhrMPSN7e5hnWYjWP7hQ-1; Wed, 11 Dec 2019 10:58:56 -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 B43831005512; Wed, 11 Dec 2019 15:58:50 +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 85D2919481; Wed, 11 Dec 2019 15:58:50 +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 074F383716; Wed, 11 Dec 2019 15:58:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xBBFwc3n018606 for ; Wed, 11 Dec 2019 10:58:38 -0500 Received: by smtp.corp.redhat.com (Postfix) id 1D82560303; Wed, 11 Dec 2019 15:58:38 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-112-62.ams2.redhat.com [10.36.112.62]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0D62C60567; Wed, 11 Dec 2019 15:58:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576079960; 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=Pi/nQcom668aB8UTldQjaRecYIKoOnK68ok3QfD7RO4=; b=YCaqAmlT3aPEe5ZmIf4p7E/L/nIfC9yVH5J3EL1blfXcls/ynZ/VeZYJoLI0UryLrve69l fBHvVpPcF/Yvfe1U7ERlQxNORXRsNZZX1eY6flz8eFQopn2WojorMNLEKxdPufwuHuFDYd wo3Q40/ldbX9cHf8WM5y100zfvaTYFs= From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Wed, 11 Dec 2019 15:58:23 +0000 Message-Id: <20191211155823.1704464-4-berrange@redhat.com> In-Reply-To: <20191211155823.1704464-1-berrange@redhat.com> References: <20191211155823.1704464-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: Cole Robinson Subject: [libvirt] [PATCH v2 3/3] qemu: honour parseOpaque instead of refetching caps 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: ovxhrMPSN7e5hnWYjWP7hQ-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) The use of the parseOpaque parameter was mistakenly removed in commit 4a4132b4625778cf80acb9c92d06351b44468ac3 Author: Daniel P. Berrang=C3=A9 Date: Tue Dec 3 10:49:49 2019 +0000 conf: don't use passed in caps in post parse method causing the method to re-fetch qemuCaps that were already just fetched and put into parseOpaque. This is inefficient when parsing incoming XML, but for live XML this is more serious as it means we use the capabilities for the current QEMU binary on disk, rather than the running QEMU. That commit, however, did have a useful side effect of fixing a crasher bug in the qemu post parse callback introduced by commit 5e939cea896fb3373a6f68f86e325c657429ed3d Author: Jiri Denemark Date: Thu Sep 26 18:42:02 2019 +0200 qemu: Store default CPU in domain XML The qemuDomainDefSetDefaultCPU() method in that patch did not allow for the possibility that qemuCaps would be NULL and thus resulted in a SEGV. This shows a risk in letting each check in the post parse callback look for qemuCaps =3D=3D NULL. The safer option is to check once upfront and immediately stop (postpone) further validation. Signed-off-by: Daniel P. Berrang=C3=A9 --- src/qemu/qemu_domain.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 3e1bd52d9f..cf2e9aebd2 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -4854,16 +4854,18 @@ static int qemuDomainDefPostParse(virDomainDefPtr def, unsigned int parseFlags, void *opaque, - void *parseOpaque G_GNUC_UNUSED) + void *parseOpaque) { virQEMUDriverPtr driver =3D opaque; g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); - g_autoptr(virQEMUCaps) qemuCaps =3D NULL; + virQEMUCapsPtr qemuCaps =3D parseOpaque; =20 - if (!(qemuCaps =3D virQEMUCapsCacheLookup(driver->qemuCapsCache, - def->emulator))) { + /* Note that qemuCaps may be NULL when this function is called. This + * function shall not fail in that case. It will be re-run on VM start= up + * with the capabilities populated. + */ + if (!qemuCaps) return 1; - } =20 if (def->os.bootloader || def->os.bootloaderArgs) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list