From f48abd2745d0037f0408776a1ea5702b50361b14 Mon Sep 17 00:00:00 2001 From: toppk Date: Sat, 28 Sep 2019 11:23:56 -0400 Subject: [PATCH] - rename patch to follow convention - fix for bug preventing coredumps --- ...ybinding-handle-no-handler-functions.patch | 109 ++++++++++++++++++ ...d-PR_SET_DUMPABLE-to-allow-coredumps.patch | 73 ++++++++++++ 806.patch | 46 -------- mutter.spec | 4 +- 4 files changed, 185 insertions(+), 47 deletions(-) create mode 100644 0005-keybinding-handle-no-handler-functions.patch create mode 100644 0006-add-PR_SET_DUMPABLE-to-allow-coredumps.patch delete mode 100644 806.patch diff --git a/0005-keybinding-handle-no-handler-functions.patch b/0005-keybinding-handle-no-handler-functions.patch new file mode 100644 index 0000000..76ff298 --- /dev/null +++ b/0005-keybinding-handle-no-handler-functions.patch @@ -0,0 +1,109 @@ +From 0706e021f5bd82cf4c9b2c0d2916d272f3cba406 Mon Sep 17 00:00:00 2001 +From: Olivier Fourdan +Date: Tue, 24 Sep 2019 16:55:25 +0200 +Subject: [PATCH 1/2] keybindings: Check for a handler before using it + +The `process_event()` would check for a existing keybinding handler and +abort if there is none, however the test is done after the handler had +been accessed, hence defeating the purpose of the check. + +Move the check to verify there is an existing keybinding handler before +actually using it. + +https://gitlab.gnome.org/GNOME/mutter/issues/823 +--- + src/core/keybindings.c | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/src/core/keybindings.c b/src/core/keybindings.c +index a5a60e8cd..b9377bfff 100644 +--- a/src/core/keybindings.c ++++ b/src/core/keybindings.c +@@ -1955,6 +1955,9 @@ process_event (MetaDisplay *display, + (!window && binding->flags & META_KEY_BINDING_PER_WINDOW)) + goto not_found; + ++ if (binding->handler == NULL) ++ meta_bug ("Binding %s has no handler\n", binding->name); ++ + if (display->focus_window && + !(binding->handler->flags & META_KEY_BINDING_NON_MASKABLE)) + { +@@ -1980,12 +1983,9 @@ process_event (MetaDisplay *display, + return TRUE; + } + +- if (binding->handler == NULL) +- meta_bug ("Binding %s has no handler\n", binding->name); +- else +- meta_topic (META_DEBUG_KEYBINDINGS, +- "Running handler for %s\n", +- binding->name); ++ meta_topic (META_DEBUG_KEYBINDINGS, ++ "Running handler for %s\n", ++ binding->name); + + /* Global keybindings count as a let-the-terminal-lose-focus + * due to new window mapping until the user starts +-- +2.22.0 + + +From 76f2579e442d8ad0a3b8b644daab7c72a585506b Mon Sep 17 00:00:00 2001 +From: Olivier Fourdan +Date: Tue, 24 Sep 2019 16:58:32 +0200 +Subject: [PATCH 2/2] keybinding: Check for handler functions as well + +With the addition of the locate-pointer special keybinding (defaults to +the [Control] key), we have now two separate special modifier keys which +can be triggered separately, one for the locate-pointer action and +another one for overlay. + +When processing those special modifier keys, mutter must ensure that the +key was pressed alone, being a modifier, the key could otherwise be part +of another key combo. + +As result, if both special modifiers keys are pressed simultaneously, +mutter will try to trigger the function for the second key being +pressed, and since those special modifier keys have no default handler +function set, that will crash mutter. + +Check if the handler has a function associated and treat the keybinding +as not found if no handler function is set, as with the special modifier +keys. + +https://gitlab.gnome.org/GNOME/mutter/issues/823 +--- + src/core/keybindings.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/src/core/keybindings.c b/src/core/keybindings.c +index b9377bfff..b86272541 100644 +--- a/src/core/keybindings.c ++++ b/src/core/keybindings.c +@@ -1933,6 +1933,12 @@ invoke_handler (MetaDisplay *display, + NULL); + } + ++static gboolean ++meta_key_binding_has_handler_func (MetaKeyBinding *binding) ++{ ++ return (!!binding->handler->func || !!binding->handler->default_func); ++} ++ + static gboolean + process_event (MetaDisplay *display, + MetaWindow *window, +@@ -1958,6 +1964,9 @@ process_event (MetaDisplay *display, + if (binding->handler == NULL) + meta_bug ("Binding %s has no handler\n", binding->name); + ++ if (!meta_key_binding_has_handler_func (binding)) ++ goto not_found; ++ + if (display->focus_window && + !(binding->handler->flags & META_KEY_BINDING_NON_MASKABLE)) + { +-- +2.22.0 + diff --git a/0006-add-PR_SET_DUMPABLE-to-allow-coredumps.patch b/0006-add-PR_SET_DUMPABLE-to-allow-coredumps.patch new file mode 100644 index 0000000..84220db --- /dev/null +++ b/0006-add-PR_SET_DUMPABLE-to-allow-coredumps.patch @@ -0,0 +1,73 @@ +From dbe9daeb763bffdf2ba4a5fa7c2a3ac8587c0d37 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jonas=20=C3=85dahl?= +Date: Fri, 27 Sep 2019 10:15:48 +0200 +Subject: [PATCH] main: Make process PR_SET_DUMPABLE + +Otherwise we won't get core dumps if the launching binary has +capabilities set. + +https://gitlab.gnome.org/GNOME/mutter/merge_requests/811 +--- + config.h.meson | 3 +++ + meson.build | 4 ++++ + src/core/main.c | 8 ++++++++ + 3 files changed, 15 insertions(+) + +diff --git a/config.h.meson b/config.h.meson +index 77045319c..0bab71848 100644 +--- a/config.h.meson ++++ b/config.h.meson +@@ -61,6 +61,9 @@ + /* XKB base prefix */ + #mesondefine XKB_BASE + ++/* Whether exists and it defines prctl() */ ++#mesondefine HAVE_SYS_PRCTL ++ + /* Either or */ + #mesondefine HAVE_SYS_RANDOM + #mesondefine HAVE_LINUX_RANDOM +diff --git a/meson.build b/meson.build +index ae0bbfcc2..55ab3eb14 100644 +--- a/meson.build ++++ b/meson.build +@@ -366,6 +366,10 @@ cdata.set('HAVE_PROFILER', have_profiler) + xkb_base = xkeyboard_config_dep.get_pkgconfig_variable('xkb_base') + cdata.set_quoted('XKB_BASE', xkb_base) + ++if cc.has_header_symbol('sys/prctl.h', 'prctl') ++ cdata.set('HAVE_SYS_PRCTL', 1) ++endif ++ + if have_wayland + xwayland_path = get_option('xwayland_path') + if xwayland_path == '' +diff --git a/src/core/main.c b/src/core/main.c +index 2724cf076..7f4f666d2 100644 +--- a/src/core/main.c ++++ b/src/core/main.c +@@ -70,6 +70,10 @@ + #include + #endif /* HAVE_WAYLAND && HAVE_NATIVE_BACKEND */ + ++#ifdef HAVE_SYS_PRCTL ++#include ++#endif ++ + #include "backends/meta-backend-private.h" + #include "backends/x11/cm/meta-backend-x11-cm.h" + #include "backends/x11/meta-backend-x11.h" +@@ -532,6 +536,10 @@ meta_init (void) + MetaCompositorType compositor_type; + GType backend_gtype; + ++#ifdef HAVE_SYS_PRCTL ++ prctl (PR_SET_DUMPABLE, 1); ++#endif ++ + sigemptyset (&empty_mask); + act.sa_handler = SIG_IGN; + act.sa_mask = empty_mask; +-- +2.22.0 + diff --git a/806.patch b/806.patch deleted file mode 100644 index 770b77e..0000000 --- a/806.patch +++ /dev/null @@ -1,46 +0,0 @@ -diff --git a/src/core/keybindings.c b/src/core/keybindings.c -index a5a60e8cde30e395968e7d511d599c5a1e56e731..b86272541bd21782b14b63ea10df783f98388d93 100644 ---- a/src/core/keybindings.c -+++ b/src/core/keybindings.c -@@ -1933,6 +1933,12 @@ invoke_handler (MetaDisplay *display, - NULL); - } - -+static gboolean -+meta_key_binding_has_handler_func (MetaKeyBinding *binding) -+{ -+ return (!!binding->handler->func || !!binding->handler->default_func); -+} -+ - static gboolean - process_event (MetaDisplay *display, - MetaWindow *window, -@@ -1955,6 +1961,12 @@ process_event (MetaDisplay *display, - (!window && binding->flags & META_KEY_BINDING_PER_WINDOW)) - goto not_found; - -+ if (binding->handler == NULL) -+ meta_bug ("Binding %s has no handler\n", binding->name); -+ -+ if (!meta_key_binding_has_handler_func (binding)) -+ goto not_found; -+ - if (display->focus_window && - !(binding->handler->flags & META_KEY_BINDING_NON_MASKABLE)) - { -@@ -1980,12 +1992,9 @@ process_event (MetaDisplay *display, - return TRUE; - } - -- if (binding->handler == NULL) -- meta_bug ("Binding %s has no handler\n", binding->name); -- else -- meta_topic (META_DEBUG_KEYBINDINGS, -- "Running handler for %s\n", -- binding->name); -+ meta_topic (META_DEBUG_KEYBINDINGS, -+ "Running handler for %s\n", -+ binding->name); - - /* Global keybindings count as a let-the-terminal-lose-focus - * due to new window mapping until the user starts diff --git a/mutter.spec b/mutter.spec index 9f3dc5d..0e16433 100644 --- a/mutter.spec +++ b/mutter.spec @@ -24,7 +24,8 @@ Patch1: 792.patch Patch2: clutter-timeline-Use-a-function-to-cancel-the-delay-timeo.patch Patch3: clutter-timeline-Don-t-emit-paused-signal-on-delayed-time.patch Patch4: clutter-actor-Cancel-delayed-timelines-on-removal.patch -Patch5: 806.patch +Patch5: 0005-keybinding-handle-no-handler-functions.patch +Patch6: 0006-add-PR_SET_DUMPABLE-to-allow-coredumps.patch BuildRequires: chrpath @@ -172,6 +173,7 @@ desktop-file-validate %{buildroot}/%{_datadir}/applications/%{name}.desktop %changelog * Sat Sep 28 2019 Kenneth Topp - 3.34.0-5 - Backport fix for dual special modifier keys bug (#1754867) +- Backport fix that enables core dumps (#1748145) * Fri Sep 27 2019 Kenneth Topp - 3.34.0-4 - Backport a patch to prevent crash during animations