diff --git a/SOURCES/polkit-0.112-add-its-files.patch b/SOURCES/polkit-0.112-add-its-files.patch new file mode 100644 index 0000000..e812b0f --- /dev/null +++ b/SOURCES/polkit-0.112-add-its-files.patch @@ -0,0 +1,37 @@ +diff -up ./data/Makefile.am.ori ./data/Makefile.am +--- ./data/Makefile.am.ori 2013-04-29 19:28:57.000000000 +0200 ++++ ./data/Makefile.am 2018-05-31 14:33:50.164626183 +0200 +@@ -36,6 +36,11 @@ pkgconfig_DATA = polkit-gobject-1.pc pol + + # ---------------------------------------------------------------------------------------------------- + ++itsdir = $(datadir)/gettext/its ++its_DATA = polkit.loc polkit.its ++ ++# ---------------------------------------------------------------------------------------------------- ++ + systemdservice_in_files = polkit.service.in + + if HAVE_SYSTEMD +diff -up ./data/polkit.its.ori ./data/polkit.its +--- ./data/polkit.its.ori 2018-05-31 14:33:50.164626183 +0200 ++++ ./data/polkit.its 2018-05-31 14:33:50.164626183 +0200 +@@ -0,0 +1,8 @@ ++ ++ ++ ++ ++ +diff -up ./data/polkit.loc.ori ./data/polkit.loc +--- ./data/polkit.loc.ori 2018-05-31 14:33:50.165626179 +0200 ++++ ./data/polkit.loc 2018-05-31 14:33:50.164626183 +0200 +@@ -0,0 +1,6 @@ ++ ++ ++ ++ ++ ++ diff --git a/SOURCES/polkit-0.112-bus-conn-msg-ssh.patch b/SOURCES/polkit-0.112-bus-conn-msg-ssh.patch new file mode 100644 index 0000000..f2dcb1a --- /dev/null +++ b/SOURCES/polkit-0.112-bus-conn-msg-ssh.patch @@ -0,0 +1,60 @@ +From 0ce0a7b3298d7b0fd5ce8c6775bcef9b0caf1bdb Mon Sep 17 00:00:00 2001 +From: David Herrmann +Date: Wed, 4 Jul 2018 13:51:24 +0200 +Subject: [PATCH] polkitagent: suppress disconnect messages + +The polkitagent may be used by pkexec and friends. These might very +well survive until very late during system shutdown. Hence, a +disconnect of polkitd during runtime might be expected [1]. + +This patch silences the disconnect/reconnect messages and turns them +into debug messages. This only affects the polkit-agent, it does not +affect the polkit-daemon implementation. + +[1] https://bugzilla.redhat.com/show_bug.cgi?id=1249627 +--- + src/polkitagent/polkitagentlistener.c | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/src/polkitagent/polkitagentlistener.c b/src/polkitagent/polkitagentlistener.c +index debd1bb..1c8b666 100644 +--- a/src/polkitagent/polkitagentlistener.c ++++ b/src/polkitagent/polkitagentlistener.c +@@ -178,10 +178,10 @@ on_notify_authority_owner (GObject *object, + owner = polkit_authority_get_owner (server->authority); + if (owner == NULL) + { +- g_printerr ("PolicyKit daemon disconnected from the bus.\n"); ++ g_debug ("PolicyKit daemon disconnected from the bus.\n"); + + if (server->is_registered) +- g_printerr ("We are no longer a registered authentication agent.\n"); ++ g_debug ("We are no longer a registered authentication agent.\n"); + + server->is_registered = FALSE; + } +@@ -192,17 +192,17 @@ on_notify_authority_owner (GObject *object, + { + GError *error; + +- g_printerr ("PolicyKit daemon reconnected to bus.\n"); +- g_printerr ("Attempting to re-register as an authentication agent.\n"); ++ g_debug ("PolicyKit daemon reconnected to bus.\n"); ++ g_debug ("Attempting to re-register as an authentication agent.\n"); + + error = NULL; + if (server_register (server, &error)) + { +- g_printerr ("We are now a registered authentication agent.\n"); ++ g_debug ("We are now a registered authentication agent.\n"); + } + else + { +- g_printerr ("Failed to register as an authentication agent: %s\n", error->message); ++ g_debug ("Failed to register as an authentication agent: %s\n", error->message); + g_error_free (error); + } + } +-- +2.18.0 + diff --git a/SOURCES/polkit-0.112-pkttyagent-auth-errmsg-debug.patch b/SOURCES/polkit-0.112-pkttyagent-auth-errmsg-debug.patch new file mode 100644 index 0000000..0b66c49 --- /dev/null +++ b/SOURCES/polkit-0.112-pkttyagent-auth-errmsg-debug.patch @@ -0,0 +1,13 @@ +diff -up ./src/programs/pkttyagent.c.ori ./src/programs/pkttyagent.c +--- ./src/programs/pkttyagent.c.ori 2018-08-01 15:51:28.495910434 +0200 ++++ ./src/programs/pkttyagent.c 2018-08-02 15:51:45.126311197 +0200 +@@ -150,7 +150,8 @@ main (int argc, char *argv[]) + authority = polkit_authority_get_sync (NULL /* GCancellable* */, &error); + if (authority == NULL) + { +- g_printerr ("Error getting authority: %s (%s, %d)\n", ++ g_printerr ("Authorization not available. Check if polkit service is running or see debug message for more information.\n"); ++ g_debug ("Error getting authority: %s (%s, %d)\n", + error->message, g_quark_to_string (error->domain), error->code); + g_error_free (error); + ret = 127; diff --git a/SOURCES/polkit-0.112-spawning-zombie-processes.patch b/SOURCES/polkit-0.112-spawning-zombie-processes.patch new file mode 100644 index 0000000..2c2382a --- /dev/null +++ b/SOURCES/polkit-0.112-spawning-zombie-processes.patch @@ -0,0 +1,181 @@ +From a028743f5c88dd7c27c102c34535f25b42ea2c5f Mon Sep 17 00:00:00 2001 +From: Kyle Walker +Date: Mon, 23 Apr 2018 13:07:37 -0400 +Subject: [PATCH] Backport of: + https://bugs.freedesktop.org/attachment.cgi?id=138819 + +Signed-off-by: Kyle Walker +--- + src/polkitbackend/polkitbackendjsauthority.c | 76 +++++++++++++++++++++++++++- + 1 file changed, 74 insertions(+), 2 deletions(-) + +diff --git a/src/polkitbackend/polkitbackendjsauthority.c b/src/polkitbackend/polkitbackendjsauthority.c +index 39ed718..fd1dbfd 100644 +--- a/src/polkitbackend/polkitbackendjsauthority.c ++++ b/src/polkitbackend/polkitbackendjsauthority.c +@@ -83,6 +83,13 @@ struct _PolkitBackendJsAuthorityPrivate + GMutex rkt_timeout_pending_mutex; + gboolean rkt_timeout_pending; + ++ /* avoid zombies by reap child in a new thread */ ++ GThread *child_reaper_thread; ++ GMutex crt_init_mutex; ++ GCond crt_init_cond; ++ GMainContext *crt_context; ++ GMainLoop *crt_loop; ++ + /* A list of JSObject instances */ + GList *scripts; + }; +@@ -124,6 +131,7 @@ enum + /* ---------------------------------------------------------------------------------------------------- */ + + static gpointer runaway_killer_thread_func (gpointer user_data); ++static gpointer child_reaper_thread_func (gpointer user_data); + + static GList *polkit_backend_js_authority_get_admin_auth_identities (PolkitBackendInteractiveAuthority *authority, + PolkitSubject *caller, +@@ -461,6 +469,18 @@ polkit_backend_js_authority_constructed (GObject *object) + PolkitBackendJsAuthority *authority = POLKIT_BACKEND_JS_AUTHORITY (object); + gboolean entered_request = FALSE; + ++ g_mutex_init (&authority->priv->crt_init_mutex); ++ g_cond_init (&authority->priv->crt_init_cond); ++ ++ authority->priv->child_reaper_thread = g_thread_new ("reap-child-thread", ++ child_reaper_thread_func, ++ authority); ++ /* wait for child_reaper_thread to set up its GMainContext */ ++ g_mutex_lock (&authority->priv->crt_init_mutex); ++ while (authority->priv->crt_context == NULL) ++ g_cond_wait (&authority->priv->crt_init_cond, &authority->priv->crt_init_mutex); ++ g_mutex_unlock (&authority->priv->crt_init_mutex); ++ + authority->priv->rt = JS_NewRuntime (8L * 1024L * 1024L); + if (authority->priv->rt == NULL) + goto fail; +@@ -585,6 +605,15 @@ polkit_backend_js_authority_finalize (GObject *object) + g_free (authority->priv->dir_monitors); + g_strfreev (authority->priv->rules_dirs); + ++ g_mutex_clear (&authority->priv->crt_init_mutex); ++ g_cond_clear (&authority->priv->crt_init_cond); ++ ++ /* shut down the child reaper thread */ ++ g_assert (authority->priv->crt_loop != NULL); ++ g_main_loop_quit (authority->priv->crt_loop); ++ g_thread_join (authority->priv->child_reaper_thread); ++ g_assert (authority->priv->crt_loop == NULL); ++ + JS_BeginRequest (authority->priv->cx); + JS_RemoveObjectRoot (authority->priv->cx, &authority->priv->js_polkit); + JS_RemoveObjectRoot (authority->priv->cx, &authority->priv->js_global); +@@ -1360,6 +1389,7 @@ get_signal_name (gint signal_number) + + typedef struct + { ++ PolkitBackendJsAuthority *authority; + GMainLoop *loop; + GAsyncResult *res; + } SpawnData; +@@ -1379,7 +1409,7 @@ js_polkit_spawn (JSContext *cx, + unsigned js_argc, + jsval *vp) + { +- /* PolkitBackendJsAuthority *authority = POLKIT_BACKEND_JS_AUTHORITY (JS_GetContextPrivate (cx)); */ ++ PolkitBackendJsAuthority *authority = POLKIT_BACKEND_JS_AUTHORITY (JS_GetContextPrivate (cx)); + JSBool ret = JS_FALSE; + JSObject *array_object; + gchar *standard_output = NULL; +@@ -1424,6 +1454,8 @@ js_polkit_spawn (JSContext *cx, + JS_free (cx, s); + } + ++ data.authority = authority; ++ + context = g_main_context_new (); + loop = g_main_loop_new (context, FALSE); + +@@ -1540,6 +1572,8 @@ js_polkit_user_is_in_netgroup (JSContext *cx, + + typedef struct + { ++ PolkitBackendJsAuthority *authority; ++ + GSimpleAsyncResult *simple; /* borrowed reference */ + GMainContext *main_context; /* may be NULL */ + +@@ -1572,11 +1606,43 @@ utils_child_watch_from_release_cb (GPid pid, + gint status, + gpointer user_data) + { ++ g_print("Child(pid: %d) has been reaped!\n", pid); ++} ++ ++/* ---------------------------------------------------------------------------------------------------- */ ++ ++static gpointer ++child_reaper_thread_func (gpointer user_data) ++{ ++ PolkitBackendJsAuthority *authority = POLKIT_BACKEND_JS_AUTHORITY (user_data); ++ ++ g_mutex_lock (&authority->priv->crt_init_mutex); ++ ++ authority->priv->crt_context = g_main_context_new (); ++ authority->priv->crt_loop = g_main_loop_new (authority->priv->crt_context, FALSE); ++ g_main_context_push_thread_default (authority->priv->crt_context); ++ ++ /* Signal the main thread that we're done constructing */ ++ g_cond_signal (&authority->priv->crt_init_cond); ++ g_mutex_unlock (&authority->priv->crt_init_mutex); ++ ++ g_main_loop_run (authority->priv->crt_loop); ++ ++ g_main_context_pop_thread_default (authority->priv->crt_context); ++ ++ g_main_loop_unref (authority->priv->crt_loop); ++ authority->priv->crt_loop = NULL; ++ g_main_context_unref (authority->priv->crt_context); ++ authority->priv->crt_context = NULL; ++ ++ return NULL; + } + ++/* ---------------------------------------------------------------------------------------------------- */ + static void + utils_spawn_data_free (UtilsSpawnData *data) + { ++ PolkitBackendJsAuthority *authority = data->authority; + if (data->timeout_source != NULL) + { + g_source_destroy (data->timeout_source); +@@ -1604,12 +1670,17 @@ utils_spawn_data_free (UtilsSpawnData *data) + * Avoid taking a references to ourselves. but note that we need + * to pass the GSource so we can nuke it once handled. + */ ++ ++ /* avoid zombies by reaping child in a new thread ++ * add source to reap thread context ++ */ ++ GMainContext *reap_context = authority->priv->crt_context; + source = g_child_watch_source_new (data->child_pid); + g_source_set_callback (source, + (GSourceFunc) utils_child_watch_from_release_cb, + source, + (GDestroyNotify) g_source_destroy); +- g_source_attach (source, data->main_context); ++ g_source_attach (source, reap_context); + g_source_unref (source); + data->child_pid = 0; + } +@@ -1776,6 +1847,7 @@ utils_spawn (const gchar *const *argv, + GError *error; + + data = g_slice_new0 (UtilsSpawnData); ++ data->authority = ((SpawnData *)user_data)->authority; + data->timeout_seconds = timeout_seconds; + data->simple = g_simple_async_result_new (NULL, + callback, +-- +2.14.3 + diff --git a/SPECS/polkit.spec b/SPECS/polkit.spec index ec41128..7ed7075 100644 --- a/SPECS/polkit.spec +++ b/SPECS/polkit.spec @@ -1,12 +1,12 @@ # Only enable if using patches that touches configure.ac, # Makefile.am or other build system related files # -%define enable_autoreconf 0 +%define enable_autoreconf 1 Summary: An authorization framework Name: polkit Version: 0.112 -Release: 14%{?dist} +Release: 18%{?dist} License: LGPLv2+ URL: http://www.freedesktop.org/wiki/Software/polkit Source0: http://www.freedesktop.org/software/polkit/releases/%{name}-%{version}.tar.gz @@ -25,6 +25,11 @@ Patch4: polkit-0.112-Polkit.spawn-leak.patch Patch5: polkit-0.112-agent-leaks.patch # https://bugs.freedesktop.org/show_bug.cgi?id=99741 Patch6: polkit-0.112-polkitpermission-leak.patch +Patch7: polkit-0.112-add-its-files.patch +Patch8: polkit-0.112-spawning-zombie-processes.patch +Patch9: polkit-0.112-bus-conn-msg-ssh.patch +Patch10: polkit-0.112-pkttyagent-auth-errmsg-debug.patch + Group: System Environment/Libraries BuildRequires: glib2-devel >= 2.30.0 BuildRequires: expat-devel @@ -98,6 +103,10 @@ Development documentation for polkit. %patch4 -p1 -b .Polkit.spawn-leak %patch5 -p1 -b .agent-leaks %patch6 -p1 -b .polkitpermission-leak.patch +%patch7 -p1 -b .its-files.patch +%patch8 -p1 +%patch9 -p1 +%patch10 -p1 %build %if 0%{?enable_autoreconf} @@ -180,12 +189,31 @@ fi %{_libdir}/pkgconfig/*.pc %{_datadir}/gir-1.0/*.gir %{_includedir}/* +%{_datadir}/gettext/its/polkit.its +%{_datadir}/gettext/its/polkit.loc %files docs %defattr(-,root,root,-) %{_datadir}/gtk-doc %changelog +* Wed Aug 01 2018 Jan Rybar - 0.112-18 +- Error message about getting authority is too elaborate +- Resolves: rhbz#1342855 + +* Tue Jul 24 2018 Jan Rybar - 0.112-17 +- Bus disconnection report moved to debug mode +- Resolves: rhbz#1249627 + +* Mon Jul 23 2018 Jan Rybar - 0.112-16 +- polkit spawns zombie processes +- Authored by kwalker@redhat.com +- Resolves: rhbz#1570907 + +* Thu May 31 2018 Jan Rybar - 0.112-15 +- Localization *its* files required by newest Gnome Shell packages +- Resolves: rhbz#1584533 + * Tue Sep 19 2017 Yaakov Selkowitz - 0.112-14 - Rebuilt for mozjs17 48-bit VA on aarch64 Resolves: #1436518