qemu: prevent use of <bios useserial='yes'> on non-x86 arches

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.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrangé 2021-09-08 17:47:40 +01:00
parent 046f1b4da0
commit c82726a460

View File

@ -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"));