resolute, stonking and tenacious have the same crash: all three ship gtk+3.0 3.24.52-0ubuntu1, and that version doesn't have e6372d29. Below are a self-contained reproducer that doesn't need LibreOffice and runs headless on Wayland (sway), plus crash rates with and without the upstream commit on 3.24.52-0ubuntu1. Could the fix go into tenacious and then be SRUed to resolute (and stonking, and noble as asked above)?
The upstream fix is https://gitlab.gnome.org/GNOME/gtk/-/commit/e6372d2923d04bb2bdc88fa526ca57704ca2664a ("a11y: Browse key listener list safely", https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/10391). It's on gtk-3-24 since 2026-10-01 and changes 3 lines in gtk/a11y/gtkaccessibilityutil.c. It applies on top of the full 3.24.52-0ubuntu1 patch series (all 19 patches; checked with quilt). == Affected == - libgtk-3-0t64 3.24.52-0ubuntu1 (resolute, stonking and tenacious release pockets), on Ubuntu 26.04 with at-spi2-core / libatk-bridge2.0-0t64 2.60.4-0ubuntu0.1 and sway 1.11. - The crash doesn't depend on the backend. I reproduced it on Wayland (headless sway) and on X11 (Xvfb + i3), and the report above reproduces it in Xephyr. - Any GTK 3 application is exposed whenever an AT-SPI client exits while the application is handling a key press: an Orca restart, an accessibility tool closing, or any short-lived pyatspi script. Debian also tracks this as a lock-screen bypass in xfce4-screensaver (https://gitlab.xfce.org/apps/xfce4-screensaver/-/work_items/199, https://bugs.debian.org/1150544). == Reproducer (no application needed) == It takes about 2 minutes in a fresh container. Nothing here touches your desktop session: it starts its own headless sway, D-Bus session bus and accessibility bus. 1. Start a container and install the packages: docker run --rm -it ubuntu:26.04 apt update apt install -y --no-install-recommends sway wtype python3-gi gir1.2-gtk-3.0 gir1.2-atspi-2.0 at-spi2-core dbus-bin gdb For symbolic backtraces, also install libgtk-3-0t64-dbgsym from ddebs.ubuntu.com. 2. Create these three files in one directory. app.py, a GTK 3 window with an entry: #!/usr/bin/env python3 # A GTK 3 window with an entry; quits after the number of seconds given (default 20). import sys import gi gi.require_version("Gtk", "3.0") from gi.repository import Gtk, GLib win = Gtk.Window(title="a11y-race") win.add(Gtk.Entry()) win.connect("destroy", Gtk.main_quit) win.show_all() GLib.timeout_add_seconds(int(sys.argv[1]) if len(sys.argv) > 1 else 20, Gtk.main_quit) Gtk.main() client.py, an AT-SPI client that connects and then exits: #!/usr/bin/env python3 # An AT-SPI client that asks app.py (or the application named in $1) one question and # exits (status 0 if it found it). # The question makes app.py's AT-SPI bridge count this process as a client and add its # ATK key listener; when the process exits, the bridge removes that listener again. import sys import gi gi.require_version("Atspi", "2.0") from gi.repository import Atspi desktop = Atspi.get_desktop(0) name = sys.argv[1] if len(sys.argv) > 1 else "app.py" for i in range(desktop.get_child_count()): app = desktop.get_child_at_index(i) if app is not None and app.get_name() == name: app.get_child_count() sys.exit(0) sys.exit(1) repro.sh, which runs headless sway, types into the window and keeps starting AT-SPI clients: #!/bin/sh # repro.sh [RUNS] [SECONDS]: start a headless sway, then RUNS times: start app.py, # type into it with wtype while short-lived AT-SPI clients (client.py) come and go, # for at most SECONDS. Counts the runs where app.py died of SIGSEGV. # Run it inside a D-Bus session: dbus-run-session -- sh repro.sh 40 8 RUNS=${1:-20}; SECS=${2:-8} HERE=$(cd "$(dirname "$0")" && pwd) export XDG_RUNTIME_DIR=$(mktemp -d) WLR_BACKENDS=headless WLR_RENDERER=pixman WLR_LIBINPUT_NO_DEVICES=1 chmod 700 "$XDG_RUNTIME_DIR" printf 'output HEADLESS-1 resolution 1280x800\n' > "$XDG_RUNTIME_DIR/sway.cfg" sway -c "$XDG_RUNTIME_DIR/sway.cfg" >"$XDG_RUNTIME_DIR/sway.log" 2>&1 & for i in $(seq 1 50); do ls "$XDG_RUNTIME_DIR"/wayland-? >/dev/null 2>&1 && break; sleep 0.1; done export WAYLAND_DISPLAY=$(basename "$(ls "$XDG_RUNTIME_DIR"/wayland-? | head -1)") XDG_SESSION_TYPE=wayland GDK_BACKEND=wayland crashes=0 for run in $(seq 1 "$RUNS"); do python3 "$HERE/app.py" "$SECS" 2>/dev/null & app=$! sleep 1.5 ( found=0; while kill -0 $app 2>/dev/null; do python3 "$HERE/client.py" 2>/dev/null && found=$((found+1)); done; echo "$found" > "$XDG_RUNTIME_DIR/found" ) & clients=$! ( while kill -0 $app 2>/dev/null; do wtype -d 15 abcdefghijklmnopqrstuvwxyz 2>/dev/null; done ) & typer=$! wait $app; rc=$? wait $clients $typer 2>/dev/null [ $rc = 139 ] && crashes=$((crashes+1)) echo "run $run: exit $rc, AT-SPI clients that reached app.py: $(cat "$XDG_RUNTIME_DIR/found")" done echo "SIGSEGV in $crashes of $RUNS runs" 3. Run it: 40 runs of up to 8 s each. dbus-run-session -- sh repro.sh 40 8 The first app.py activates org.a11y.Bus and at-spi2-registryd on the private session bus. - Expected with 3.24.52-0ubuntu1: "run N: exit 139" lines and "SIGSEGV in 40 of 40 runs". Each run crashes after 1 to 41 client exits (median 12), which is 1 or 2 seconds. - With e6372d29: every run ends with exit 0 after 8 s, with about 80 client exits per run. To get the backtrace, run app.py under gdb in step 3 (`gdb -batch -ex run -ex bt --args python3 app.py 8`), with the client loop and the wtype loop from repro.sh running alongside. The crash is: Thread 1 "python3" received signal SIGSEGV, Segmentation fault. 0x00007f9b65c86738 in _gtk_accessibility_key_snooper (widget=0xec3820, event=0x1272290) at ../../../gtk/a11y/gtkaccessibilityutil.c:154 #0 _gtk_accessibility_key_snooper (widget=0xec3820, event=0x1272290) at ../../../gtk/a11y/gtkaccessibilityutil.c:154 #1 gtk_invoke_key_snoopers (grab_widget=0xec3820, event=0x1272290) at ../../../gtk/gtkmain.c:2451 #2 gtk_main_do_event (event=<optimized out>) at ../../../gtk/gtkmain.c:1869 #3 gtk_main_do_event (event=<optimized out>) at ../../../gtk/gtkmain.c:1694 #4 _gdk_event_emit (event=0x1272290) at ../../../gdk/gdkevents.c:73 #5 _gdk_event_emit (event=0x1272290) at ../../../gdk/gdkevents.c:67 #6 gdk_event_source_dispatch (base=<optimized out>, callback=<optimized out>, data=<optimized out>) at ../../../gdk/wayland/gdkeventsource.c:124 These are the same frames as in the upstream commit message. Sometimes the fault is at line 152 instead (`listener = l->data`), when the freed node's next pointer is non-NULL garbage. Why it crashes: before GTK handles a key, _gtk_accessibility_key_snooper walks key_listener_list and calls each listener. The listener of atk- bridge (spi_atk_bridge_key_listener, at-spi2-core atk-adaptor/event.c) sends NotifyListenersSync to the registry and waits for the reply in a nested GMainLoop (send_and_allow_reentry). The NameOwnerChanged for the client that just exited is dispatched in that loop. The bridge's spi_atk_remove_client() then sees that no clients are left and calls spi_atk_deregister_event_listeners(), which calls atk_remove_key_event_listener(). GTK frees the list node that its loop is standing on, and the loop then reads l->next from freed memory. e6372d29 takes l->next before it calls the listener. == Crash rates (reproducer above, 40 runs each, Ubuntu 26.04 container) == libgtk-3-0t64 build SIGSEGV 3.24.52-0ubuntu1 from the archive 40/40 3.24.52-0ubuntu1 source rebuilt as is (all 19 Ubuntu patches) 40/40 3.24.52-0ubuntu1 source rebuilt + e6372d29 0/40 upstream 3.24.52 tarball rebuilt 40/40 upstream 3.24.52 tarball rebuilt + e6372d29 0/40 The rebuilt libraries are plain meson builds of libgtk-3.so only (no introspection, file print backend), loaded with LD_LIBRARY_PATH. The unpatched rebuilds crash like the archive library, so the build configuration isn't what stops the crash. == Second reproducer: ilia (Regolith's launcher, GTK 3) == This is how we found it. ilia isn't in the Ubuntu archive, but it builds from https://github.com/regolith-linux/ilia with meson. - Run `ilia -a` in headless sway. With the at-spi2 tree being walked, press Alt+c then Alt+a, walk the tree again, then press Escape: 6/40 runs crash with Ubuntu's library. - Type into ilia for 6 s while short-lived AT-SPI clients come and go (client.py above with argument `ilia`): 29/40 runs crash on sway and 20/20 on X11 (Xvfb + i3). - The Rust port of ilia, the same walk-and-switch run: 9/40 with an unpatched 3.24.52 rebuild and 0/40 with e6372d29 added. Every crash has the backtrace above. ilia now works around it on its side by deferring ATK key-listener removal until gtk_main_do_event() returns (https://github.com/regolith- linux/ilia/pull/178). That workaround only covers ilia. Every other GTK 3 application still crashes until the package has the fix. == SRU template == [Impact] Any GTK 3 application can crash (SIGSEGV in _gtk_accessibility_key_snooper) if an AT-SPI client exits while the application is handling a key press. That happens when a screen reader is restarted, an accessibility tool is closed, or a pyatspi script exits. Users lose unsaved work (LibreOffice, see the description), and screen lockers built on GTK 3 can be crashed (xfce4-screensaver, Debian #1150544). The fix is upstream commit e6372d29 on gtk-3-24. It hasn't been released yet. [Test Plan] 1. On the target release, run the reproducer above: `dbus-run-session -- sh repro.sh 40 8`. With the current package it prints "SIGSEGV in 40 of 40 runs" (resolute). 2. Install the package from -proposed and run it again. Expected: "SIGSEGV in 0 of 40 runs", and every run reports that AT-SPI clients reached app.py (about 80 per run). 3. Regression check: use Orca and accerciser with gedit or another GTK 3 application. Typing is announced, and closing Orca or accerciser during typing doesn't crash the application. [Where problems could occur] The change only alters how _gtk_accessibility_key_snooper walks its listener list. It reads l->next before it calls the listener instead of after. Problems could only show in the ATK key event listener path, which is used when an accessibility bridge is loaded. One example: a listener that removes a *different*, later listener during its call would now have that listener still called once for the current key event. That is how GTK behaves upstream on gtk-3-24. [Other Info] - Upstream commit: https://gitlab.gnome.org/GNOME/gtk/-/commit/e6372d2923d04bb2bdc88fa526ca57704ca2664a - Upstream MR: https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/10391 - Debian: https://bugs.debian.org/1150544 - The patch, ready for debian/patches (it applies after the existing series of 3.24.52-0ubuntu1): From: Gaƫl Bonithon <[email protected]> Date: Sat, 19 Sep 2026 08:00:39 +0200 Subject: a11y: Browse key listener list safely It appears that there are cases where the current element of the list is freed when listener->func is called, thereby invalidating l->next; therefore, this list should be iterated with greater caution. Origin: upstream, https://gitlab.gnome.org/GNOME/gtk/-/commit/e6372d2923d04bb2bdc88fa526ca57704ca2664a Bug: https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/10391 Bug-Ubuntu: https://bugs.launchpad.net/bugs/2169718 Bug-Debian: https://bugs.debian.org/1150544 Applied-Upstream: gtk-3-24 branch, after 3.24.52 --- gtk/a11y/gtkaccessibilityutil.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gtk/a11y/gtkaccessibilityutil.c b/gtk/a11y/gtkaccessibilityutil.c index b6f909f2941..eddb5576aa8 100644 --- a/gtk/a11y/gtkaccessibilityutil.c +++ b/gtk/a11y/gtkaccessibilityutil.c @@ -147,9 +147,11 @@ _gtk_accessibility_key_snooper (GtkWidget *widget, atk_key_event_from_gdk_event_key (event, &atk_event); - for (l = key_listener_list; l; l = l->next) + l = key_listener_list; + while (l != NULL) { KeyEventListener *listener = l->data; + l = l->next; result |= listener->func (&atk_event, listener->data); } (end of patch: the upstream commit, unchanged; it applies cleanly after the existing patch series of 3.24.52-0ubuntu1) The patch above is the whole upstream change (one hunk, 3 lines added and 1 removed); nothing else is needed. I'm happy to test a build from a PPA or -proposed on resolute with the reproducer above and report back here. Thanks, ** Bug watch added: Debian Bug tracker #1150544 https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1150544 -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/2169718 Title: Segfault in _gtk_accessibility_key_snooper when the last AT-SPI client exits during a key press (noble, 3.24.41-4ubuntu1.3) To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/gtk+3.0/+bug/2169718/+subscriptions -- ubuntu-bugs mailing list [email protected] https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
