fix: NULL deref in meta_x11_display_logical_monitor_to_xinerama_index#815
Closed
appositeit wants to merge 1 commit intolinuxmint:masterfrom
Closed
fix: NULL deref in meta_x11_display_logical_monitor_to_xinerama_index#815appositeit wants to merge 1 commit intolinuxmint:masterfrom
appositeit wants to merge 1 commit intolinuxmint:masterfrom
Conversation
Add a NULL check for logical_monitor_data before dereferencing it. When Xinerama screen geometry doesn't exactly match any logical monitor's rect (common with NVIDIA multi-monitor setups after sleep/wake or monitor power cycles), ensure_xinerama_indices() never attaches qdata to that monitor. The subsequent call to get_x11_display_logical_monitor_data() then returns NULL, and dereferencing it causes a segfault at offset +94 in meta_display_logical_index_to_xinerama_index. This crash is reproducible on NVIDIA GPUs with 2+ monitors and triggers when monitors power off/on or wake from sleep. It causes Cinnamon to enter fallback mode and often requires a GDM restart to recover. The sibling function meta_x11_display_xinerama_index_to_logical_monitor already handles the NULL case correctly (returns NULL when no match). Fixes: linuxmint#671 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a NULL check for
logical_monitor_datainmeta_x11_display_logical_monitor_to_xinerama_index()to prevent a segfault that crashes Cinnamon on NVIDIA multi-monitor setups.Root Cause
meta_x11_display_ensure_xinerama_indices()only attaches xinerama qdata to logical monitors whose geometry exactly matches a Xinerama screen entry (comparingrect.x/y/width/height). With NVIDIA drivers and multiple monitors, after sleep/wake or monitor power cycles, the Xinerama geometry can become stale or mismatched. When a logical monitor has no matching Xinerama entry,get_x11_display_logical_monitor_data()returns NULL and the subsequent dereferencelogical_monitor_data->xinerama_indexsegfaults.The sibling function
meta_x11_display_xinerama_index_to_logical_monitoralready handles the NULL case correctly.Crash Signature
meta_display_logical_index_to_xinerama_index+94rax=0x0(NULL fromg_object_get_qdata)meta_display_logical_index_to_xinerama_index→meta_x11_display_logical_monitor_to_xinerama_indexEnvironment
cinnamon --replaceafter X session corruption from prior crashTesting
libmuffin.so.0.0.0from source (meson release build)test %rax,%rax; je→return -1pathFixes #671
🤖 Generated with Claude Code