From 5c3ebb9dd949b60dfa2b227f00c214b8a01919ea Mon Sep 17 00:00:00 2001 From: Jiri Denemark Date: Mon, 22 Jul 2024 10:31:07 +0200 Subject: [PATCH] libvirt-10.5.0-3.el9 - vmx: Be even more lax when trying to comprehend serial ports (RHEL-32182) Resolves: RHEL-32182 --- ...en-trying-to-comprehend-serial-ports.patch | 97 +++++++++++++++++++ libvirt.spec | 6 +- 2 files changed, 102 insertions(+), 1 deletion(-) create mode 100644 libvirt-vmx-Be-even-more-lax-when-trying-to-comprehend-serial-ports.patch diff --git a/libvirt-vmx-Be-even-more-lax-when-trying-to-comprehend-serial-ports.patch b/libvirt-vmx-Be-even-more-lax-when-trying-to-comprehend-serial-ports.patch new file mode 100644 index 0000000..45a4e79 --- /dev/null +++ b/libvirt-vmx-Be-even-more-lax-when-trying-to-comprehend-serial-ports.patch @@ -0,0 +1,97 @@ +From b65fb6c87242f9bdb55821217da941c33ec245d5 Mon Sep 17 00:00:00 2001 +Message-ID: +From: Martin Kletzander +Date: Fri, 12 Jul 2024 10:36:37 +0200 +Subject: [PATCH] vmx: Be even more lax when trying to comprehend serial ports + +So much can happen in the fileName field of the VMX that the easiest +thing is to silently report a serial type="null". + +This effectively reverts commits de81bdb8d4cd and 62c53db0421a, but +keeps the test files to show the fix is still in place. + +There is one instance where an error gets reset, but since that is a +rare case on its own and on top of that does not happen in any of our +long-running daemons with a logfile that might get monitored it should +be fine to leave it there. + +Resolves: https://issues.redhat.com/browse/RHEL-32182 + +Signed-off-by: Martin Kletzander +Reviewed-by: Michal Privoznik +(cherry picked from commit 239669049d9904e5e8da2d8b2a38d4d927a167e9) +Signed-off-by: Martin Kletzander +--- + src/vmx/vmx.c | 30 +++++++++++++----------------- + 1 file changed, 13 insertions(+), 17 deletions(-) + +diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c +index e5bc2d793c..227744d062 100644 +--- a/src/vmx/vmx.c ++++ b/src/vmx/vmx.c +@@ -2975,9 +2975,6 @@ virVMXParseSerial(virVMXContext *ctx, virConf *conf, int port, + char fileName_name[48] = ""; + g_autofree char *fileName = NULL; + +- char vspc_name[48] = ""; +- g_autofree char *vspc = NULL; +- + char network_endPoint_name[48] = ""; + g_autofree char *network_endPoint = NULL; + +@@ -3000,7 +2997,6 @@ virVMXParseSerial(virVMXContext *ctx, virConf *conf, int port, + VMX_BUILD_NAME(startConnected); + VMX_BUILD_NAME(fileType); + VMX_BUILD_NAME(fileName); +- VMX_BUILD_NAME(vspc); + VMX_BUILD_NAME_EXTRA(network_endPoint, "network.endPoint"); + + /* vmx:present */ +@@ -3030,10 +3026,6 @@ virVMXParseSerial(virVMXContext *ctx, virConf *conf, int port, + if (virVMXGetConfigString(conf, fileName_name, &fileName, true) < 0) + goto cleanup; + +- /* vmx:fileName -> def:data.file.path */ +- if (virVMXGetConfigString(conf, vspc_name, &vspc, true) < 0) +- goto cleanup; +- + /* vmx:network.endPoint -> def:data.tcp.listen */ + if (virVMXGetConfigString(conf, network_endPoint_name, &network_endPoint, + true) < 0) { +@@ -3065,21 +3057,25 @@ virVMXParseSerial(virVMXContext *ctx, virConf *conf, int port, + (*def)->target.port = port; + (*def)->source->type = VIR_DOMAIN_CHR_TYPE_PIPE; + (*def)->source->data.file.path = g_steal_pointer(&fileName); +- } else if (STRCASEEQ(fileType, "network") && (vspc || !fileName || STREQ(fileName, ""))) { +- (*def)->target.port = port; +- (*def)->source->type = VIR_DOMAIN_CHR_TYPE_NULL; + } else if (STRCASEEQ(fileType, "network")) { + (*def)->target.port = port; + (*def)->source->type = VIR_DOMAIN_CHR_TYPE_TCP; + +- if (!(parsedUri = virURIParse(fileName))) +- goto cleanup; ++ if (!(parsedUri = virURIParse(fileName))) { ++ /* ++ * Ignore anything we cannot parse since there are many variations ++ * that could lead to unusable or non-representable serial ports ++ * which are very commonly seen and the main consumer of this driver ++ * (virt-v2v) ignores them anyway, so let's at least not error out. ++ */ ++ virResetLastError(); ++ (*def)->source->type = VIR_DOMAIN_CHR_TYPE_NULL; ++ return 0; ++ } + + if (parsedUri->port == 0) { +- virReportError(VIR_ERR_INTERNAL_ERROR, +- _("VMX entry '%1$s' doesn't contain a port part"), +- fileName_name); +- goto cleanup; ++ (*def)->source->type = VIR_DOMAIN_CHR_TYPE_NULL; ++ return 0; + } + + (*def)->source->data.tcp.host = g_strdup(parsedUri->server); +-- +2.45.2 diff --git a/libvirt.spec b/libvirt.spec index 5e1463e..a7fad61 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -289,7 +289,7 @@ Summary: Library providing a simple virtualization API Name: libvirt Version: 10.5.0 -Release: 2%{?dist}%{?extra_release} +Release: 3%{?dist}%{?extra_release} License: GPL-2.0-or-later AND LGPL-2.1-only AND LGPL-2.1-or-later AND OFL-1.1 URL: https://libvirt.org/ @@ -305,6 +305,7 @@ Patch5: libvirt-qemu-do-not-use-deprecated-options-for-new-virtiofsd.patch Patch6: libvirt-qemu-migration-allow-migration-for-virtiofs.patch Patch7: libvirt-virt-host-validate-Drop-extra-PASS.patch Patch8: libvirt-qemu-Don-t-leave-beingDestroyed-true-on-inactive-domain.patch +Patch9: libvirt-vmx-Be-even-more-lax-when-trying-to-comprehend-serial-ports.patch Requires: libvirt-daemon = %{version}-%{release} @@ -2633,6 +2634,9 @@ exit 0 %endif %changelog +* Mon Jul 22 2024 Jiri Denemark - 10.5.0-3 +- vmx: Be even more lax when trying to comprehend serial ports (RHEL-32182) + * Fri Jul 12 2024 Jiri Denemark - 10.5.0-2 - vmx: Do not require all ID data for VMWare Distributed Switch (RHEL-46099) - tests: vhostuser: add virtiofsd json descriptor (RHEL-7108, RHEL-40135)