<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>217323</bug_id>
          
          <creation_ts>2020-10-05 11:06:17 -0700</creation_ts>
          <short_desc>[GTK][X11] WebProcess crash in WebCore::GLContextGLX::createPbufferContext() with NVidia proprietary drivers</short_desc>
          <delta_ts>2020-12-02 14:14:42 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebKitGTK</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=199666</see_also>
    
    <see_also>https://bugs.webkit.org/show_bug.cgi?id=219456</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Enrique Ocaña">eocanha</reporter>
          <assigned_to name="Enrique Ocaña">eocanha</assigned_to>
          <cc>aperez</cc>
    
    <cc>bugs-noreply</cc>
    
    <cc>eocanha</cc>
    
    <cc>magomez</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1694761</commentid>
    <comment_count>0</comment_count>
    <who name="Enrique Ocaña">eocanha</who>
    <bug_when>2020-10-05 11:06:17 -0700</bug_when>
    <thetext>I&apos;m getting this crash on trunk@267957 when using NVidia binary drivers:

#0  WebCore::GLContextGLX::createPbufferContext(WebCore::PlatformDisplay&amp;, __GLXcontextRec*) (platformDisplay=..., sharingContext=0x0)
    at ../../Source/WebCore/platform/graphics/glx/GLContextGLX.cpp:232
#1  0x00007f85bdd7541d in WebCore::GLContextGLX::createSharingContext(WebCore::PlatformDisplay&amp;) (platformDisplay=...)
    at ../../Source/WebCore/platform/graphics/glx/GLContextGLX.cpp:295
#2  0x00007f85bdd1e5cf in WebCore::GLContext::createSharingContext(WebCore::PlatformDisplay&amp;) (display=...)
    at ../../Source/WebCore/platform/graphics/GLContext.cpp:115
#3  0x00007f85bdd1fc73 in WebCore::PlatformDisplay::sharingGLContext() (this=0x7f85a1dd0000)
    at ../../Source/WebCore/platform/graphics/PlatformDisplay.cpp:179
#4  0x00007f85bdd752df in WebCore::GLContextGLX::createContext(unsigned long, WebCore::PlatformDisplay&amp;)
    (window=192937988, platformDisplay=...) at ../../Source/WebCore/platform/graphics/glx/GLContextGLX.cpp:283
#5  0x00007f85bdd1e415 in WebCore::GLContext::createContextForWindow(unsigned long, WebCore::PlatformDisplay*)
    (windowHandle=192937988, platformDisplay=0x7f85a1dd0000) at ../../Source/WebCore/platform/graphics/GLContext.cpp:89
#6  0x00007f85bab4e220 in WebKit::ThreadedCompositor::createGLContext() (this=0x7f853a4f1780)
    at ../../Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:87
#7  0x00007f85bab4dec9 in operator()() const (__closure=0x7f853a4e04b8)
    at ../../Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:73
#8  0x00007f85bab53e36 in WTF::Detail::CallableWrapper&lt;WebKit::ThreadedCompositor::ThreadedCompositor(WebKit::ThreadedCompositor::Client&amp;, WebKit::ThreadedDisplayRefreshMonitor::Client&amp;, WebCore::PlatformDisplayID, const WebCore::IntSize&amp;, float, WebCore::TextureMapper::PaintFlags)::&lt;lambda()&gt;, void&gt;::call(void) (this=0x7f853a4e04b0) at DerivedSources/ForwardingHeaders/wtf/Function.h:52
#9  0x00007f85ba034adb in WTF::Function&lt;void ()&gt;::operator()() const (this=0x7f853a4e04d8)
    at DerivedSources/ForwardingHeaders/wtf/Function.h:83
#10 0x00007f85bab4d7c3 in operator()() const (__closure=0x7f853a4e04d0)
    at ../../Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp:90
#11 0x00007f85bab53e56 in WTF::Detail::CallableWrapper&lt;WebKit::CompositingRunLoop::performTaskSync(WTF::Function&lt;void()&gt;&amp;&amp;)::&lt;lambda()&gt;, void&gt;::call(void) (this=0x7f853a4e04c8) at DerivedSources/ForwardingHeaders/wtf/Function.h:52
#12 0x00007f85ba034adb in WTF::Function&lt;void ()&gt;::operator()() const (this=0x7f853a3fe940)
    at DerivedSources/ForwardingHeaders/wtf/Function.h:83
#13 0x00007f85abb12e7f in WTF::RunLoop::performWork() (this=0x7f853a4d8000) at ../../Source/WTF/wtf/RunLoop.cpp:123
#14 0x00007f85abb9c7ea in operator()(gpointer) const (__closure=0x0, userData=0x7f853a4d8000)
    at ../../Source/WTF/wtf/glib/RunLoopGLib.cpp:80
#15 0x00007f85abb9c80e in _FUN(gpointer) () at ../../Source/WTF/wtf/glib/RunLoopGLib.cpp:82
#16 0x00007f85abb9c77d in operator()(GSource*, GSourceFunc, gpointer) const
    (__closure=0x0, source=0x7f8540005c10, callback=0x7f85abb9c7f1 &lt;_FUN(gpointer)&gt;, userData=0x7f853a4d8000)
    at ../../Source/WTF/wtf/glib/RunLoopGLib.cpp:53
#17 0x00007f85abb9c7cb in _FUN(GSource*, GSourceFunc, gpointer) () at ../../Source/WTF/wtf/glib/RunLoopGLib.cpp:56
#18 0x00007f85a4c1304f in g_main_dispatch (context=0x7f854000b2a0) at ../glib/gmain.c:3325
#19 g_main_context_dispatch (context=0x7f854000b2a0) at ../glib/gmain.c:4016
#20 0x00007f85a4c133f8 in g_main_context_iterate
    (context=0x7f854000b2a0, block=block@entry=1, dispatch=dispatch@entry=1, self=&lt;optimized out&gt;) at ../glib/gmain.c:4092
#21 0x00007f85a4c13713 in g_main_loop_run (loop=0x7f8540008800) at ../glib/gmain.c:4290
#22 0x00007f85abb9cd94 in WTF::RunLoop::run() () at ../../Source/WTF/wtf/glib/RunLoopGLib.cpp:108
#23 0x00007f85bab4d3dd in operator()() const (__closure=0x7f853a4e04a0)
    at ../../Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp:49
#24 0x00007f85bab53eb6 in WTF::Detail::CallableWrapper&lt;WebKit::createRunLoop()::&lt;lambda()&gt;, void&gt;::call(void) (this=0x7f853a4e0498)
    at DerivedSources/ForwardingHeaders/wtf/Function.h:52
--Type &lt;RET&gt; for more, q to quit, c to continue without paging--
#25 0x00007f85ba034adb in WTF::Function&lt;void ()&gt;::operator()() const (this=0x7f853a3fec30)
    at DerivedSources/ForwardingHeaders/wtf/Function.h:83
#26 0x00007f85abb18aa3 in WTF::Thread::entryPoint(WTF::Thread::NewThreadContext*) (newThreadContext=0x7f853a4e4410)
    at ../../Source/WTF/wtf/Threading.cpp:179
#27 0x00007f85abba7f7b in WTF::wtfThreadEntryPoint(void*) (context=0x7f853a4e4410) at ../../Source/WTF/wtf/posix/ThreadingPOSIX.cpp:213
#28 0x00007f85a5d074d2 in start_thread (arg=&lt;optimized out&gt;) at pthread_create.c:477
#29 0x00007f85a387d4d3 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

The crash wasn&apos;t present on trunk@266718.

After debugging it with rr, I realized that the call to glXChooseFBConfig() returns early in my specific case, leaving returnedElements untouched and uninitialized[1], usually with a value different from zero. This causes the wrong branch to be taken and triggers the crash, as the configs variable is holding a null pointer.

This problem might be related or be a subset of the issue reported in https://bugs.webkit.org/show_bug.cgi?id=199666#c2

[1] https://github.com/WebKit/webkit/blob/9fb817f9a912a7860499f63fd9661f399511c3fe/Source/WebCore/platform/graphics/glx/GLContextGLX.cpp#L224</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1694774</commentid>
    <comment_count>1</comment_count>
      <attachid>410535</attachid>
    <who name="Enrique Ocaña">eocanha</who>
    <bug_when>2020-10-05 11:36:25 -0700</bug_when>
    <thetext>Created attachment 410535
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1694786</commentid>
    <comment_count>2</comment_count>
    <who name="Adrian Perez">aperez</who>
    <bug_when>2020-10-05 12:12:35 -0700</bug_when>
    <thetext>Good catch, by the way!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1694839</commentid>
    <comment_count>3</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2020-10-05 13:55:58 -0700</bug_when>
    <thetext>Committed r268000: &lt;https://trac.webkit.org/changeset/268000&gt;

All reviewed patches have been landed. Closing bug and clearing flags on attachment 410535.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>410535</attachid>
            <date>2020-10-05 11:36:25 -0700</date>
            <delta_ts>2020-10-05 13:55:59 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-217323-20201005203624.patch</filename>
            <type>text/plain</type>
            <size>1717</size>
            <attacher name="Enrique Ocaña">eocanha</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMjY3OTU3CmRpZmYgLS1naXQgYS9Tb3VyY2UvV2ViQ29yZS9D
aGFuZ2VMb2cgYi9Tb3VyY2UvV2ViQ29yZS9DaGFuZ2VMb2cKaW5kZXggNjEzODZjNmQ5OGI3ZWE4
OTgzYmVhNTM5NzM2ZTk1YTBmYzA5ZWM1OS4uOTk0MWJmZjMwNTgwMmVhMjk2YjhmYjQ4Y2QzN2Fl
ZjgwZDEwNjQ2MCAxMDA2NDQKLS0tIGEvU291cmNlL1dlYkNvcmUvQ2hhbmdlTG9nCisrKyBiL1Nv
dXJjZS9XZWJDb3JlL0NoYW5nZUxvZwpAQCAtMSwzICsxLDE2IEBACisyMDIwLTEwLTA1ICBFbnJp
cXVlIE9jYcOxYSBHb256w6FsZXogIDxlb2NhbmhhQGlnYWxp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