From nobody Tue Feb 10 13:33:09 2026 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 ARC-Seal: i=1; a=rsa-sha256; t=1679476268; cv=none; d=zohomail.com; s=zohoarc; b=VoIlpP8C7dvIuUVJ5jqo1RiVkyeMdWJo7OSwPZZwiKnrCcsev5LY0WDl2zR9Xybsu+hd67eXYoN02orVenZlwMB4qcHwSGCOpRddxi8Bc6aPSYrOrUfJ4kX52D8wDRUXbHvvT94OQ1eqyOAY6541u/OXrKRE4q3TFk6m4midgZs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1679476268; 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=UD8SHZYyvj4wJZVuXEGd3nphZW38JCCs7msgOd7Wx8c=; b=CIOOINFBzD4QZcWz3jJ7pa+PwDCv2JBEeKdfvg/SixzBg0TUJKcPU9/j3DxzBADrdIGlHp3A4LkF4rIn+nrHNDVXlIJRWcdfAvT9vbVNEnRzQyj/H53AEUfz2O78qMXON48c+L1AA8ugzh3bSmVYR8cousgfFNM9C4TQwAITEW8= 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 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 1679476268115762.4724639573946; Wed, 22 Mar 2023 02:11:08 -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-133-KgZbGzfGNgWSoOHZ-9T9LQ-1; Wed, 22 Mar 2023 05:10:51 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1C26F185A7AC; Wed, 22 Mar 2023 09:10: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 0089240C6E68; Wed, 22 Mar 2023 09:10:49 +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 C61BE19465BA; Wed, 22 Mar 2023 09:10:43 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id A04621946A61 for ; Wed, 22 Mar 2023 09:10:37 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 8111840C83B6; Wed, 22 Mar 2023 09:10:32 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 798BF40C83AC for ; Wed, 22 Mar 2023 09:10:32 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 600B985A5A3 for ; Wed, 22 Mar 2023 09:10:32 +0000 (UTC) Received: from mail-oi1-f177.google.com (mail-oi1-f177.google.com [209.85.167.177]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-160-umhqiUCQN9mZs9Xh4PMlCQ-1; Wed, 22 Mar 2023 05:10:30 -0400 Received: by mail-oi1-f177.google.com with SMTP id bm2so4210782oib.4 for ; Wed, 22 Mar 2023 02:10:30 -0700 (PDT) Received: from grind.. ([177.95.89.231]) by smtp.gmail.com with ESMTPSA id s3-20020a05680810c300b00383ef58c15bsm1994784ois.28.2023.03.22.02.10.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Mar 2023 02:10:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1679476267; 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=UD8SHZYyvj4wJZVuXEGd3nphZW38JCCs7msgOd7Wx8c=; b=M7scZ8GPWOhWROIyIJWLrEK6gPVp0ZZPvY4OZ2774oSK7WXe6kd5Vm0sqVGnJPJk4AlE7H 3i75DMzrNTM08XREV44OIEvectevlPcMUgd9qEZYuRSce+etSHsMv2YncMK6dSnlPMT1TE G6UtgKk4w9PQTcuHOrq2Iq3tzvEi/oI= X-MC-Unique: KgZbGzfGNgWSoOHZ-9T9LQ-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: umhqiUCQN9mZs9Xh4PMlCQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679476229; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UD8SHZYyvj4wJZVuXEGd3nphZW38JCCs7msgOd7Wx8c=; b=PS4B2HlQofNWz7LA9ZhG3MYij16aaKjT3rwUhEyhPPSEBl/oKu5Z/9suWrd+DzTPbh 4fxroDa6asMY6IE5TWfAACLL8Ezmy6P3SyBY9NcRi+Cw160vj9GDL38wWCSaDARHLVUW daE1xEyo3NSu8cFY12FgH8tBY3EqVg/8gilph5OamNEUbOwLT5Ov1lbk8yDHk+KLGJk8 SIqfb6dL+QE+5UefCI+vMnTibYTbhiQ9amGsryyz2LY3WKwswTuYFFOOmclsiThEU1Wv 0oAzCHc7ljBvx7Evj9OelrTGmxnQBFaL+vzlCaYCSB70oO6by6leipH8f9YsyKBVeR0j RVyg== X-Gm-Message-State: AO0yUKWjvcJ29nUBP4KNhYwOSJrbGbrkmk/sssU+ieMhLazmA4EycHL7 HLbjsU68rXPNYDmOofZ4kbz6el63gCnI5c7E4D0= X-Google-Smtp-Source: AK7set8h28Mfl7QXvPnvog1nZq69A+wTkG0XHe0SMpZHn9j4Y/uo4ymBS+U7iCJ0L4zU6LzKZ09L1w== X-Received: by 2002:aca:a90d:0:b0:386:b205:b415 with SMTP id s13-20020acaa90d000000b00386b205b415mr1055032oie.27.1679476229478; Wed, 22 Mar 2023 02:10:29 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH 2/4] qemu: handle bios 'none' case in qemuFirmwareFillDomain() Date: Wed, 22 Mar 2023 06:10:19 -0300 Message-Id: <20230322091021.186927-3-dbarboza@ventanamicro.com> In-Reply-To: <20230322091021.186927-1-dbarboza@ventanamicro.com> References: <20230322091021.186927-1-dbarboza@ventanamicro.com> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 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: , Cc: dbarboza@ventanamicro.com Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: ventanamicro.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1679476270306100001 Content-Type: text/plain; charset="utf-8"; x-default="true" All the code present in qemuFirmwareFillDomain() assumes that loader->path is always filled if using manual firmware selection. In the newly added "" case, i.e. without using firmware autoselection, qemuFirmwareFillDomain() will call qemuFirmwareFillDomainModern(), which in turn will fetch the number of firmwares in the driver via qemuFirmwareFetchParsedConfigs(). If any firmware is found, qemuFirmwareFillDomainModern() will call qemuFirmwareMatchDomain(), and we'll SIGSEV in: STRNEQ(loader->path, fw->mapping.data.flash.executable.filename)) { Because we never checked if loader->path !=3D NULL ever since the start of qemuFirmwareFillDomain(), 2 callers before. This doesn't happen in the field because, at this moment, there is no RISC-V firmwares set in the live driver. But the test driver from qemuxml2argvdata will populate the list with some firmwares, triggering the call to qemuFirmwareMatchDomain() that causes the seg fault. We'll hit this SIGSEV when adding a xml2xargv test that uses loader type=3D'none'. One fix is to use STRNEQ_NULLABLE() in the forementioned line, , but doing that doesn't fix the loader->path !=3D NULL assumption that we're making in qemuFirmwareFillDomain(). Let's instead exit early in that function if we're dealing with the loader type=3D'none' scenario we're now supporting: no firmware autoselection, loader->type =3D=3D none, loader->path =3D=3D NULL. Signed-off-by: Daniel Henrique Barboza --- src/qemu/qemu_firmware.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/qemu/qemu_firmware.c b/src/qemu/qemu_firmware.c index 9de4166772..8541a57bf6 100644 --- a/src/qemu/qemu_firmware.c +++ b/src/qemu/qemu_firmware.c @@ -1616,6 +1616,16 @@ qemuFirmwareFillDomain(virQEMUDriver *driver, return -1; } =20 + /* If we're not autoselecting a firmware, and we have a loader + * element, and loader type is 'none', and we don't have a + * loader->path, consider that the user wants to explictly + * disable the firmware selection in QEMU (-bios none). */ + if (!autoSelection && loader && + loader->type =3D=3D VIR_DOMAIN_LOADER_TYPE_NONE && + !loader->path) { + return 0; + } + /* If firmware autoselection is disabled and the loader is a ROM * instead of a PFLASH device, then we're using BIOS and we don't * need any information at all */ --=20 2.39.2