From c54141b5db7a1490c5cff0e18d58304b0e8651c1 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Sep 25 2018 17:33:24 +0000 Subject: import libvirt-3.9.0-14.el7_5.8 --- diff --git a/SOURCES/libvirt-remote-Extract-common-clearing-of-event-callbacks-of-client-private-data.patch b/SOURCES/libvirt-remote-Extract-common-clearing-of-event-callbacks-of-client-private-data.patch new file mode 100644 index 0000000..7a1c783 --- /dev/null +++ b/SOURCES/libvirt-remote-Extract-common-clearing-of-event-callbacks-of-client-private-data.patch @@ -0,0 +1,118 @@ +From 3a6d75f3784f62a5a016ea7790e9e41e8f9572d7 Mon Sep 17 00:00:00 2001 +Message-Id: <3a6d75f3784f62a5a016ea7790e9e41e8f9572d7@dist-git> +From: "xinhua.Cao" +Date: Mon, 20 Aug 2018 10:08:59 -0400 +Subject: [PATCH] remote: Extract common clearing of event callbacks of client + private data + +RHEL 7.6 https://bugzilla.redhat.com/show_bug.cgi?id=1610612 +RHEL 7.5.z https://bugzilla.redhat.com/show_bug.cgi?id=1619206 + +Extract common clearing of event callbacks as remoteClientFreePrivateCallbacks. +the common function also separation including the sysident handling. + +(cherry picked from commit 60e8bbc4c5902222d94474ca355ed9d650a38994) +Signed-off-by: John Ferlan +Reviewed-by: Jiri Denemark +--- + daemon/remote.c | 73 ++++++++++++++++++++++++++----------------------- + 1 file changed, 39 insertions(+), 34 deletions(-) + +diff --git a/daemon/remote.c b/daemon/remote.c +index 806479e72d..70e1227f13 100644 +--- a/daemon/remote.c ++++ b/daemon/remote.c +@@ -1688,6 +1688,44 @@ void remoteRelayConnectionClosedEvent(virConnectPtr conn ATTRIBUTE_UNUSED, int r + VIR_FREE(eventCallbacks); \ + } while (0); + ++ ++static void ++remoteClientFreePrivateCallbacks(struct daemonClientPrivate *priv) ++{ ++ virIdentityPtr sysident = virIdentityGetSystem(); ++ virIdentitySetCurrent(sysident); ++ ++ DEREG_CB(priv->conn, priv->domainEventCallbacks, ++ priv->ndomainEventCallbacks, ++ virConnectDomainEventDeregisterAny, "domain"); ++ DEREG_CB(priv->conn, priv->networkEventCallbacks, ++ priv->nnetworkEventCallbacks, ++ virConnectNetworkEventDeregisterAny, "network"); ++ DEREG_CB(priv->conn, priv->storageEventCallbacks, ++ priv->nstorageEventCallbacks, ++ virConnectStoragePoolEventDeregisterAny, "storage"); ++ DEREG_CB(priv->conn, priv->nodeDeviceEventCallbacks, ++ priv->nnodeDeviceEventCallbacks, ++ virConnectNodeDeviceEventDeregisterAny, "node device"); ++ DEREG_CB(priv->conn, priv->secretEventCallbacks, ++ priv->nsecretEventCallbacks, ++ virConnectSecretEventDeregisterAny, "secret"); ++ DEREG_CB(priv->conn, priv->qemuEventCallbacks, ++ priv->nqemuEventCallbacks, ++ virConnectDomainQemuMonitorEventDeregister, "qemu monitor"); ++ ++ if (priv->closeRegistered) { ++ if (virConnectUnregisterCloseCallback(priv->conn, ++ remoteRelayConnectionClosedEvent) < 0) ++ VIR_WARN("unexpected close callback event deregister failure"); ++ } ++ ++ virIdentitySetCurrent(NULL); ++ virObjectUnref(sysident); ++} ++#undef DEREG_CB ++ ++ + /* + * You must hold lock for at least the client + * We don't free stuff here, merely disconnect the client's +@@ -1701,44 +1739,11 @@ void remoteClientFreeFunc(void *data) + + /* Deregister event delivery callback */ + if (priv->conn) { +- virIdentityPtr sysident = virIdentityGetSystem(); +- +- virIdentitySetCurrent(sysident); +- +- DEREG_CB(priv->conn, priv->domainEventCallbacks, +- priv->ndomainEventCallbacks, +- virConnectDomainEventDeregisterAny, "domain"); +- DEREG_CB(priv->conn, priv->networkEventCallbacks, +- priv->nnetworkEventCallbacks, +- virConnectNetworkEventDeregisterAny, "network"); +- DEREG_CB(priv->conn, priv->storageEventCallbacks, +- priv->nstorageEventCallbacks, +- virConnectStoragePoolEventDeregisterAny, "storage"); +- DEREG_CB(priv->conn, priv->nodeDeviceEventCallbacks, +- priv->nnodeDeviceEventCallbacks, +- virConnectNodeDeviceEventDeregisterAny, "node device"); +- DEREG_CB(priv->conn, priv->secretEventCallbacks, +- priv->nsecretEventCallbacks, +- virConnectSecretEventDeregisterAny, "secret"); +- DEREG_CB(priv->conn, priv->qemuEventCallbacks, +- priv->nqemuEventCallbacks, +- virConnectDomainQemuMonitorEventDeregister, "qemu monitor"); +- +- if (priv->closeRegistered) { +- if (virConnectUnregisterCloseCallback(priv->conn, +- remoteRelayConnectionClosedEvent) < 0) +- VIR_WARN("unexpected close callback event deregister failure"); +- } +- ++ remoteClientFreePrivateCallbacks(priv); + virConnectClose(priv->conn); +- +- virIdentitySetCurrent(NULL); +- virObjectUnref(sysident); + } +- + VIR_FREE(priv); + } +-#undef DEREG_CB + + + static void remoteClientCloseFunc(virNetServerClientPtr client) +-- +2.18.0 + diff --git a/SOURCES/libvirt-remote-Move-the-call-to-remoteClientFreePrivateCallbacks-from-FreeFunc-to-CloseFunc.patch b/SOURCES/libvirt-remote-Move-the-call-to-remoteClientFreePrivateCallbacks-from-FreeFunc-to-CloseFunc.patch new file mode 100644 index 0000000..d664c07 --- /dev/null +++ b/SOURCES/libvirt-remote-Move-the-call-to-remoteClientFreePrivateCallbacks-from-FreeFunc-to-CloseFunc.patch @@ -0,0 +1,60 @@ +From e58f9ff38cdf81aec5cb627575b0203ce41ab29b Mon Sep 17 00:00:00 2001 +Message-Id: +From: "xinhua.Cao" +Date: Mon, 20 Aug 2018 10:09:00 -0400 +Subject: [PATCH] remote: Move the call to remoteClientFreePrivateCallbacks + from FreeFunc to CloseFunc + +RHEL 7.6 https://bugzilla.redhat.com/show_bug.cgi?id=1610612 +RHEL 7.5.z https://bugzilla.redhat.com/show_bug.cgi?id=1619206 + +Still because of commit id 'fe8f1c8b' where we generate a REF for the +Register and that's transparent to the consumer (e.g. how would they +know they need to ensure that Deregister is called), thus the purpose of +this patch is to find a way to Deregister if it's determined that the +consumer hasn't by the time of the "last" REF we'd have. + +This solution to this problem is to alter the processing to have the +remoteClientCloseFunc handle performing the Deregister calls instead of +the remoteClientFreeFunc because there's no way FreeFunc would be called +unless the Deregister was already called. + +(cherry picked from commit 1fd1b7661055577071aab36653eb8f2c2ddda804) +Signed-off-by: John Ferlan +Reviewed-by: Jiri Denemark +--- + daemon/remote.c | 10 ++++++---- + 1 file changed, 6 insertions(+), 4 deletions(-) + +diff --git a/daemon/remote.c b/daemon/remote.c +index 70e1227f13..eb2f95f375 100644 +--- a/daemon/remote.c ++++ b/daemon/remote.c +@@ -1737,11 +1737,9 @@ void remoteClientFreeFunc(void *data) + { + struct daemonClientPrivate *priv = data; + +- /* Deregister event delivery callback */ +- if (priv->conn) { +- remoteClientFreePrivateCallbacks(priv); ++ if (priv->conn) + virConnectClose(priv->conn); +- } ++ + VIR_FREE(priv); + } + +@@ -1751,6 +1749,10 @@ static void remoteClientCloseFunc(virNetServerClientPtr client) + struct daemonClientPrivate *priv = virNetServerClientGetPrivateData(client); + + daemonRemoveAllClientStreams(priv->streams); ++ ++ /* Deregister event delivery callback */ ++ if (priv->conn) ++ remoteClientFreePrivateCallbacks(priv); + } + + +-- +2.18.0 + diff --git a/SPECS/libvirt.spec b/SPECS/libvirt.spec index 0cd9cc7..e0b068c 100644 --- a/SPECS/libvirt.spec +++ b/SPECS/libvirt.spec @@ -240,7 +240,7 @@ Summary: Library providing a simple virtualization API Name: libvirt Version: 3.9.0 -Release: 14%{?dist}.7%{?extra_release} +Release: 14%{?dist}.8%{?extra_release} License: LGPLv2+ Group: Development/Libraries BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root @@ -462,6 +462,8 @@ Patch208: libvirt-util-don-t-check-for-parallel-iteration-in-hash-related-functi Patch209: libvirt-cpu-define-the-virt-ssbd-CPUID-feature-bit-CVE-2018-3639.patch Patch210: libvirt-virNumaGetHugePageInfo-Return-page_avail-and-page_free-as-ULL.patch Patch211: libvirt-daemon-fix-rpc-event-leak-on-error-path-in-remoteDispatchObjectEventSend.patch +Patch212: libvirt-remote-Extract-common-clearing-of-event-callbacks-of-client-private-data.patch +Patch213: libvirt-remote-Move-the-call-to-remoteClientFreePrivateCallbacks-from-FreeFunc-to-CloseFunc.patch Requires: libvirt-daemon = %{version}-%{release} Requires: libvirt-daemon-config-network = %{version}-%{release} @@ -2375,6 +2377,10 @@ exit 0 %changelog +* Tue Sep 4 2018 Jiri Denemark - 3.9.0-14.el7_5.8 +- remote: Extract common clearing of event callbacks of client private data (rhbz#1619206) +- remote: Move the call to remoteClientFreePrivateCallbacks from FreeFunc to CloseFunc (rhbz#1619206) + * Fri Jul 27 2018 Jiri Denemark - 3.9.0-14.el7_5.7 - daemon: fix rpc event leak on error path in remoteDispatchObjectEventSend (rhbz#1607752)