Bug 182490

Summary: [GTK] WaylandCompositor misusing eglGetProcAddress
Product: WebKit Reporter: Daniel Stone <daniel>
Component: WebKitGTKAssignee: Miguel Gomez <magomez>
Status: RESOLVED FIXED    
Severity: Normal CC: berto, bugs-noreply, commit-queue, fcrozat, magomez, mcatanzaro
Priority: P3 Keywords: Gtk
Version: WebKit Nightly Build   
Hardware: PC   
OS: Linux   
See Also: https://bugs.freedesktop.org/show_bug.cgi?id=104949
https://bugzilla.redhat.com/show_bug.cgi?id=1518674
https://bugzilla.redhat.com/show_bug.cgi?id=1553894
Attachments:
Description Flags
Patch none

Description Daniel Stone 2018-02-05 09:33:39 PST
In WaylandCompositor.cpp's initializeEGL(), eglBindWaylandDisplayWL() is called if eglGetProcAddress() returns any value for it. This causes a crash on newer Mesa when using software rendering: swrast drivers do not provide BindWaylandDisplay (as they rely on wl_shm instead of Mesa extensions), and newer Mesa asserts that the extension is enabled when the entrypoint is called.

The trivial fix would be to check for the extension's presence and fail initializeEGL() if they are not there.

The Mesa bug is here: https://bugs.freedesktop.org/show_bug.cgi?id=104949
Comment 1 Michael Catanzaro 2018-02-05 10:27:40 PST
Mesa devs say "[WebKit] seems to be doing the most common and silly mistakes - uses the function pointers w/o checking for the extension string" in the upstream bug. We need to make sure we get this right everywhere, not just WaylandCompositor.cpp.
Comment 2 Miguel Gomez 2018-02-07 08:09:21 PST
Created attachment 333283 [details]
Patch
Comment 3 Miguel Gomez 2018-02-07 08:11:35 PST
(In reply to Michael Catanzaro from comment #1)
> Mesa devs say "[WebKit] seems to be doing the most common and silly mistakes
> - uses the function pointers w/o checking for the extension string" in the
> upstream bug. We need to make sure we get this right everywhere, not just
> WaylandCompositor.cpp.

I've fixed WaylandCompositor.cpp. The rest of the places calling eglGetProcAddress seem to be properly checking for the required extensions.
Comment 4 Michael Catanzaro 2018-02-07 08:35:36 PST
Comment on attachment 333283 [details]
Patch

Thanks
Comment 5 Daniel Stone 2018-02-07 08:41:48 PST
Don't think my r+ etc counts here, but LGTM anyway!
Comment 6 WebKit Commit Bot 2018-02-08 06:05:17 PST
Comment on attachment 333283 [details]
Patch

Clearing flags on attachment: 333283

Committed r228272: <https://trac.webkit.org/changeset/228272>
Comment 7 WebKit Commit Bot 2018-02-08 06:05:18 PST
All reviewed patches have been landed.  Closing bug.
Comment 8 Michael Catanzaro 2018-03-02 08:26:10 PST
*** Bug 183289 has been marked as a duplicate of this bug. ***