From nobody Mon Sep 16 19:05:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 172105277959040.11519165029745; Mon, 15 Jul 2024 07:12:59 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 6E3B8A5B; Mon, 15 Jul 2024 10:12:58 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 55B1D9DE; Mon, 15 Jul 2024 10:12:38 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 0BC529CB; Mon, 15 Jul 2024 10:12:35 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 82DFE9C1 for ; Mon, 15 Jul 2024 10:12:34 -0400 (EDT) Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-29-ywaUILX3Mt-tPWHIFoTycg-1; Mon, 15 Jul 2024 10:12:32 -0400 Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-36789d3603aso2980566f8f.2 for ; Mon, 15 Jul 2024 07:12:32 -0700 (PDT) Received: from wheatley.localdomain (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3680dabf20dsm6567882f8f.38.2024.07.15.07.12.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jul 2024 07:12:30 -0700 (PDT) Received: from wheatley.pinto-pinecone.ts.net (wheatley.k8r.cz [127.0.0.1]) by wheatley.localdomain (Postfix) with ESMTP id 1C7961C7C5F7B for ; Mon, 15 Jul 2024 16:12:30 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1721052754; h=from:from: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; bh=DrSyUwi3fpZA8BCf3FaerlZcNunb8OZlEFvyuYjMQMI=; b=IYsSH7l31PeoU9B6Yv33gGXUjtTOvmN5VzGKCJ3NPchm3AjNeBdNfwt7MQrwbpnMwr+oj4 kEDF22ytsVvATdImaLlqfKItfjUaGCF50SknlB6a/JdOxN/nfGHPZwy0ZqEdMBWSZEtHqV LQ9nCuYyZVpyR627JZjY6Izg7Y/uTCI= X-MC-Unique: ywaUILX3Mt-tPWHIFoTycg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721052751; x=1721657551; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=DrSyUwi3fpZA8BCf3FaerlZcNunb8OZlEFvyuYjMQMI=; b=h/uhval2dey6XmWKVcTd7wY/Szy0+VZjx7jeXujoJTMnQff3U+ShQmL9Q5GeXhOfOV BIrRqvookEvLJ8K/XeeNtmM3foeYaxo/397U0m8hbHzAYnZ+s84aVqWwJvw4e28lTnaj b/cEQtnHTliLRu0FIlSu6Tk/Lc655aM7+RzeMMRErhGOxRshzxKtxI9OjQagCQlF3fj8 YDuEqQkNHQKnjg1E1Gv2s9fR1GNaQJFtrt+NkJYpY4FRlxJBHYy/yR2eZswDeaYae82k RJoSpftC1A8PuWE51/p+YRmEV0CDHHTj6lsXSK6Tt7ZCCsGprW/KKJz0bhkUpD5Fm8xU Im8g== X-Gm-Message-State: AOJu0YzCtVgkNcdoeF/xnnps62fIpb0+hmjwD1vR1ZXYVA6DoeLuo5l7 Jp/I++W8Qjz9K046g7OwgF6IGKRhvMlztt3AESTeQDsdmR4qdqOoHenJIw/KfLwUUMvBhaaArmT rd3jzXB2MXpAeUIqGk8qBI81yQYCSVXOYFCh/2sOKAuoOsoiI5d4pF6AMT+6wkk+JkcWpCJ2aNz jpiCMSVLFdpsH45cMzS9b4a/5Q3IPm2Gf5NJhkLJA= X-Received: by 2002:a5d:42ce:0:b0:367:9237:611d with SMTP id ffacd0b85a97d-367cead94c4mr13595329f8f.60.1721052751396; Mon, 15 Jul 2024 07:12:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGIoqe8RZOt6Vl+C1H5TIOrOLFX+NSE1uCe7fogDSQHWbVabQJmrwDEL9Q2gULPPYWXuclrOw== X-Received: by 2002:a5d:42ce:0:b0:367:9237:611d with SMTP id ffacd0b85a97d-367cead94c4mr13595316f8f.60.1721052751001; Mon, 15 Jul 2024 07:12:31 -0700 (PDT) From: Martin Kletzander To: devel@lists.libvirt.org Subject: [PATCH] vmx: Be even more lax when trying to comprehend serial ports Date: Mon, 15 Jul 2024 16:12:23 +0200 Message-ID: <0e99b1789d3c3d4b2c05d6e31a42abd721e82716.1721052743.git.mkletzan@redhat.com> X-Mailer: git-send-email 2.45.1 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 7MAW3TUU4BDE54CEXWDW5SVF2XTLJBLB X-Message-ID-Hash: 7MAW3TUU4BDE54CEXWDW5SVF2XTLJBLB X-MailFrom: mkletzan@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1721052781552116600 Content-Type: text/plain; charset="utf-8"; x-default="true" So much can happen in the fileName field of the VMX that the easiest thing is to silently report a serial type=3D"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 --- 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 e5bc2d793c66..227744d06258 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] =3D ""; g_autofree char *fileName =3D NULL; =20 - char vspc_name[48] =3D ""; - g_autofree char *vspc =3D NULL; - char network_endPoint_name[48] =3D ""; g_autofree char *network_endPoint =3D NULL; =20 @@ -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"); =20 /* vmx:present */ @@ -3030,10 +3026,6 @@ virVMXParseSerial(virVMXContext *ctx, virConf *conf,= int port, if (virVMXGetConfigString(conf, fileName_name, &fileName, true) < 0) goto cleanup; =20 - /* 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_endPoi= nt, true) < 0) { @@ -3065,21 +3057,25 @@ virVMXParseSerial(virVMXContext *ctx, virConf *conf= , int port, (*def)->target.port =3D port; (*def)->source->type =3D VIR_DOMAIN_CHR_TYPE_PIPE; (*def)->source->data.file.path =3D g_steal_pointer(&fileName); - } else if (STRCASEEQ(fileType, "network") && (vspc || !fileName || STR= EQ(fileName, ""))) { - (*def)->target.port =3D port; - (*def)->source->type =3D VIR_DOMAIN_CHR_TYPE_NULL; } else if (STRCASEEQ(fileType, "network")) { (*def)->target.port =3D port; (*def)->source->type =3D VIR_DOMAIN_CHR_TYPE_TCP; =20 - if (!(parsedUri =3D virURIParse(fileName))) - goto cleanup; + if (!(parsedUri =3D virURIParse(fileName))) { + /* + * Ignore anything we cannot parse since there are many variat= ions + * that could lead to unusable or non-representable serial por= ts + * 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 =3D VIR_DOMAIN_CHR_TYPE_NULL; + return 0; + } =20 if (parsedUri->port =3D=3D 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("VMX entry '%1$s' doesn't contain a port part= "), - fileName_name); - goto cleanup; + (*def)->source->type =3D VIR_DOMAIN_CHR_TYPE_NULL; + return 0; } =20 (*def)->source->data.tcp.host =3D g_strdup(parsedUri->server); --=20 2.45.1