Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

UWP IL2CPP crash related to TLS, only in Release/x86 (2018.2.0b4)

Discussion in 'Experimental Scripting Previews' started by briank, May 20, 2018.

  1. briank

    briank

    Joined:
    Mar 25, 2017
    Posts:
    74
    The TLS support in 2018.2 is great, however I'm running into an AV on a very specific config of Release/x86. No repo on x64, or x86/Debug, although the latter config does spit out a concerning amount of handled exceptions.

    Not sure how to investigate further. Any insight would be appreciated...

    Configuration:
    2018.2.0b4
    IL2CPP
    UWP version 10.0.17134.0

    Exception:
    0xC0000005: Access violation executing location 0x00000003.

    Callstack:
    > GameAssembly.dll!unitytls_tlsctx_set_x509verify_callback_t_Invoke_m2750783438(unitytls_tlsctx_set_x509verify_callback_t_t3126135024 * __this, unitytls_tlsctx_t2030371563 * ___ctx0, unitytls_tlsctx_x509verify_callback_t194548070 * ___cb1, void * ___userData2, unitytls_errorstate_t2875872539 * ___errorState3, const MethodInfo * method) Line 16888 C++
    GameAssembly.dll!UnityTlsContext__ctor_m3745233880(UnityTlsContext_t366928166 * __this, MobileAuthenticatedStream_t3383979266 * ___parent0, bool ___serverMode1, String_t * ___targetHost2, int ___enabledProtocols3, X509Certificate_t713131622 * ___serverCertificate4, X509CertificateCollection_t3399372417 * ___clientCertificates5, bool ___askForClientCert6, const MethodInfo * method) Line 20555 C++
    GameAssembly.dll!UnityTlsStream_CreateContext_m3044809826(UnityTlsStream_t371919777 * __this, bool ___serverMode0, String_t * ___targetHost1, int ___enabledProtocols2, X509Certificate_t713131622 * ___serverCertificate3, X509CertificateCollection_t3399372417 * ___clientCertificates4, bool ___askForClientCert5, const MethodInfo * method) Line 23259 C++
    [Inline Frame] GameAssembly.dll!VirtFuncInvoker6<MobileTlsContext_t1069274405 *,bool,String_t *,int,X509Certificate_t713131622 *,X509CertificateCollection_t3399372417 *,bool>::Invoke(unsigned int) Line 128 C++
    GameAssembly.dll!U3CProcessAuthenticationU3Ed__47_MoveNext_m4056596982(U3CProcessAuthenticationU3Ed__47_t649267051 * __this, const MethodInfo * method) Line 43758 C++
    GameAssembly.dll!AsyncTaskMethodBuilder_Start_TisU3CProcessAuthenticationU3Ed__47_t649267051_m273123348_gshared(AsyncTaskMethodBuilder_t3536885450 * __this, U3CProcessAuthenticationU3Ed__47_t649267051 * ___stateMachine0, const MethodInfo * method) Line 44470 C++
    [Inline Frame] GameAssembly.dll!AsyncTaskMethodBuilder_Start_TisU3CProcessAuthenticationU3Ed__47_t649267051_m273123348(AsyncTaskMethodBuilder_t3536885450 *) Line 21517 C++
    [Inline Frame] GameAssembly.dll!MobileAuthenticatedStream_ProcessAuthentication_m979422748(MobileAuthenticatedStream_t3383979266 *) Line 41382 C++
    GameAssembly.dll!MobileAuthenticatedStream_AuthenticateAsClient_m3336452272(MobileAuthenticatedStream_t3383979266 * __this, String_t * ___targetHost0, X509CertificateCollection_t3399372417 * ___clientCertificates1, int ___enabledSslProtocols2, bool ___checkCertificateRevocation3, const MethodInfo * method) Line 41333 C++
    [Inline Frame] GameAssembly.dll!InterfaceActionInvoker4<String_t *,X509CertificateCollection_t3399372417 *,int,bool>::Invoke(unsigned int declaringInterface, Il2CppClass *) Line 322 C++
    GameAssembly.dll!MonoTlsStream_CreateStream_m973768516(MonoTlsStream_t1980138907 * __this, ByteU5BU5D_t4116647657 * ___buffer0, const MethodInfo * method) Line 45908 C++
    GameAssembly.dll!WebConnection_CreateStream_m3387195587(WebConnection_t3982808322 * __this, HttpWebRequest_t1669436515 * ___request0, const MethodInfo * method) Line 42930 C++
    GameAssembly.dll!WebConnection_InitConnection_m1346209371(WebConnection_t3982808322 * __this, HttpWebRequest_t1669436515 * ___request0, const MethodInfo * method) Line 44431 C++
    GameAssembly.dll!WebConnection_U3CSendRequestU3Eb__41_0_m3242074501(WebConnection_t3982808322 * __this, Il2CppObject * ___o0, const MethodInfo * method) Line 47722 C++
    GameAssembly.dll!NoParamDelegate_Invoke_m3112707926(NoParamDelegate_t3585332531 * __this, RegexRunner_t300319648 * ___r0, const MethodInfo * method) Line 45493 C++
    GameAssembly.dll!QueueUserWorkItemCallback_WaitCallback_Context_m2238596144(Il2CppObject * __this, Il2CppObject * ___state0, const MethodInfo * method) Line 39984 C++
    GameAssembly.dll!NoParamDelegate_Invoke_m3112707926(NoParamDelegate_t3585332531 * __this, RegexRunner_t300319648 * ___r0, const MethodInfo * method) Line 45456 C++
    GameAssembly.dll!ExecutionContext_RunInternal_m3256186641(Il2CppObject * __this, ExecutionContext_t1748372627 * ___executionContext0, ContextCallback_t3823316192 * ___callback1, Il2CppObject * ___state2, bool ___preserveSyncCtx3, const MethodInfo * method) Line 35876 C++
    [Inline Frame] GameAssembly.dll!ExecutionContext_Run_m80422607(Il2CppObject *) Line 35742 C++
    GameAssembly.dll!QueueUserWorkItemCallback_System_Threading_IThreadPoolWorkItem_ExecuteWorkItem_m71042721(QueueUserWorkItemCallback_t2039233785 * __this, const MethodInfo * method) Line 39953 C++
    GameAssembly.dll!InterfaceActionInvoker0::Invoke(unsigned int slot, Il2CppClass * declaringInterface, Il2CppObject * obj) Line 128 C++
    GameAssembly.dll!ThreadPoolWorkQueue_Dispatch_m3092487892(Il2CppObject * __this, const MethodInfo * method) Line 24830 C++
    GameAssembly.dll!_ThreadPoolWaitCallback_PerformWaitCallback_m3835442245(Il2CppObject * __this, const MethodInfo * method) Line 29841 C++
    GameAssembly.dll!il2cpp::vm::Runtime::InvokeWithThrow(const MethodInfo * method, void * obj, void * * params) Line 526 C++
    GameAssembly.dll!worker_thread(void * data) Line 252 C++
    GameAssembly.dll!il2cpp::vm::ThreadStart(void * arg) Line 661 C++
    GameAssembly.dll!il2cpp::eek:s::Thread::RunWrapper(void * arg) Line 168 C++
    GameAssembly.dll!il2cpp::eek:s::ThreadStartWrapper(void * arg) Line 26 C++
    kernel32.dll!BaseThreadInitThunk(unsigned long RunProcessInit, long(__stdcall*)(void *) StartAddress, void * Argument) Line 64 C
    ntdll.dll!__RtlUserThreadStart(long(__stdcall*)(void *) StartAddress, void * Argument) Line 997 C
    ntdll.dll!_RtlUserThreadStart(long(__stdcall*)(void *) StartAddress, void * Argument) Line 914 C
     
  2. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,926
    Can you submit a bug report for this issue? It looks like something on our side is incorrect, although I'm not sure what.
     
    andreasreich likes this.
  3. briank

    briank

    Joined:
    Mar 25, 2017
    Posts:
    74
    Let me give it a try on 2018.2.0b5 and will follow up with a bug if it still repos.
     
  4. briank

    briank

    Joined:
    Mar 25, 2017
    Posts:
    74
    Still repro'ing in latest beta. A bug has been filed.
     
    JoshPeterson likes this.
  5. andreasreich

    andreasreich

    Unity Technologies

    Joined:
    Sep 24, 2017
    Posts:
    55
    Thank you again for reporting the issue!
    It was caused by a bug in the IL2CPP code generation which would lead to using the wrong calling conventions when calling delegates into native code on Windows x86 (which is a mechanism our Mono TLS provider relies upon heavily). The issue is fixed now and is on its way to the 2018.2 development line. It will most likely make it into the final release of 2018.2.
     
  6. aman_unity417

    aman_unity417

    Joined:
    Aug 2, 2018
    Posts:
    2
    0xc0000005: access violation unity gameassembly.dll
     
  7. andreasreich

    andreasreich

    Unity Technologies

    Joined:
    Sep 24, 2017
    Posts:
    55