[libvirt PATCH 1/4] qemu: prevent use of <bios useserial='yes'> on non-x86 arches

Ján Tomko jtomko at redhat.com
Thu Sep 9 11:57:58 UTC 2021


On a Thursday in 2021, Daniel P. Berrangé wrote:
>The <bios useserial='yes'> 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é <berrange at redhat.com>
>---
> 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.
>+         */

QEMU_CAPS_SGA is only set on x86 QEMUs, so we have already prevented this
config in the past.

But in context of patch 3/4, adding this check makes sense.

>+        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"));
>-- 
>2.31.1
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20210909/aebae1d6/attachment-0001.sig>


More information about the libvir-list mailing list