On Tue, Aug 25, 2009 at 11:04:25AM +0100, Dave Airlie wrote:
> > Old libGL.so won't load the DRI drivers compiled with this commit.  This
> > is known, but I must admit that I forgot xserver counts as an old
> > libGL.so...
> > 
> > I just had a quick look at it, and I think this can be fixed by defining
> > _glapi_SingleThreaded in xserver glx module and recompile.  No other
> > changes are needed.  But I am wondering whether it should be fixed, or
> > the commit should be reverted.  Any suggestion?
> Can it be done any other way without breaking the loader API?
> A lot of work has been put into making the loader API not need breaks
> and not having to keep mesa and xserver in lockstep and I'd hate to throw
> this away if there is another way.
Maybe I can show the exact problem the commit tries to solve, to see if
someone can come up with a better way?

The race the commit tries to solve is in

#define GET_CURRENT_CONTEXT(C) \
  GLcontext *C = (GLcontext *) (_glapi_Context ? _glapi_Context : 
_glapi_get_context())

(and, similarly, GET_DISPATCH)

Say, a first thread is about to enter GET_CURRENT_CONTEXT(), and a
second thread is created and calls _glapi_check_multithread.  Before the
introduction of _glapi_SingleThreaded, the second thread would unset
_glapi_Context as an indication that per-thread context should be used.
The first thread would then call _glapi_get_context() to get per-thread
context.

The race happens after the first thread tests _glapi_Context to be
non-NULL and before it returns _glapi_Context.  A second thread might
unset _glapi_Context during this period and the first thread would get
NULL.  It will crash the application

-- 
Regards,
olv

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Mesa3d-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to