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

QtScript crashed with Hardened Runtime

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • None
    • 5.12.7, 5.12.8, 5.15.0
    • Qt Script
    • None
    • macOS

    Description

      Qt Script crashed at macOs 10.14.6 when Hardened Runtime is enabled. Unsigned version of application works fine. I tried to add next lines to app bundle Info.plist and for QtScript framework's Info.plist file, but it not changed anything:

      <key>com.apple.security.cs.allow-jit</key> 
      <true/> 
      <key>com.apple.security.cs.allow-unsigned-executable-memory</key> 
      <true/> 
      <key>com.apple.security.cs.allow-dyld-environment-variables</key> 
      <true/>

      Do you have any advices how to resolve the issue? I need to have a Hardened Runtime to pass Apple Notarization.

      Here is a fragment of callstack during crash:

      0 libsystem_platform.dylib 0x00007fff599a2dcc _platform_memmove$VARIANT$Haswell + 268
      1 org.qt-project.QtScript 0x000000010b5c1e4f QTJSC::JIT::privateCompileCTIMachineTrampolines(QTWTF::RefPtr<QTJSC::ExecutablePool>*, QTJSC::JSGlobalData*, QTJSC::MacroAssemblerCodePtr*, QTJSC::MacroAssemblerCodePtr*, QTJSC::MacroAssemblerCodePtr*, QTJSC::MacroAssemblerCodePtr*) + 11871
      2 org.qt-project.QtScript 0x000000010b5f1ad6 QTJSC::JITThunks::JITThunks(QTJSC::JSGlobalData*) + 134
      3 org.qt-project.QtScript 0x000000010b63116b QTJSC::JSGlobalData::JSGlobalData(bool) + 1867
      4 org.qt-project.QtScript 0x000000010b631b39 QTJSC::JSGlobalData::create() + 41
      5 org.qt-project.QtScript 0x000000010b69521c QScriptEnginePrivate::QScriptEnginePrivate() + 908
      6 org.qt-project.QtScript 0x000000010b69e69f QScriptEngine::QScriptEngine() + 31

       

      Update:

      The crash reproduced on Qt 5.15.0 too. Here is a callstack with Qt 5.15:

      0   libsystem_platform.dylib       0x00007fff5b4fedcc _platform_memmove$VARIANT$Haswell + 2680   libsystem_platform.dylib       0x00007fff5b4fedcc _platform_memmove$VARIANT$Haswell + 268
      1   org.qt-project.QtScript        0x00000001060c38cf QTJSC::JIT::privateCompileCTIMachineTrampolines(QTWTF::RefPtr<QTJSC::ExecutablePool>*, QTJSC::JSGlobalData*, QTJSC::MacroAssemblerCodePtr*, QTJSC::MacroAssemblerCodePtr*, QTJSC::MacroAssemblerCodePtr*, QTJSC::MacroAssemblerCodePtr*) + 11871 (JITOpcodes.cpp:1817)
      2   org.qt-project.QtScript        0x00000001060f3556 QTJSC::JITThunks::JITThunks(QTJSC::JSGlobalData*) + 134 (JITStubs.cpp:767)
      3   org.qt-project.QtScript        0x0000000106132c1b QTJSC::JSGlobalData::JSGlobalData(bool) + 1867 (JSGlobalData.cpp:138)
      4   org.qt-project.QtScript        0x00000001061335e9 QTJSC::JSGlobalData::create() + 41 (JSGlobalData.cpp:205)
      5   org.qt-project.QtScript        0x0000000106196d23 QScriptEnginePrivate::QScriptEnginePrivate() + 899 (qscriptengine.cpp:1005)
      6   org.qt-project.QtScript        0x00000001061a019f QScriptEngine::QScriptEngine() + 31 (qscriptengine.cpp:2065)

       

      Update 2

      I successfully resolved the issue now. I added entitlements file to the binary during signing process and now all works smoothly. Here is my entitlements file:

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
      <plist version="1.0">
      <dict>
       <key>com.apple.security.cs.allow-unsigned-executable-memory</key>
       <true/>
       <key>com.apple.security.cs.allow-jit</key>
       <true/>
       <key>com.apple.security.cs.allow-dyld-environment-variables</key>
       <true/>
       ...
      </dict>
      </plist>

       I added it with codesign command like this:

      codesign --deep --force --timestamp --entitlements entitlements.plist --options runtime -s <certifcate name> <binary name>

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            laknoll Lars Knoll
            roman_chernenko Roman Chernenko
            Votes:
            2 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes