From nobody Mon Feb 9 15:27:14 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1631186734; cv=none; d=zohomail.com; s=zohoarc; b=ZUJvl4gJZRzO4zu5n6wRAMRgSbZMRwcfeH34s1lU3cVXm12Po+8JTd2zBvGSgXp8UbWufT1VlQ8nBm+U93c2MwGakAtcPcKrkHDC64ZLi6A/gt+JRFeTJJUCz2TtW/vj6z518bSdpHE4Mhfo+9/rRAWIKS2t08UmPmViEGOZG/M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1631186734; 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=r3kxgtNGue540/aSfzOB4yELKVpKPNhqAnflMKQ3FtQ=; b=AVd0HMAbUafxw46aTwNST7YwvKrpcp/8h6XUyzgcDEvQMxDeFDVPQYgfBPTbkj3Amtl/RRJ7dJzHeBV8BMvF6/tPGWd3FikCbMY/fdABN8ALHZitxNxlQKi/aIbiRDMaxtrHQ6WQotiJM3pUE1MXOV9jv7+w0dHpJPSrOHbOkeA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1631186734526888.3679001286505; Thu, 9 Sep 2021 04:25:34 -0700 (PDT) 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-127-CC2ObQgOMeqjMn7otbycow-1; Thu, 09 Sep 2021 07:25:31 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B003B1B18BC8; Thu, 9 Sep 2021 11:25:25 +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 8D7264180; Thu, 9 Sep 2021 11:25:25 +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 34D561801241; Thu, 9 Sep 2021 11:25:24 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 189BPMO3013936 for ; Thu, 9 Sep 2021 07:25:22 -0400 Received: by smtp.corp.redhat.com (Postfix) id E209D5D6CF; Thu, 9 Sep 2021 11:25:22 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.39.195.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 49EB66A8E4; Thu, 9 Sep 2021 11:25:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1631186733; 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=r3kxgtNGue540/aSfzOB4yELKVpKPNhqAnflMKQ3FtQ=; b=GReOeiriAcRxoyg6j7x+DyHMlBFMPHCxYk5/2RIxnfEpAbOX95TJUphVfMzUANaeIf+Dti FmkN/W74/5Oc7Y/mfev7dfXpoV1fv7nMTf0MgDnAI1sb3SQm+gv0DLFTr+7VkXALa9AUXm dAbbVFQjemryX0f1mSHzLDkZMGXRztQ= X-MC-Unique: CC2ObQgOMeqjMn7otbycow-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH 1/4] qemu: prevent use of on non-x86 arches Date: Thu, 9 Sep 2021 12:25:13 +0100 Message-Id: <20210909112516.854126-2-berrange@redhat.com> In-Reply-To: <20210909112516.854126-1-berrange@redhat.com> References: <20210909112516.854126-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.11 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1631186735508100001 The config results in use of the '-device sga' QEMU options. This in turn causes QEMU go load the sgabios.bin option ROM, which contains x86 machine code. This cannot work on non-x86 arches, thus we should block the bad config. Signed-off-by: Daniel P. Berrang=C3=A9 --- src/qemu/qemu_validate.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index d8f39b6bdd..3789361b57 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -1194,6 +1194,14 @@ qemuValidateDomainDef(const virDomainDef *def, =20 /* Serial graphics adapter */ if (def->os.bios.useserial =3D=3D VIR_TRISTATE_BOOL_YES) { + /* -device sga is only sane on x86, since the option ROM it + * loads contains x86 machine code. + */ + if (!ARCH_IS_X86(def->os.arch)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("BIOS serial console only supported on x86 ar= chitectures")); + return -1; + } if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SGA)) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("qemu does not support SGA")); --=20 2.31.1