Public bug reported:

[ Impact ]

gnome-shell crashes with SIGSEGV when a DisplayPort MST connector
disappears and is re-created under a new id (dock re-plug, monitor link
drop, resume). The whole Wayland session and every client is lost.

mutter keeps two lists of KMS connectors: one owned by the KMS impl
thread (MetaKmsImplDevice) and a copy for the main thread
(MetaKmsDevice). In 50.1, update_connector_in_impl()
(src/backends/native/meta-kms-connector.c), run when a connector's
disconnect timeout fires, calls meta_kms_impl_device_update_states()
directly. When that replaces the impl list it unrefs the removed
connector but the main-thread copy is not refreshed, so it keeps a
pointer to a freed MetaKmsConnector. The next user of the list
dereferences it; here the DRM lease manager on monitors-changed.

Upstream fixed this in a one-line change:
- main: 
https://gitlab.gnome.org/GNOME/mutter/-/commit/de07dcb15332e0cbca1cf99d14809ad1f7b6b9ce
- gnome-50: https://gitlab.gnome.org/GNOME/mutter/-/commit/c60f9131 (released 
in 50.2, 2026-05-29)
- "kms/connector: Update KMS resource lists in update_connector_in_impl ... 
Fixes use after free if meta_kms_impl_device_update_states removes a resource 
(most likely a connector)."
- Closes https://gitlab.gnome.org/GNOME/mutter/-/work_items/4796, MR 
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/5061

Resolute is on 50.1-0ubuntu2.5 (2.6 in -proposed) and neither carries
the patch. It applies cleanly to 50.1.

[ Test Plan ]

Hardware: laptop with a Thunderbolt/USB-C MST dock and an external monitor 
(seen on Intel xe, Dell Thunderbolt 4 dock, monitor on the dock's HDMI output).
1. Log in to a Wayland session with the external monitor active.
2. Make the MST connector go away and come back under a new connector name 
(power-cycle or re-plug the monitor at the dock several times; the connector id 
changes, e.g. DP-9 -> DP-10).
3. Within a few seconds apply any monitor configuration (Settings > Displays > 
Apply, or `gdctl set ...`).
Before the fix: gnome-shell can segfault with the stack below. After: no crash.
The window is timing dependent; one crash in roughly 25 link drops here.

[ Where problems could occur ]

The change swaps one call for its existing wrapper,
meta_kms_device_update_states_in_impl(), which is already used on the
normal hotplug path; the only added work is re-copying the
crtc/connector/plane lists when something changed. A regression would
show up in connector hotplug handling in the native backend (monitors
not appearing or disappearing after dock/monitor hotplug). It has
shipped upstream since 50.2 and in 51.

[ Other Info ]

Crash seen 2026-11-14 with mutter 50.1-0ubuntu2.5, gnome-shell
50.1-0ubuntu1.5, kernel 7.0.0-42-generic, xe.

Journal just before:
    kernel: xe 0000:00:02.0: [drm] *ERROR* Failed to get ACT after 3000 ms, 
last status: 04   (x3)
    gnome-shell: Page flip failed: drmModeAtomicCommit: Invalid argument
    gnome-shell: g_object_set_qdata: assertion 'G_IS_OBJECT (object)' failed

Stack (debuginfod symbols):
    #0  meta_kms_connector_is_non_desktop (connector=0x7dd47c0535f0) at 
../src/backends/native/meta-kms-connector.c:203
    #2  is_connector_for_lease (connector=0x7dd47c0535f0) at 
../src/backends/native/meta-drm-lease.c:209
    #3  update_connectors (lease_manager=0x5b06141e0400) at 
../src/backends/native/meta-drm-lease.c:688
    #4  update_resources (lease_manager=0x5b06141e0400) at 
../src/backends/native/meta-drm-lease.c:744
    #10 meta_monitor_manager_notify_monitors_changed at 
../src/backends/meta-monitor-manager.c:1306
    #11 meta_monitor_manager_rebuild at 
../src/backends/meta-monitor-manager.c:4134
    #13 meta_monitor_manager_native_apply_monitors_config 
(method=META_MONITORS_CONFIG_METHOD_TEMPORARY) at 
../src/backends/native/meta-monitor-manager-native.c:304
    #15 meta_monitor_manager_handle_apply_monitors_config at 
../src/backends/meta-monitor-manager.c:3064

In the core, the MetaKmsDevice.connectors list of /dev/dri/card1 has 11
entries; 10 have ref_count 1 and the one passed to frame #0 has
ref_count 0 and overwritten fields (freed).

** Affects: mutter (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Desktop Bugs, which is subscribed to mutter in Ubuntu.
https://bugs.launchpad.net/bugs/2174551

Title:
  gnome-shell SIGSEGV in meta_kms_connector_is_non_desktop() after MST
  connector re-enumeration: please cherry-pick upstream c60f9131 (use-
  after-free, fixed in 50.2)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/mutter/+bug/2174551/+subscriptions


-- 
desktop-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/desktop-bugs

Reply via email to