Bug 86531 - The server crashes if the client sends X_GLXMakeCurrent for a direct context
Summary: The server crashes if the client sends X_GLXMakeCurrent for a direct context
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: Server/Ext/GLX (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Xorg Project Team
QA Contact: Xorg Project Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-11-21 17:32 UTC by Neil Roberts
Modified: 2014-12-10 15:17 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
Example to demonstrate the problem (4.22 KB, text/plain)
2014-11-21 17:33 UTC, Neil Roberts
no flags Details
glx: Add implementation of __GLXContext->loseCurrent for direct ctxts (1.39 KB, patch)
2014-11-21 17:35 UTC, Neil Roberts
no flags Details | Splinter Review

Description Neil Roberts 2014-11-21 17:32:38 UTC
When the client creates a direct context the server internally creates a __GLXcontext which has function pointers for various operations on the context. However it only fills in the destroy member so if one of the other functions gets called the server will crash. This happens if the application sends X_GLXMakeCurrent because it will try to call loseCurrent when the context becomes no longer current. There may also be ways of triggering the other function pointers.

This was discovered in the discussion for bug 54080.
Comment 1 Neil Roberts 2014-11-21 17:33:46 UTC
Created attachment 109809 [details]
Example to demonstrate the problem
Comment 2 Neil Roberts 2014-11-21 17:35:27 UTC
Created attachment 109810 [details] [review]
glx: Add implementation of __GLXContext->loseCurrent for direct ctxts

This adds a dummy implementation for the loseCurrent function in
__GLXContext for direct contexts which just returns GL_TRUE. Without
this then the X server can crash if receives a MakeCurrent message for
a direct context because it will attempt to call loseCurrent when
cleaning up the client in the callback for ClientStateGone.
Comment 3 Adam Jackson 2014-12-01 21:11:13 UTC
lgtm, forwarded to the devel list
Comment 4 Adam Jackson 2014-12-10 15:17:10 UTC
commit c1455f76c6b1aa4ecaacb2221a687244285aa44b
Author: Neil Roberts <neil@linux.intel.com>
Date:   Mon Dec 1 16:06:17 2014 -0500

    glx: Add implementation of __GLXContext->loseCurrent for direct ctxts


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.