Skip to content

(release/25.1) glx: free old context tag before allocating new one in CommonMakeCurrent#3306

Open
metux wants to merge 1 commit into
release/25.1from
pr/release/25.1-glx-free-old-context-tag-before-allocating-new-one-in-commonmakecurrent-_2026-07-10_15-37-54
Open

(release/25.1) glx: free old context tag before allocating new one in CommonMakeCurrent#3306
metux wants to merge 1 commit into
release/25.1from
pr/release/25.1-glx-free-old-context-tag-before-allocating-new-one-in-commonmakecurrent-_2026-07-10_15-37-54

Conversation

@metux

@metux metux commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

oldTag in CommonMakeCurrent() is a pointer to cl->contextTags[...].
CommonMakeCurrent() may realloc(cl->contextTags) and thus move the
memory, leaving oldTag as dangling pointer.

If we then GlxFreeContextTag(oldTag) we end up writing into freed
memory.

Fix this by freeing oldTag before CommonMakeNewCurrent().

This vulnerability was discovered by:
Anonymous working with Trend Micro Zero Day Initiative

CVE-2026-56000/ZDI-CAN-30561

Fixes: 4781f2a ("GLX: Free the tag of the old context later")
Assisted-by: Claude:claude-opus-4-6
Part-of: https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2250
(cherry picked from commit 2779affbdb4354e894f490e56f962527d6125043)

@metux metux self-assigned this Jul 10, 2026
@metux
metux requested a review from a team July 10, 2026 13:38
oldTag in CommonMakeCurrent() is a pointer to cl->contextTags[...].
CommonMakeCurrent() may realloc(cl->contextTags) and thus move the
memory, leaving oldTag as dangling pointer.

If we then GlxFreeContextTag(oldTag) we end up writing into freed
memory.

Fix this by freeing oldTag before CommonMakeNewCurrent().

This vulnerability was discovered by:
Anonymous working with Trend Micro Zero Day Initiative

CVE-2026-56000/ZDI-CAN-30561

Fixes: 4781f2a ("GLX: Free the tag of the old context later")
Assisted-by: Claude:claude-opus-4-6
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2250>
(cherry picked from commit 2779affbdb4354e894f490e56f962527d6125043)
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
@metux
metux force-pushed the pr/release/25.1-glx-free-old-context-tag-before-allocating-new-one-in-commonmakecurrent-_2026-07-10_15-37-54 branch from 161ba16 to 006d4f2 Compare July 10, 2026 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant