From nobody Thu May 2 03:21:13 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=1676375494; cv=none; d=zohomail.com; s=zohoarc; b=im4mM8RbhO67IcFrBX5Wjm05SxW+0+1CTEeibp5+OiiEj3GQ/eSnWFWVPdo0BjMFKAQyyl4NDp8Jy7PRs7cEhYImqFAFw2X3re5Y485D2g5gJL5ZMTbgYgh+bb2YtuV2I1YfsVK9nuNJ78v4JhVzSoQI1hurLy7VsJJRnZbA9vI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1676375494; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=YnpLcazavfUxaoxeIK5IJz9zczDkScu7Vok0kmq+O5Q=; b=Kip9f+b+QwHD/JvOIOzIvGHeYOcvRASKKfZ9uqNsxcJTZOiCeuohJeuvMmvi7UXa0nyWb0+95Q/BDi77g+zuvv0UOGEEqXmF96Mc8ws2MszskkTSFV6PAPYgnWyTxQN5q+0QF45TQ1+BEoSwdMUXygWJ7f1DZBSBvKZDaHAU35s= 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 1676375494849138.3116945492817; Tue, 14 Feb 2023 03:51:34 -0800 (PST) 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-335-UZSik800OSenMU5C9bYK7w-1; Tue, 14 Feb 2023 06:51:30 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 68DE0971087; Tue, 14 Feb 2023 11:51:27 +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 5645E40C1423; Tue, 14 Feb 2023 11:51:27 +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 439931946588; Tue, 14 Feb 2023 11:51:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id E21ED1946586 for ; Tue, 14 Feb 2023 11:51:25 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id D2DED141510F; Tue, 14 Feb 2023 11:51:25 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 434B51415108; Tue, 14 Feb 2023 11:51:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1676375493; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=YnpLcazavfUxaoxeIK5IJz9zczDkScu7Vok0kmq+O5Q=; b=Pgm94CRgJ2GS0OlQ6tS/z07SYQOO0XyYUVlwLAxRT21XUJZkUr5mtU3nUuW71vcyRopUBM WMVEfecEeznHG/GZ5cQuJ1W5NVLa9Fdd7pnH/36ymyU7iL6pN/P15cEaJrj7H+sEKSRAJj 8KdV8W0P+q7pRQt38Atf/nHIc473hkw= X-MC-Unique: UZSik800OSenMU5C9bYK7w-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 1/4] Revert "qemu: allow passt to self-daemonize" Date: Tue, 14 Feb 2023 12:51:19 +0100 Message-Id: <77f3fc97d2343f25b85a2cc2295fc6f022c984d7.1676374699.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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: , Cc: sbrivio@redhat.com, passt-dev@passt.top Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1676375495763100003 Content-Type: text/plain; charset="utf-8"; x-default="true" This reverts commit 0c4e716835eaf2a575bd063fde074c0fc7c4e4d4. This patch was pushed by my mistake. Even though it got ACKed on the list, I've raised couple of issues with it. They will be fixed in next commits. Signed-off-by: Michal Privoznik Reviewed-by: Laine Stump --- src/qemu/qemu_passt.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_passt.c b/src/qemu/qemu_passt.c index f640a69c00..0f09bf3db8 100644 --- a/src/qemu/qemu_passt.c +++ b/src/qemu/qemu_passt.c @@ -141,23 +141,24 @@ qemuPasstStart(virDomainObj *vm, g_autofree char *passtSocketName =3D qemuPasstCreateSocketPath(vm, net= ); g_autoptr(virCommand) cmd =3D NULL; g_autofree char *pidfile =3D qemuPasstCreatePidFilename(vm, net); - g_autofree char *errbuf =3D NULL; char macaddr[VIR_MAC_STRING_BUFLEN]; size_t i; pid_t pid =3D (pid_t) -1; int exitstatus =3D 0; int cmdret =3D 0; + VIR_AUTOCLOSE errfd =3D -1; =20 cmd =3D virCommandNew(PASST); =20 virCommandClearCaps(cmd); - virCommandSetErrorBuffer(cmd, &errbuf); + virCommandSetPidFile(cmd, pidfile); + virCommandSetErrorFD(cmd, &errfd); + virCommandDaemonize(cmd); =20 virCommandAddArgList(cmd, "--one-off", "--socket", passtSocketName, "--mac-addr", virMacAddrFormat(&net->mac, macaddr= ), - "--pid", pidfile, NULL); =20 if (net->mtu) { @@ -263,7 +264,7 @@ qemuPasstStart(virDomainObj *vm, =20 if (cmdret < 0 || exitstatus !=3D 0) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Could not start 'passt': %s"), errbuf); + _("Could not start 'passt'. exitstatus: %d"), exits= tatus); goto error; } =20 --=20 2.39.1 From nobody Thu May 2 03:21:13 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=1676375526; cv=none; d=zohomail.com; s=zohoarc; b=EB/gaRurG1krj2nCy8nRQWkDGySdUgnf8VNEI7UvKvNvALQuQMWoSizm5xAW+WjBRTI8uxUq+YFIlcIYNiCsPf0yER63I6K0MphDsa2nT1gIlqBvrH2qdQkKFgMKLzlLrmK0D1MTK0dPYVAcke+SAZTQufcijFjJwWgxAENNjiI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1676375526; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=0hM631/fI8CcDfZboKHrXCjjp0T/Vab2DlMll3CJvdk=; b=HIsnmgy2zPSDAUkeJo6gE6nnJ1yKhcqOfmRdN7/IL0nOJarXtp6jQF0tRL+5+q5eMFyk+GD7VZqnP1cGRuh6U9VO4ZUAE1uQH7sfFVBnXCRFmCehwk7AC7O26HN0LNhfWIXnaFeijxdLdOTP9R4T9PF7+wmyvyyL1eOsH4WLuqk= 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 1676375526494256.18508810042533; Tue, 14 Feb 2023 03:52:06 -0800 (PST) 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-287-0pm2Mqu2NpG1l8MO7xW5Bg-1; Tue, 14 Feb 2023 06:51:31 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A929B80D0E2; Tue, 14 Feb 2023 11:51:28 +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 9253835454; Tue, 14 Feb 2023 11:51:28 +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 778571946588; Tue, 14 Feb 2023 11:51:28 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id B1EFB1946588 for ; Tue, 14 Feb 2023 11:51:26 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id A44591415108; Tue, 14 Feb 2023 11:51:26 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 14BC3140EBF6; Tue, 14 Feb 2023 11:51:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1676375525; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=0hM631/fI8CcDfZboKHrXCjjp0T/Vab2DlMll3CJvdk=; b=C9dugJdACwlC02FAmJRFz3Ycm3vnclDlFwBZq4o/imTNv2IOYCI2vP70rGK2as+1+M4U1I njLA/5SBZWpJsjcMT+F1pd8DSyV8trY+bY6TZerduT5H+F+aUNTiR5ueNMF8aeO+Wvqyq0 X7n6RGP4VlQKPCaHEWe71VlghGcgF2k= X-MC-Unique: 0pm2Mqu2NpG1l8MO7xW5Bg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 2/4] qemu_extdevice: Make qemuExtDevicesHasDevice() check def->nets Date: Tue, 14 Feb 2023 12:51:20 +0100 Message-Id: <446dd5c17d7c3aa302f30253edc33fa8788100fa.1676374699.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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: , Cc: sbrivio@redhat.com, passt-dev@passt.top Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1676375527904100001 Content-Type: text/plain; charset="utf-8"; x-default="true" We can have external helper processes running for domain too (e.g. slirp or passt). But this is not reflected in qemuExtDevicesHasDevice() which simply ignores these. Signed-off-by: Michal Privoznik Reviewed-by: Laine Stump --- src/qemu/qemu_extdevice.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/qemu/qemu_extdevice.c b/src/qemu/qemu_extdevice.c index fdefe59215..47e97f3565 100644 --- a/src/qemu/qemu_extdevice.c +++ b/src/qemu/qemu_extdevice.c @@ -296,6 +296,17 @@ qemuExtDevicesHasDevice(virDomainDef *def) return true; } =20 + for (i =3D 0; i < def->nnets; i++) { + virDomainNetDef *net =3D def->nets[i]; + + if (QEMU_DOMAIN_NETWORK_PRIVATE(net)->slirp) + return true; + + if (net->type =3D=3D VIR_DOMAIN_NET_TYPE_USER && + net->backend.type =3D=3D VIR_DOMAIN_NET_BACKEND_PASST) + return true; + } + for (i =3D 0; i < def->ntpms; i++) { if (def->tpms[i]->type =3D=3D VIR_DOMAIN_TPM_TYPE_EMULATOR) return true; --=20 2.39.1 From nobody Thu May 2 03:21:13 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.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=1676375534; cv=none; d=zohomail.com; s=zohoarc; b=DV9BGtgzk6bOYnQd2XuLOdLZNGkIcPaehebqmTBgXmmMxwTgBY28tlaiW6qxLPbZ/nLPX0yT8C4tvfBkN04vJkK9VKr6TtCqTQSjI7ghiCqVzhu+x9jgqs9pWzouGvZALoscq2C22Un+8QU3zOI2zjvWALtcwWKD9YWodsjXV7c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1676375534; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=lIW8SBkzl10f26p2Zp9/SS6Bo6iv16l6yctgTW/oXFQ=; b=jcxrt6sQ49yqKGiy3kaoIhsGP2m4cgh7s5encxcO5XgwNrgRMcYMv8ADiETuAt37stCPLZtfZiorBjeLaK1g7iXrfXFz6uscVPpaRio/5nH6Taf4j5xNU8fMDCwF4xd4EgigSmL4CIZVXKA+cNPsE+wwD/rzLuctLuWpTdzYcDE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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.133.124]) by mx.zohomail.com with SMTPS id 1676375534170925.7147423516614; Tue, 14 Feb 2023 03:52:14 -0800 (PST) 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-321-SDxF2DPJNay0Eh2BYqRjMg-1; Tue, 14 Feb 2023 06:51:32 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 30C9718E0056; Tue, 14 Feb 2023 11:51:29 +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 17BA04051E44; Tue, 14 Feb 2023 11:51:29 +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 EB81E194658C; Tue, 14 Feb 2023 11:51:28 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 85ADB19465B3 for ; Tue, 14 Feb 2023 11:51:27 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 7695D141510F; Tue, 14 Feb 2023 11:51:27 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id DA9E01415108; Tue, 14 Feb 2023 11:51:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1676375533; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=lIW8SBkzl10f26p2Zp9/SS6Bo6iv16l6yctgTW/oXFQ=; b=DgGeJhZLTbZm/IOE/vE4Ybl+UFwqYDSfNdtQ185d0iHigXq94bM/MCVzAmr0bqolGP6ZgB KK0lPeL+JGJsragPwRNLxFcjqFgKnsuQkq7y/R94biN/0ZQf0xwkEROmW+Ccq/Dc3ianBK Df9SbyD/nUOQL2027yJM+y+2RyBBb4k= X-MC-Unique: SDxF2DPJNay0Eh2BYqRjMg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 3/4] qemu_passt: Report error when getting passt PID failed Date: Tue, 14 Feb 2023 12:51:21 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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: , Cc: sbrivio@redhat.com, passt-dev@passt.top Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1676375535974100001 Content-Type: text/plain; charset="utf-8"; x-default="true" If qemuPasstGetPid() fails, or the passt's PID is -1 then qemuPasstSetupCgroup() returns early without any error message set. Report an appropriate error. Signed-off-by: Michal Privoznik Reviewed-by: Laine Stump --- src/qemu/qemu_passt.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_passt.c b/src/qemu/qemu_passt.c index 0f09bf3db8..78830fdc26 100644 --- a/src/qemu/qemu_passt.c +++ b/src/qemu/qemu_passt.c @@ -125,8 +125,11 @@ qemuPasstSetupCgroup(virDomainObj *vm, { pid_t pid =3D (pid_t) -1; =20 - if (qemuPasstGetPid(vm, net, &pid) < 0 || pid <=3D 0) + if (qemuPasstGetPid(vm, net, &pid) < 0 || pid <=3D 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not get process ID of passt")); return -1; + } =20 return virCgroupAddProcess(cgroup, pid); } --=20 2.39.1 From nobody Thu May 2 03:21:13 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=1676375528; cv=none; d=zohomail.com; s=zohoarc; b=P17OBhHCeQ2I2l5dJRNCpq6nQ4J4+hZcNyzu7LwCilcnzZ06KfLGJwF/151f07wlb7O0PJcmQqUwfT6czu/VZTCQegl9bWcX0fGyOlkUlAf08aWDVU+KLtrUW5N1KUAhpWNAwvrNf6CDJWblY9ON1JsV0QZEpwYK8A4/rLhIzzU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1676375528; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=oDg162r32V15U2UZBDKnyhQD4s2WwK82d5ZnhYcuERU=; b=blo3E+3rHyCNsaiusLHkcpKv6COPOiB8IedenIzWq0Qva5Atv68pn6Z3Fb3G9U3UYFmsFh6ctuzr382O3UeJpVWeJcUI0bMjSJaBK/mpNsqBBhP/0DelfOeJ8ejtSgIGl8hPWDBdMaW+Q9uPjWW3aSSOTvt54MvjE0voHgnUJYo= 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 1676375528515277.8814614822119; Tue, 14 Feb 2023 03:52:08 -0800 (PST) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-440-t_CFeuKhP7qSEO8avxo-kw-1; Tue, 14 Feb 2023 06:51:32 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6EA683C0E476; Tue, 14 Feb 2023 11:51:29 +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 5BA0318EC7; Tue, 14 Feb 2023 11:51:29 +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 405C019465BB; Tue, 14 Feb 2023 11:51:29 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 54E711946586 for ; Tue, 14 Feb 2023 11:51:28 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 4813B140006B; Tue, 14 Feb 2023 11:51:28 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id ACBFA140EBF6; Tue, 14 Feb 2023 11:51:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1676375527; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=oDg162r32V15U2UZBDKnyhQD4s2WwK82d5ZnhYcuERU=; b=TRxDnYVZAIT2xHZIHm4gwSeZLrn1iaoNA07p8RdTKJYfCDvgg3eMjOhYlhz4G6uQlpy4qw k3Sjp7I6nYvC9304nIbRC9pA0iiltZZvHRFFtqkuk1fgBvTd0GGjd9rbWBybZMJcO6YGiQ gmNlNxarrW3YpMGeOO+uKk/BYfocgI4= X-MC-Unique: t_CFeuKhP7qSEO8avxo-kw-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 4/4] qemu_passt: Don't let passt fork off Date: Tue, 14 Feb 2023 12:51:22 +0100 Message-Id: <5abfc412e4692a38e980c8dc600e1bfbd03ddcfd.1676374699.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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: , Cc: sbrivio@redhat.com, passt-dev@passt.top Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1676375529908100003 Content-Type: text/plain; charset="utf-8"; x-default="true" When passt starts it tries to do some security measures to restrict itself. For instance, it creates its own namespaces, umounts basically everything, drops capabilities, forks off to further restrict itself (the child is where all interesting work takes place now). This is sound, except it's causing two problems: 1) the PID file FD, which we leak into the passt process, gets closed (and thus our virPidFile*() helpers see unlocked PID file, which makes them think the process is gone), 2) the PID file no longer reflects true PID of the process. Worse, the child calls setsid() so we can't even kill the whole process group. I mean, we can but it won't be any good. Fortunately, passt has '--foreground' argument, which causes it to undergo the same security measures but without forking off the child. This in turn means, that the PID file FD won't get closed and the PID file itself contains the correct PID. Signed-off-by: Michal Privoznik --- src/qemu/qemu_passt.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/qemu/qemu_passt.c b/src/qemu/qemu_passt.c index 78830fdc26..441cfe87e8 100644 --- a/src/qemu/qemu_passt.c +++ b/src/qemu/qemu_passt.c @@ -159,6 +159,7 @@ qemuPasstStart(virDomainObj *vm, virCommandDaemonize(cmd); =20 virCommandAddArgList(cmd, + "--foreground", "--one-off", "--socket", passtSocketName, "--mac-addr", virMacAddrFormat(&net->mac, macaddr= ), --=20 2.39.1