From nobody Wed May 14 06:46:35 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1525950114757740.8758682699097; Thu, 10 May 2018 04:01:54 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 989A64ACAE; Thu, 10 May 2018 11:01:52 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6346D106223E; Thu, 10 May 2018 11:01:52 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id AC41D180B536; Thu, 10 May 2018 11:01:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w4AB1Yvm021692 for ; Thu, 10 May 2018 07:01:35 -0400 Received: by smtp.corp.redhat.com (Postfix) id CEDC32026E03; Thu, 10 May 2018 11:01:34 +0000 (UTC) Received: from antique-work.brq.redhat.com (unknown [10.43.2.152]) by smtp.corp.redhat.com (Postfix) with ESMTP id 745E92026DEF for ; Thu, 10 May 2018 11:01:34 +0000 (UTC) From: Pavel Hrdina To: libvir-list@redhat.com Date: Thu, 10 May 2018 13:01:31 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Subject: [libvirt] [dbus PATCH 3/4] domain: Implement OpenGraphicsFD method X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 10 May 2018 11:01:53 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Pavel Hrdina --- In order to test it you need to disable SELinux, otherwise the libvirt-dbus daemon is disconnected from system bus by dbus-daemon. The issue is that dbus-daemon will get avc denied on the passed FD. The following policy will allow it: ------------------------------------------------------------------------ require { type svirt_t; type system_dbusd_t; class unix_stream_socket { read write }; } allow system_dbusd_t svirt_t:unix_stream_socket { read write }; ------------------------------------------------------------------------ data/org.libvirt.Domain.xml | 7 +++++++ src/domain.c | 31 +++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml index 9743f25..bcd0779 100644 --- a/data/org.libvirt.Domain.xml +++ b/data/org.libvirt.Domain.xml @@ -390,6 +390,13 @@ value=3D"See https://libvirt.org/html/libvirt-libvirt-domain.html#= virDomainMigrateStartPostCopy"/> + + + + + + diff --git a/src/domain.c b/src/domain.c index 3551e31..eaef68c 100644 --- a/src/domain.c +++ b/src/domain.c @@ -2033,6 +2033,36 @@ virtDBusDomainMigrateStartPostCopy(GVariant *inArgs, virtDBusUtilSetLastVirtError(error); } =20 +static void +virtDBusDomainOpenGraphicsFD(GVariant *inArgs, + GUnixFDList *inFDs G_GNUC_UNUSED, + const gchar *objectPath, + gpointer userData, + GVariant **outArgs, + GUnixFDList **outFDs, + GError **error) + +{ + virtDBusConnect *connect =3D userData; + g_autoptr(virDomain) domain =3D NULL; + guint idx; + guint flags; + gint fd; + + g_variant_get(inArgs, "(uu)", &idx, &flags); + + domain =3D virtDBusDomainGetVirDomain(connect, objectPath, error); + if (!domain) + return; + + fd =3D virDomainOpenGraphicsFD(domain, idx, flags); + if (fd < 0) + return virtDBusUtilSetLastVirtError(error); + + *outArgs =3D g_variant_new("(h)", 0); + *outFDs =3D g_unix_fd_list_new_from_array(&fd, 1); +} + static void virtDBusDomainPinEmulator(GVariant *inArgs, GUnixFDList *inFDs G_GNUC_UNUSED, @@ -2896,6 +2926,7 @@ static virtDBusGDBusMethodTable virtDBusDomainMethodT= able[] =3D { { "MigrateSetMaxDowntime", virtDBusDomainMigrateSetMaxDowntime }, { "MigrateSetMaxSpeed", virtDBusDomainMigrateSetMaxSpeed }, { "MigrateStartPostCopy", virtDBusDomainMigrateStartPostCopy }, + { "OpenGraphicsFD", virtDBusDomainOpenGraphicsFD }, { "PinEmulator", virtDBusDomainPinEmulator }, { "PinIOThread", virtDBusDomainPinIOThread }, { "PinVcpu", virtDBusDomainPinVcpu }, --=20 2.17.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list