From c82726a46087d5422104fb9dc15756444735f285 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Wed, 8 Sep 2021 17:47:40 +0100 Subject: [PATCH] qemu: prevent use of on non-x86 arches MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. Reviewed-by: Ján Tomko Signed-off-by: Daniel P. Berrangé --- 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, /* Serial graphics adapter */ if (def->os.bios.useserial == 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 architectures")); + return -1; + } if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SGA)) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("qemu does not support SGA"));