From nobody Wed May 15 19:21:57 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=1677007758; cv=none; d=zohomail.com; s=zohoarc; b=lntkOdoW9mnMSBifVZEI0YASxdaxmsmD6p9qoo3SaDscIu4MZTH2/AE5zau3NLQMB+mSb3536avrZ/KAW0cfSmkc/gdrQ4kYnGH2WKc70nc7kRtdoMDnwkC+ozhVg42O5OeMPMvs/d6KB1DLBlYkyVtgnS3edkwL3pRb8bzm5Po= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677007758; 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=6YpKU7tWJNLGspK+h0+W5LFlfehsshOIT6zjEvcPMoY=; b=lwBFhgQ3KiDtn8DgYPUENMInffhKhw/cH8NEWRGrzL1oaLbgwoPAOXlsqf+NXhcNzn8W8Nw7Q3vfpLted2Ga39Nd6oYewsbiE/ueKQuapnPfqwf/MBLEo5mXScdP/wKLUR4WZF0pX2GuCwdG6wDJLkYc0BM6Abyw8uiHtvnexWc= 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 167700775826147.07361478439361; Tue, 21 Feb 2023 11:29:18 -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-322-xbswAGf_NYOFWPUh8IH7_w-1; Tue, 21 Feb 2023 14:29:12 -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 3021C804BD9; Tue, 21 Feb 2023 19:29:09 +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 950B640B4138; Tue, 21 Feb 2023 19:29:07 +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 354761946589; Tue, 21 Feb 2023 19:29:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id EC5231946587 for ; Tue, 21 Feb 2023 19:29:05 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id A0D0A1121315; Tue, 21 Feb 2023 19:29:05 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 98B081121314 for ; Tue, 21 Feb 2023 19:29:05 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 74006100F926 for ; Tue, 21 Feb 2023 19:29:05 +0000 (UTC) Received: from passt.top (passt.top [88.198.0.164]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-636-aGqPU_s-MS2rmlb0oNw2-g-1; Tue, 21 Feb 2023 14:29:03 -0500 Received: by passt.top (Postfix, from userid 1000) id 2487F5A026B; Tue, 21 Feb 2023 20:19:07 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677007757; 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=6YpKU7tWJNLGspK+h0+W5LFlfehsshOIT6zjEvcPMoY=; b=T/eiZAhvZPOpsL1xLIdc/0aYUiTYkJoZqEKSEXJErJIM2cm5vGzpo6K7nrdJR6l/WDzVLU u/H09kxYjCukqQNe9dItAVDcbIMTmP9+UO0pcSafNGWqaWeSl1AvRk3gDi2y4sXbj463EU a0HU6n5juLKRKj/VWVUf0mMGlHRn1nw= X-MC-Unique: xbswAGf_NYOFWPUh8IH7_w-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: aGqPU_s-MS2rmlb0oNw2-g-1 From: Stefano Brivio To: libvir-list@redhat.com Subject: [PATCH 1/3] qemu_passt: Don't make passt transition to svirt_t/virt_domain on start Date: Tue, 21 Feb 2023 20:19:05 +0100 Message-Id: <20230221191907.3742792-2-sbrivio@redhat.com> In-Reply-To: <20230221191907.3742792-1-sbrivio@redhat.com> References: <20230221191907.3742792-1-sbrivio@redhat.com> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 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: Laine Stump 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: 1677007759790100004 Content-Type: text/plain; charset="utf-8"; x-default="true" qemuSecurityCommandRun() causes an explicit domain transition of the new process, but passt ships with its own SELinux policy, with external interfaces for libvirtd, so we simply need to transition from virtd_t to passt_t as passt is executed. The qemu type enforcement rules have little to do with it. Usage of those new interfaces is implemented by this change in selinux-policy: https://github.com/fedora-selinux/selinux-policy/pull/1613 Replace qemuSecurityCommandRun() with virCommandRun(), which simply does that: it runs the command. Fixes: a56f0168d576 ("qemu: hook up passt config to qemu domains") Signed-off-by: Stefano Brivio --- src/qemu/qemu_passt.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/qemu/qemu_passt.c b/src/qemu/qemu_passt.c index 1217a6a087..1a67cf44de 100644 --- a/src/qemu/qemu_passt.c +++ b/src/qemu/qemu_passt.c @@ -158,8 +158,6 @@ qemuPasstStart(virDomainObj *vm, g_autofree char *errbuf =3D NULL; char macaddr[VIR_MAC_STRING_BUFLEN]; size_t i; - int exitstatus =3D 0; - int cmdret =3D 0; =20 cmd =3D virCommandNew(PASST); =20 @@ -271,10 +269,7 @@ qemuPasstStart(virDomainObj *vm, if (qemuExtDeviceLogCommand(driver, vm, cmd, "passt") < 0) return -1; =20 - if (qemuSecurityCommandRun(driver, vm, cmd, -1, -1, &exitstatus, &cmdr= et) < 0) - goto error; - - if (cmdret < 0 || exitstatus !=3D 0) { + if (virCommandRun(cmd, NULL)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Could not start 'passt': %s"), NULLSTR(errbuf)); goto error; --=20 2.39.1 From nobody Wed May 15 19:21:57 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=1677007759; cv=none; d=zohomail.com; s=zohoarc; b=ARLzKyKWnvLU7I06G3jaEbBpXRfSkd9q/Mm8PpXPj06MVZmAdrpdRX6BK3LYb2y24CXZwCMwz6qIwfXPhzzUz2+VdUaoIdH2QDNfDA9EcogcdYgcVyiUTc8jrp7iUSEb9YVg9bIoTv1SChaJkgiSoikFAcFTDvxYArUN1dlrCrA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677007759; 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=NPoKXHdTprELr6EXWKj+6vJBExrVTaKdmw0fM0j47aQ=; b=L/VSLGPVMp49o6qwIcxJ0yhrw+Eonox2MngtBoItZaWiXiLHRWwcg9kxzlnGZ+2Ie2xaZB+QvdWUWnFUDZdUX0tXEHre77vfSr53kO5HukVhFt0zBKjElLUO23Lkmd9RUcaHAk7sqxFUu7FnR21vOtr+AWNekB2VGjb6Ekjz3zs= 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 1677007759308565.6396145449339; Tue, 21 Feb 2023 11:29:19 -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-647-_TmBo1kEMGmnxSKG2ptXcw-1; Tue, 21 Feb 2023 14:29:13 -0500 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 4F0093C0DDBF; Tue, 21 Feb 2023 19:29:09 +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 2B1F0492B03; Tue, 21 Feb 2023 19:29:09 +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 C019F1946A5E; Tue, 21 Feb 2023 19:29:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id B1CFE1946587 for ; Tue, 21 Feb 2023 19:29:06 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id A65291121318; Tue, 21 Feb 2023 19:29:06 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9EB741121315 for ; Tue, 21 Feb 2023 19:29:06 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8804F802DFE for ; Tue, 21 Feb 2023 19:29:06 +0000 (UTC) Received: from passt.top (passt.top [88.198.0.164]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-608-P7ChssaOOMiay-WNMXpx9g-1; Tue, 21 Feb 2023 14:29:03 -0500 Received: by passt.top (Postfix, from userid 1000) id 268765A026C; Tue, 21 Feb 2023 20:19:07 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677007758; 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=NPoKXHdTprELr6EXWKj+6vJBExrVTaKdmw0fM0j47aQ=; b=g2HQ15YpMquwbi4CbY1pY748j6bsRf3ZBezQvK13nnaJKDWsADg1ESx5aWeaI8Hs64t1Cx vTEwuY5qcKea0x4aDvgQi7hKow0GDsGdiy2I/c8+z1RgeGwlQYRlyJnnLxtk1K8W2Ncf/R rKuxM/SWxaBSF7K2LFjSq1TjbawBWsY= X-MC-Unique: _TmBo1kEMGmnxSKG2ptXcw-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: P7ChssaOOMiay-WNMXpx9g-1 From: Stefano Brivio To: libvir-list@redhat.com Subject: [PATCH 2/3] qemu_passt: Set UID and GID to configured values for qemu driver, if any Date: Tue, 21 Feb 2023 20:19:06 +0100 Message-Id: <20230221191907.3742792-3-sbrivio@redhat.com> In-Reply-To: <20230221191907.3742792-1-sbrivio@redhat.com> References: <20230221191907.3742792-1-sbrivio@redhat.com> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 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: Laine Stump 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-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1677007759783100003 Content-Type: text/plain; charset="utf-8"; x-default="true" qemuSecurityCommandRun() would have dealt with this (if UID and GID had been passed). With virCommandRun() we need separate, explicit calls. Fixes: a56f0168d576 ("qemu: hook up passt config to qemu domains") Signed-off-by: Stefano Brivio --- src/qemu/qemu_passt.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/qemu/qemu_passt.c b/src/qemu/qemu_passt.c index 1a67cf44de..c7012e349a 100644 --- a/src/qemu/qemu_passt.c +++ b/src/qemu/qemu_passt.c @@ -152,6 +152,7 @@ qemuPasstStart(virDomainObj *vm, { qemuDomainObjPrivate *priv =3D vm->privateData; virQEMUDriver *driver =3D priv->driver; + g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); g_autofree char *passtSocketName =3D qemuPasstCreateSocketPath(vm, net= ); g_autoptr(virCommand) cmd =3D NULL; g_autofree char *pidfile =3D qemuPasstCreatePidFilename(vm, net); @@ -164,6 +165,11 @@ qemuPasstStart(virDomainObj *vm, virCommandClearCaps(cmd); virCommandSetErrorBuffer(cmd, &errbuf); =20 + if (cfg->user !=3D (uid_t) -1) + virCommandSetUID(cmd, cfg->user); + if (cfg->group !=3D (gid_t) -1) + virCommandSetGID(cmd, cfg->group); + virCommandAddArgList(cmd, "--one-off", "--socket", passtSocketName, --=20 2.39.1 From nobody Wed May 15 19:21:57 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=1677007756; cv=none; d=zohomail.com; s=zohoarc; b=YsRXQtmIQh8YmrJziP78mto3mXLdqupirxSYRm8OsnHf1/5aWBI4mDH8CxN5i02wnko7yKr0Gx5MuYXtnc+GWWJTqkUlldxcXF5+RtDqZUlk0v7w+4cp22lzteuigvWixAmOtkpHBn/UvImI9Mm2oVuxl+lqGL1IRP1mHU+LO7E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677007756; 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=tpmfHHI/Msp2vRCpRVW5iCvf9yI56hFlruypP1xsQYo=; b=PwxRsqTa1hcmMRr8+nXvQgXw7YmQTIsdLB3gN8y3Pc2PKvELvp5wzfWVjAtzZQhGNkKfQn68+d9HtJzPhmev0c25mis03iP6gVjOrbGhYaXygysnm2b6+5yv/Eelt/VJylpksYWax15uVoAGVcWIZRKyfPKmmyQAjMszk+mRtxs= 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 1677007756258877.5929544790386; Tue, 21 Feb 2023 11:29:16 -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-220-1dQWSWd_NbyuP7K8AxHqbQ-1; Tue, 21 Feb 2023 14:29:13 -0500 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 30F69280A353; Tue, 21 Feb 2023 19:29:09 +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 C2E34492B09; Tue, 21 Feb 2023 19:29:08 +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 889CE1946A40; Tue, 21 Feb 2023 19:29:07 +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 EE9DE1946588 for ; Tue, 21 Feb 2023 19:29:05 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id B0C2C492B06; Tue, 21 Feb 2023 19:29:05 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A86D2492B04 for ; Tue, 21 Feb 2023 19:29:05 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8AFD0830D4A for ; Tue, 21 Feb 2023 19:29:05 +0000 (UTC) Received: from passt.top (passt.top [88.198.0.164]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-642-w2Yzzb7QPvSlN10_B6WcUA-1; Tue, 21 Feb 2023 14:29:03 -0500 Received: by passt.top (Postfix, from userid 1000) id 2833D5A026D; Tue, 21 Feb 2023 20:19:07 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677007755; 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=tpmfHHI/Msp2vRCpRVW5iCvf9yI56hFlruypP1xsQYo=; b=Hz4WEi6myp35esxE0SWvafhPbpAk9hUR27sILmvmHDLjaHgTvZ80SJUKG1S/FJ05NFXj3o 95hWgyCxAAWSyP06uebIwyHkfbl1rJg2LmUJCeLOw2WeM2j1gZJAUNZ4kKNTwepTztohpU YAxYGX1gUr9MezG1uVLbi20YbOW0MJo= X-MC-Unique: 1dQWSWd_NbyuP7K8AxHqbQ-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: w2Yzzb7QPvSlN10_B6WcUA-1 From: Stefano Brivio To: libvir-list@redhat.com Subject: [PATCH 3/3] qemu_passt: Remove passt socket file on exit Date: Tue, 21 Feb 2023 20:19:07 +0100 Message-Id: <20230221191907.3742792-4-sbrivio@redhat.com> In-Reply-To: <20230221191907.3742792-1-sbrivio@redhat.com> References: <20230221191907.3742792-1-sbrivio@redhat.com> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false 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: , Cc: Laine Stump Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 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: 1677007757758100001 Content-Type: text/plain; charset="utf-8"; x-default="true" Just like it can't remove its own PID files, passt can't unlink its own socket upon exit (unless the initialisation fails), because it has no access to the filesystem at runtime. Remove the socket file in qemuPasstKill(). Fixes: a56f0168d576 ("qemu: hook up passt config to qemu domains") Signed-off-by: Stefano Brivio Reviewed-by: Laine Stump --- src/qemu/qemu_passt.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_passt.c b/src/qemu/qemu_passt.c index c7012e349a..0e028ca752 100644 --- a/src/qemu/qemu_passt.c +++ b/src/qemu/qemu_passt.c @@ -103,7 +103,7 @@ qemuPasstAddNetProps(virDomainObj *vm, =20 =20 static void -qemuPasstKill(const char *pidfile) +qemuPasstKill(const char *pidfile, const char *passtSocketName) { virErrorPtr orig_err; pid_t pid =3D 0; @@ -115,6 +115,8 @@ qemuPasstKill(const char *pidfile) virProcessKillPainfully(pid, true); unlink(pidfile); =20 + unlink(passtSocketName); + virErrorRestore(&orig_err); } =20 @@ -124,8 +126,9 @@ qemuPasstStop(virDomainObj *vm, virDomainNetDef *net) { g_autofree char *pidfile =3D qemuPasstCreatePidFilename(vm, net); + g_autofree char *passtSocketName =3D qemuPasstCreateSocketPath(vm, net= ); =20 - qemuPasstKill(pidfile); + qemuPasstKill(pidfile, passtSocketName); } =20 =20 @@ -284,6 +287,6 @@ qemuPasstStart(virDomainObj *vm, return 0; =20 error: - qemuPasstKill(pidfile); + qemuPasstKill(pidfile, passtSocketName); return -1; } --=20 2.39.1