Bug 68380 - flink race on wayland
Summary: flink race on wayland
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: EGL (show other bugs)
Version: git
Hardware: Other All
: medium normal
Assignee: mesa-dev
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-08-21 11:38 UTC by Stanislav Vorobiov
Modified: 2017-04-04 18:59 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Stanislav Vorobiov 2013-08-21 11:38:39 UTC
1. We render stuff using OpenGL
2. eglSwapBuffers - This will call wl_surface_attach, i.e. send the buffer to server
3. Window resize happens
4. Mesa code does GEM close on all buffers
5. Server receives the buffer and tries to open it by name, but by that moment the buffer is no more and open fails

Workaround:
1. Do not always close GEM on window resize, close it only if buffer is not locked
2. In platform_wayland.c:wl_buffer_release if buffer's dimensions don't match widow's dimensions then the buffer and the GEM must be destroyed
Comment 1 Pekka Paalanen 2017-04-04 06:58:34 UTC
I would assume this is no longer a problem after we started using file descriptors instead of flink names in wl_drm?

Is it even worth fixing the flink path, considering it's insecure to begin with?
Comment 2 Daniel Stone 2017-04-04 10:53:43 UTC
Yes, really everything should be using dmabuf/create_prime_buffer, which is immune to this race. We could fix this for older flink systems, but on the other hand, they probably wouldn't even get the update, as they're running ancient Mesa anyway.

The fix you have proposed seems correct to me, but again I'd be looking more towards just deleting flink.

What system/version are you running on, that you are using create_buffer rather than create_prime_buffer?
Comment 3 Stanislav Vorobiov 2017-04-04 18:48:13 UTC
I guess this is no longer an issue since it was reported years ago. Frankly speaking, I don't even remember in what scenario and under which circumstances did I face this...
Comment 4 Daniel Stone 2017-04-04 18:59:24 UTC
Oh wow, so it was. :\ Thanks for the report anyway.


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.