(release/25.1) rootless: fix dangling screen pixmap on RootlessUpdateScreenPixmap() OOM - #3508
Open
metux wants to merge 1 commit into
Conversation
On a calloc() failure while growing the rootless screen pixmap buffer, the old buffer was already freed and pixmap_data_size already bumped to the new (larger) size before the failure check -- leaving s->pixmap_data (and the screen pixmap pPix, still pointing at the freed block via its prior ModifyPixmapHeader() call) dangling. Worse, because pixmap_data_size was already bumped, a later same-or-smaller-size call sees pixmap_data_size < rowbytes as false and skips reallocating forever, permanently pinning the dangling state instead of retrying. Trigger: real host memory pressure during a rootless (Xquartz-style DDX) geometry change. Fix: allocate the replacement into a temporary first; only free the old buffer and update pixmap_data_size/pixmap_data together once the new allocation has succeeded. Found via a fleet-directed alloc-fail/UAF sweep of Xext/, mi/, and miext/, not from a live crash report. Verification note: miext/rootless/ only compiles into hw/xquartz, which this Linux build has disabled -- checked with a standalone `gcc -fsyntax-only` pass instead of the normal ninja+meson-test build/test cycle used for the other fixes in this sweep. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net> (cherry picked from commit d536dde)
This was referenced Aug 7, 2026
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.
On a calloc() failure while growing the rootless screen pixmap buffer, the
old buffer was already freed and pixmap_data_size already bumped to the new
(larger) size before the failure check -- leaving s->pixmap_data (and the
screen pixmap pPix, still pointing at the freed block via its prior
ModifyPixmapHeader() call) dangling. Worse, because pixmap_data_size was
already bumped, a later same-or-smaller-size call sees pixmap_data_size <
rowbytes as false and skips reallocating forever, permanently pinning the
dangling state instead of retrying.
Trigger: real host memory pressure during a rootless (Xquartz-style DDX)
geometry change.
Fix: allocate the replacement into a temporary first; only free the old
buffer and update pixmap_data_size/pixmap_data together once the new
allocation has succeeded.
Found via a fleet-directed alloc-fail/UAF sweep of Xext/, mi/, and miext/,
not from a live crash report. Verification note: miext/rootless/ only
compiles into hw/xquartz, which this Linux build has disabled -- checked
with a standalone
gcc -fsyntax-onlypass instead of the normalninja+meson-test build/test cycle used for the other fixes in this sweep.
Signed-off-by: Enrico Weigelt, metux IT consult info@metux.net
(cherry picked from commit d536dde)
Backport of master PR #3277 (rootless: fix dangling screen pixmap on RootlessUpdateScreenPixmap() OOM).
Backport series of master PR #3277 — same fix on every maintained release line:
This is the 25.1 copy (base
release/25.1). The others are linked above.