Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-49027

[REG 5.4->5.5] OS X: Segfault in WebCore::SocketStreamHandle::platformClose() when using secure websockets

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • None
    • 5.5.1
    • WebKit
    • None
    • OS X
    • macOS
    • 2caa61dc485dc7d38c847ed6c6cff774fcf80061, 06b0ebd66fb1a7c536c96572ad8a3b55b713b177

    Description

      This is a regression from some earlier Qt version - probably 5.4, but I still need to check.

      When logging in on GitHub on OS X, a segfault happens in WebCore::SocketStreamHandle::platformClose():

      Crashed Thread:        0  Dispatch queue: com.apple.main-thread
      
      Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
      Exception Codes:       KERN_INVALID_ADDRESS at 0x0000000000000008
      
      VM Regions Near 0x8:
      -->
          __TEXT                 00000001014da000-00000001014dc000 [    8K]
      r-x/rwx SM=COW
       /usr/local/Cellar/python3/3.5.0/Frameworks/Python.framework/Versions/3.5/Resources/Python.app/Contents/MacOS/Python
      
      Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
      0   libsystem_kernel.dylib         0x00007fff8d60cc82 __kill + 10
      1   ???                           000000000000000000 0 + 0
      2   org.qt-project.QtWebKit       0x0000000105819ef4
      WebCore::SocketStreamHandle::platformClose() + 84
      3   org.qt-project.QtWebKit       0x000000010581878a
      WebCore::SocketStreamHandleBase::disconnect() + 26
      4   org.qt-project.QtWebKit       0x0000000105809f86
      WebCore::WebSocketChannel::fail(WTF::String const&) + 710
      5   org.qt-project.QtWebKit       0x0000000105807365
      WebCore::WebSocket::close(int, WTF::String const&, int&) + 325
      6   org.qt-project.QtWebKit       0x00000001058c941d
      WebCore::jsWebSocketPrototypeFunctionClose(JSC::ExecState*) + 205
      7   ???                           0x000043c0f6001045 0 + 74496039981125
      8   org.qt-project.QtWebKit       0x0000000106447932
      JSC::Interpreter::executeCall(JSC::ExecState*, JSC::JSObject*,
      JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) +
      1218
      9   org.qt-project.QtWebKit       0x00000001065536f5
      JSC::call(JSC::ExecState*, JSC::JSValue, JSC::CallType, JSC::CallData
      const&, JSC::JSValue, JSC::ArgList const&) + 69
      10  org.qt-project.QtWebKit       0x0000000106243cb0
      WebCore::JSMainThreadExecState::call(JSC::ExecState*, JSC::JSValue,
      JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) +
      160
      11  org.qt-project.QtWebKit       0x0000000106236590
      WebCore::ScheduledAction::executeFunctionInContext(JSC::JSGlobalObject*,
      JSC::JSValue, WebCore::ScriptExecutionContext*) + 448
      12  org.qt-project.QtWebKit       0x00000001062361df
      WebCore::ScheduledAction::execute(WebCore::Document*) + 223
      13  org.qt-project.QtWebKit       0x00000001055786ee
      WebCore::DOMTimer::fired() + 270
      14  org.qt-project.QtWebKit       0x000000010567282f
      WebCore::ThreadTimers::sharedTimerFiredInternal() + 175
      15  org.qt-project.QtCore         0x0000000102b22210
      QObject::event(QEvent*) + 48
      16  org.qt-project.QtWidgets       0x0000000103ba096b
      QApplicationPrivate::notify_helper(QObject*, QEvent*) + 251
      17  org.qt-project.QtWidgets       0x0000000103ba32ce
      QApplication::notify(QObject*, QEvent*) + 5630
      

      I'll attach a full crash report with my project, but I can reproduce this with any QtWebKit application.

      I tried to fix this for 5.5.1 in https://codereview.qt-project.org/#/c/122677/ but it seems that didn't help...

      I tried to start debugging this - I patched some stuff to ensure m_p is set to 0 correctly and to enable logging, I'll attach the patch.

      This is the log:

      WebSocket 0x7f9070db9d90 connect() url='wss://live.github.com/_sockets/redacted-base64'
      WebSocketChannel 0x7f9070d733d0 connect()
      SocketStreamHandle 0x7f9070d70740 new client 0x7f9070d733d0
      WebSocket 0x7f9070db9d90 close() without code and reason
      WebSocketChannel 0x7f9070d733d0 fail() reason='WebSocket is closed before the connection is established.'
      WebSocket 0x7f9070db9d90 didReceiveErrorMessage()
      SocketStreamHandle 0x7f9070d70740 platformClose
      m_p = 0x7f906acdda00
      Segmentation fault: 11
      

      I can try to fix this myself as I know QtWebKit is deprecated, but I'd appreciate some guidance as I'm stuck - with the check from codereview in, how can there possibly be a segfault at that point?

      Attachments

        1. crashreport.txt
          83 kB
        2. qtwebkit.patch
          2 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            the compiler Florian Bruhin
            the compiler Florian Bruhin
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes