From nobody Mon May 13 12:45:07 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) 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 1710169342660899.3138520173719; Mon, 11 Mar 2024 08:02:22 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 58BCC1E01; Mon, 11 Mar 2024 11:02:21 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 0FCAE1D91; Mon, 11 Mar 2024 11:00:27 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id EFC361D6B; Mon, 11 Mar 2024 11:00:18 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.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 7A1D31D4B for ; Mon, 11 Mar 2024 11:00:18 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-474-q9drtzFrOqu74WaKBqY6lw-1; Mon, 11 Mar 2024 11:00:16 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5FD95186543A for ; Mon, 11 Mar 2024 15:00:16 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.45.224.189]) by smtp.corp.redhat.com (Postfix) with ESMTP id D1AD340C6CB8 for ; Mon, 11 Mar 2024 15:00:15 +0000 (UTC) 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=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: q9drtzFrOqu74WaKBqY6lw-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: devel@lists.libvirt.org Subject: [libvirt PATCH 1/3] qemu: virtiofs: do not crash if cgroups are missing Date: Mon, 11 Mar 2024 15:59:50 +0100 Message-ID: <21e5ac7aeaaeb78832be593e26cab99025ac9338.1710169192.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: R6I3MA3W6TWMTETG4SY7MFR6NK5PT5HX X-Message-ID-Hash: R6I3MA3W6TWMTETG4SY7MFR6NK5PT5HX X-MailFrom: jtomko@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: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1710169343164100001 On domain startup, qemuSetupCgroupForExtDevices checks if a cgroup controller is present and skips the setup if not. Add a similar check to qemuVirtioFSSetupCgroup to prevent crashing when hotplugging a virtiofs filesystem. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Michal Privoznik --- src/qemu/qemu_virtiofs.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/qemu/qemu_virtiofs.c b/src/qemu/qemu_virtiofs.c index d539d0a192..15dea3bb57 100644 --- a/src/qemu/qemu_virtiofs.c +++ b/src/qemu/qemu_virtiofs.c @@ -353,6 +353,9 @@ qemuVirtioFSSetupCgroup(virDomainObj *vm, pid_t pid =3D -1; int rc; =20 + if (!cgroup) + return 0; + if (!(pidfile =3D qemuVirtioFSCreatePidFilename(vm, fs->info.alias))) return -1; =20 --=20 2.44.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org From nobody Mon May 13 12:45:07 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) 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 171016947708822.823065406427077; Mon, 11 Mar 2024 08:04:37 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id EE42C175B; Mon, 11 Mar 2024 11:04:35 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 4BB391DA9; Mon, 11 Mar 2024 11:00:41 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 1BE031D86; Mon, 11 Mar 2024 11:00:24 -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 98EF01D4B for ; Mon, 11 Mar 2024 11:00:23 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-31-uHmOU9ZJOeK-GBnelHgQJg-1; Mon, 11 Mar 2024 11:00:17 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6453F8DC676 for ; Mon, 11 Mar 2024 15:00:17 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.45.224.189]) by smtp.corp.redhat.com (Postfix) with ESMTP id BE03940C6CB7 for ; Mon, 11 Mar 2024 15:00:16 +0000 (UTC) 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=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: uHmOU9ZJOeK-GBnelHgQJg-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: devel@lists.libvirt.org Subject: [libvirt PATCH 2/3] qemu: virtiofs: set correct label when creating the socket Date: Mon, 11 Mar 2024 15:59:51 +0100 Message-ID: <461cf5af2175dc4f031d25ab78fea5aac70843cf.1710169192.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: JINF73C7JYNP7W62WVQRUZRAXG47LA2K X-Message-ID-Hash: JINF73C7JYNP7W62WVQRUZRAXG47LA2K X-MailFrom: jtomko@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: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1710169477833100001 Use svirt_t instead of virtd_t, since virtd_t is not available in the session mode and qemu with svirt_t won't be able to talk to unconfined_t socket. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Michal Privoznik --- src/qemu/qemu_virtiofs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qemu/qemu_virtiofs.c b/src/qemu/qemu_virtiofs.c index 15dea3bb57..d80cddd3ba 100644 --- a/src/qemu/qemu_virtiofs.c +++ b/src/qemu/qemu_virtiofs.c @@ -102,7 +102,7 @@ qemuVirtioFSOpenChardev(virQEMUDriver *driver, chrdev->data.nix.listen =3D true; chrdev->data.nix.path =3D g_strdup(socket_path); =20 - if (qemuSecuritySetDaemonSocketLabel(driver->securityManager, vm->def)= < 0) + if (qemuSecuritySetSocketLabel(driver->securityManager, vm->def) < 0) goto cleanup; fd =3D qemuOpenChrChardevUNIXSocket(chrdev); if (fd < 0) { --=20 2.44.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org From nobody Mon May 13 12:45:07 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) 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 1710169413303668.2273436388397; Mon, 11 Mar 2024 08:03:33 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 3E5191DA6; Mon, 11 Mar 2024 11:03:32 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 098191E36; Mon, 11 Mar 2024 11:00:29 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 23DB21D6B; Mon, 11 Mar 2024 11:00:23 -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 A40301D4B for ; Mon, 11 Mar 2024 11:00:22 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-125-3-m3YoGMPSi2aK4XoBKxXA-1; Mon, 11 Mar 2024 11:00:19 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6CB24186543A for ; Mon, 11 Mar 2024 15:00:18 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.45.224.189]) by smtp.corp.redhat.com (Postfix) with ESMTP id C474640C6CB7 for ; Mon, 11 Mar 2024 15:00:17 +0000 (UTC) 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=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: 3-m3YoGMPSi2aK4XoBKxXA-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: devel@lists.libvirt.org Subject: [libvirt PATCH 3/3] qemu: virtiofs: error out if getting the group or user name fails Date: Mon, 11 Mar 2024 15:59:52 +0100 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: ZZSGWHGQEW6WUTQ3X7TSYUIRMP4N2OVP X-Message-ID-Hash: ZZSGWHGQEW6WUTQ3X7TSYUIRMP4N2OVP X-MailFrom: jtomko@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: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1710169415487100001 Signed-off-by: J=C3=A1n Tomko Reviewed-by: Michal Privoznik --- src/qemu/qemu_virtiofs.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/qemu/qemu_virtiofs.c b/src/qemu/qemu_virtiofs.c index d80cddd3ba..78897d8177 100644 --- a/src/qemu/qemu_virtiofs.c +++ b/src/qemu/qemu_virtiofs.c @@ -388,6 +388,9 @@ qemuVirtioFSPrepareIdMap(virDomainFSDef *fs) username =3D virGetUserName(euid); groupname =3D virGetGroupName(egid); =20 + if (!username || !groupname) + return -1; + fs->idmap.uidmap =3D g_new0(virDomainIdMapEntry, 2); fs->idmap.gidmap =3D g_new0(virDomainIdMapEntry, 2); =20 --=20 2.44.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org