[Mesa-dev] [PATCH] Fix locking of GLsync objects

Steinar H. Gunderson sgunderson at bigfoot.com
Wed Dec 9 02:42:59 PST 2015


On Wed, Dec 09, 2015 at 10:35:25AM +0000, Emil Velikov wrote:
>> I was told that it's easier for people to review my patch if it comes in via
>> email than being stuck in the bug tracker; FWIW, this is for bug 120238.
> Which bugtracker it this ? bugs.fd.o does not like the number
> mentioned. Please add the full URL to the commit message with a
> Bugzilla: tag.

I mixed up some bug numbers, sorry.

https://bugs.freedesktop.org/show_bug.cgi?id=92757

>> GLsync objects had a race condition when used from multiple threads
>> (which is the main point of the extension, really); it could be
>> validated as a sync object at the beginning of the function, and then
>> deleted by another thread before use, causing crashes. Fix this by
>> changing all casts from GLsync to struct gl_sync_object to a new
>> function _mesa_get_sync() that validates and increases the refcount.
> Might be worth keeping _mesa_ref_sync_object(), even if it's an inline
> wrapper around the above. As things get a bit confusing - foo_get vs
> foo_unref.

What about _mesa_get_and_ref_sync()?

> Alternatively one could even throw the locking (+extra checks) into
> the validate, use it in _mesa_IsSync(), while using the ref/unref
> combo elsewhere and drop the "amount" argument from unref.

I agree the amount argument is a bit icky. :-)

> Please mention if this commit fixes a certain game/program.

The motivating program is unreleased for now, but it will be released
(under GPLv3) in February.

> Can you also add the following tag. This way it'll be harder to miss
> the patch when picking things for the stable branch(es).
> 
> Cc: "11.0 11.1" <mesa-stable at lists.freedesktop.org>

Sure. (I'll send an updated patch when we have agreement on the issues
above.)

/* Steinar */
-- 
Homepage: https://www.sesse.net/


More information about the mesa-dev mailing list