From nobody Sat Apr 27 13:30:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1666276081; cv=none; d=zohomail.com; s=zohoarc; b=RRGjrY3P+gnOCG+ZmxLLRKvELQfgGNtyU92ZR+gPnULK8LuEekyeWCS607L/VHMgLiKvrXp50H1dot/hHBKC7FlRrAahdKTpsxSD7U4B39Ll6GDSy+e0XnrvaKBHC45JrdEPOxZjMSHCYKPzQ/OmVJ4ItZ7PbqN+y1Ei9cpD2jI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1666276081; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=p6Jq3auIJbr3tfsiVluogBbaJL36Mgr/AKy9McYtgNE=; b=ZQT4viq4Z7rFyg58H4fQp4pB2CjZ825MXLD5Xxbddliy6WBk3CTj31fQnQaNSJlOlAc6HSc8idL8qwJJ0GXbiVyIPUnt3CrGGCgsS/eEMUIBujw0zvbeh65cULUJA6/WdIAsPuzld8WASua3hOjk4aKeIOu8gHWhcQsgLbWWedk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1666276081111587.4998902128413; Thu, 20 Oct 2022 07:28:01 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-47-Qzfe9bwJOU6ZJYfHsaffxg-1; Thu, 20 Oct 2022 10:27:55 -0400 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A20B486EB21; Thu, 20 Oct 2022 14:27:52 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2C5124021B8; Thu, 20 Oct 2022 14:27:51 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 183FE1946595; Thu, 20 Oct 2022 14:27:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 01F4F1946587 for ; Thu, 20 Oct 2022 14:27:48 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id D59AF4B3FC8; Thu, 20 Oct 2022 14:27:48 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.43.2.118]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7B1B04B3FC6 for ; Thu, 20 Oct 2022 14:27:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666276080; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=p6Jq3auIJbr3tfsiVluogBbaJL36Mgr/AKy9McYtgNE=; b=LQZaJeZWpJR/PA59GCdjbi6Za+ZMDP5D8aEnF6TxvCn9a1+10pi+UQ8I2E1mizqvDeM1R+ XhcaZIXr4WK/fJXrNviFe5HJc57JPl1avuupKzWGNDx9HXaCiPuThQTebmpnSe3UagceZe eny9qanwPVSCMSYIK9ZkgpQDhA8/IN8= X-MC-Unique: Qzfe9bwJOU6ZJYfHsaffxg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH] qemu: do not attempt to pass unopened vsock FD Date: Thu, 20 Oct 2022 16:27:45 +0200 Message-Id: <4161066b9f452660cefb28f81fb0d02383e984a3.1666275909.git.jtomko@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1666276082978100001 On normal vm startup, we open a file descriptor for the vsock device in qemuProcessPrepareHost. However, when doing domxml-to-native, no file descriptors are open. Only pass the fd if it's not -1, to make domxml-to-native work. https://bugzilla.redhat.com/show_bug.cgi?id=3D1777212 Signed-off-by: J=C3=A1n Tomko Reviewed-by: Peter Krempa --- Technically a v2 of: https://listman.redhat.com/archives/libvir-list/2021-July/msg00803.html I did not look at other cases, but IIRC the ones converted to use qemuFD* wrappers should handle missing FDs gracefully. src/qemu/qemu_command.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 150824f2e1..bbbde57c0f 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -9717,7 +9717,8 @@ qemuBuildVsockCommandLine(virCommand *cmd, if (!(devprops =3D qemuBuildVsockDevProps(def, vsock, qemuCaps, ""))) return -1; =20 - virCommandPassFD(cmd, priv->vhostfd, VIR_COMMAND_PASS_FD_CLOSE_PARENT); + if (priv->vhostfd !=3D -1) + virCommandPassFD(cmd, priv->vhostfd, VIR_COMMAND_PASS_FD_CLOSE_PAR= ENT); priv->vhostfd =3D -1; =20 if (qemuCommandAddExtDevice(cmd, &vsock->info, def, qemuCaps) < 0) --=20 2.37.3