From nobody Sat May 11 23:49:47 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=1645607845; cv=none; d=zohomail.com; s=zohoarc; b=Swp/ptgiPfA/2q4liO04tD+j0ljmoOqsHbpWlPcvfGANsvzOoGZ0N7X6vc2MCKlaXsQJk6HvhV0Bg8pGfveg0xDXx+/9LE1pqE0AFkO0m5T7LsvrhXVb6RHB++5so/QtaBeTWQqVKnIdQYNV9QEy4r/r2KY9HaHCUd3SVqVMRYg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1645607845; 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=AmRyP4yyMi0BkvJIqsN7DXPWmlPezeizCcQ6ZafPVWc=; b=DhEvle7I+LQ1PBy6oQjQy17HcSnvNqfrwm8K3fkWiR192fJ7SyyylUKiFDt4fvkp0CCLwlwTkkp4cwrudMyOXRuiOUh3pTi7JooD1sd7ArF8nl5Fl2A7hToJL7JVLEipVkcpIhRu2rrxuV5oOpJrPSSCnkCjNEDWmqwkEAqXkhk= 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 1645607845709363.1902717964408; Wed, 23 Feb 2022 01:17:25 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-151-JpMD6NYXMs-0fXVqjp-seg-1; Wed, 23 Feb 2022 04:17:22 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BE3331091DA0; Wed, 23 Feb 2022 09:17:16 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 138767B6DF; Wed, 23 Feb 2022 09:17:15 +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 5FEC21809C98; Wed, 23 Feb 2022 09:17:11 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 21N9HAau031820 for ; Wed, 23 Feb 2022 04:17:10 -0500 Received: by smtp.corp.redhat.com (Postfix) id 270A28319B; Wed, 23 Feb 2022 09:17:10 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.56]) by smtp.corp.redhat.com (Postfix) with ESMTP id A62BB8319E for ; Wed, 23 Feb 2022 09:17:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1645607844; 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=AmRyP4yyMi0BkvJIqsN7DXPWmlPezeizCcQ6ZafPVWc=; b=CGG/hI/xyhXheIbZNqRtHGPcFx6dnxrQo6o+yBXHeOjiAA4uuVwh7cAZYDE748H3TRFcVc LcYMoNoH3IgdK/vZvEh2rMbzehh3IROj4EkNvvA6IUymEGeaH4IBJZ7Lo9zQjpcyEUdvGm ftPnp1xb6tXDlGUE2wq9gWPeqJuQRAM= X-MC-Unique: JpMD6NYXMs-0fXVqjp-seg-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH] qemu: Don't regenerate NVRAM path if parsed from domain XML Date: Wed, 23 Feb 2022 10:16:57 +0100 Message-Id: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com 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.79 on 10.5.11.16 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: 1645607846659100001 Content-Type: text/plain; charset="utf-8" After v8.0.0-466-g08101bde5d we unconditionally regenerate per domain NVRAM path even though it might have been parsed earlier from domain XML. The way we do that leads to a memleak: 43 bytes in 1 blocks are definitely lost in loss record 330 of 682 at 0x483F7E5: malloc (vg_replace_malloc.c:381) by 0x50D5B18: g_malloc (in /usr/lib64/libglib-2.0.so.0.7000.2) by 0x50EFA4F: g_strdup (in /usr/lib64/libglib-2.0.so.0.7000.2) by 0x49E774E: virXPathString (virxml.c:88) by 0x4A3F0E4: virDomainDefParseBootLoaderOptions (domain_conf.c:18226) by 0x4A3F49C: virDomainDefParseBootOptions (domain_conf.c:18298) by 0x4A448C3: virDomainDefParseXML (domain_conf.c:19598) by 0x4A487A1: virDomainDefParseNode (domain_conf.c:20404) by 0x117FCF: testCompareXMLToArgv (qemuxml2argvtest.c:726) by 0x142124: virTestRun (testutils.c:142) by 0x1423D4: virTestRunLog (testutils.c:197) by 0x140A76: mymain (qemuxml2argvtest.c:3406) If we parsed NVRAM path from domain XML we must refrain from generating new path. Signed-off-by: Michal Privoznik Reviewed-by: Peter Krempa --- src/qemu/qemu_firmware.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_firmware.c b/src/qemu/qemu_firmware.c index 4b02cb2802..59dc76fec4 100644 --- a/src/qemu/qemu_firmware.c +++ b/src/qemu/qemu_firmware.c @@ -1139,7 +1139,8 @@ qemuFirmwareEnableFeatures(virQEMUDriver *driver, VIR_FREE(def->os.loader->nvramTemplate); def->os.loader->nvramTemplate =3D g_strdup(flash->nvram_template.f= ilename); =20 - qemuDomainNVRAMPathFormat(cfg, def, &def->os.loader->nvram); + if (!def->os.loader->nvram) + qemuDomainNVRAMPathFormat(cfg, def, &def->os.loader->nvram); =20 VIR_DEBUG("decided on firmware '%s' template '%s' NVRAM '%s'", def->os.loader->path, --=20 2.34.1