Skip to content

Segmentation faults on Apple Sillicon dotnet 6 preview 3 #49513

Closed

Description

@danwalmsley

Description

Running Avalonia application we get segmentation faults very early on in execution, app doesnt have enough time to load.
Could be around native interop.

Configuration

dotnet 6 preview 2, arm64 mac os, big sure 11.3 beta

Other information

repro (https://1drv.ms/u/s!Avy6wigimZy_rPkTTg_7h1X5Uknm9w?e=abj6RO)

dotnet ControlCatalog.NetCore.dll

image

Seems to crash on a threadpool worker thread.

Thread 15 Crashed:: .NET ThreadPool Worker
0   libcoreclr.dylib              	0x0000000100bf2904 ChunkAllocator::New(unsigned long) + 28
1   libcoreclr.dylib              	0x0000000100f49d24 EEJitManager::allocGCInfo(_hpCodeHdr*, unsigned int, unsigned long*) + 160
2   libcoreclr.dylib              	0x0000000100f49d24 EEJitManager::allocGCInfo(_hpCodeHdr*, unsigned int, unsigned long*) + 160
3   libcoreclr.dylib              	0x0000000100c2dc80 CEEJitInfo::allocGCInfo(unsigned long) + 52
4   libclrjit.dylib               	0x000000012183fdd4 GcInfoEncoder::Emit() + 56
5   libclrjit.dylib               	0x00000001217d0f18 CodeGen::genCreateAndStoreGCInfo(unsigned int, unsigned int, unsigned int) + 368
6   libclrjit.dylib               	0x00000001216c1764 CodeGen::genEmitUnwindDebugGCandEH() + 140
7   libclrjit.dylib               	0x00000001216c82bc CodeGenPhase::DoPhase() + 36
8   libclrjit.dylib               	0x00000001217a2820 Phase::Run() + 44
9   libclrjit.dylib               	0x00000001216c15ac CodeGen::genGenerateCode(void**, unsigned int*) + 192
10  libclrjit.dylib               	0x00000001216cdb28 Compiler::compCompile(void**, unsigned int*, JitFlags*) + 2748
11  libclrjit.dylib               	0x00000001216ce8c4 Compiler::compCompileHelper(CORINFO_MODULE_STRUCT_*, ICorJitInfo*, CORINFO_METHOD_INFO*, void**, unsigned int*, JitFlags*) + 728
12  libclrjit.dylib               	0x00000001216ce2d4 Compiler::compCompile(CORINFO_MODULE_STRUCT_*, void**, unsigned int*, JitFlags*) + 868
13  libclrjit.dylib               	0x00000001216cf3a0 jitNativeCode(CORINFO_METHOD_STRUCT_*, CORINFO_MODULE_STRUCT_*, ICorJitInfo*, CORINFO_METHOD_INFO*, void**, unsigned int*, JitFlags*, void*) + 424
14  libclrjit.dylib               	0x00000001216d3070 CILJit::compileMethod(ICorJitInfo*, CORINFO_METHOD_INFO*, unsigned int, unsigned char**, unsigned int*) + 108
15  libcoreclr.dylib              	0x0000000100c2e088 invokeCompileMethodHelper(EEJitManager*, CEEInfo*, CORINFO_METHOD_INFO*, CORJIT_FLAGS, unsigned char**, unsigned int*) + 240
16  libcoreclr.dylib              	0x0000000100c2e178 invokeCompileMethod(EEJitManager*, CEEInfo*, CORINFO_METHOD_INFO*, CORJIT_FLAGS, unsigned char**, unsigned int*) + 160
17  libcoreclr.dylib              	0x0000000100c2e2a4 CallCompileMethodWithSEHWrapper(EEJitManager*, CEEInfo*, CORINFO_METHOD_INFO*, CORJIT_FLAGS, unsigned char**, unsigned int*, NativeCodeVersion) + 56
18  libcoreclr.dylib              	0x0000000100c2ead0 UnsafeJitFunction(PrepareCodeConfig*, COR_ILMETHOD_DECODER*, CORJIT_FLAGS, unsigned int*) + 900
19  libcoreclr.dylib              	0x0000000100c60890 MethodDesc::JitCompileCodeLocked(PrepareCodeConfig*, ListLockEntryBase<NativeCodeVersion>*, unsigned int*, CORJIT_FLAGS*) + 308
20  libcoreclr.dylib              	0x0000000100c60540 MethodDesc::JitCompileCodeLockedEventWrapper(PrepareCodeConfig*, ListLockEntryBase<NativeCodeVersion>*) + 644
21  libcoreclr.dylib              	0x0000000100c5fc4c MethodDesc::JitCompileCode(PrepareCodeConfig*) + 424
22  libcoreclr.dylib              	0x0000000100c5f710 MethodDesc::PrepareILBasedCode(PrepareCodeConfig*) + 256
23  libcoreclr.dylib              	0x0000000100c5f5c8 MethodDesc::PrepareCode(PrepareCodeConfig*) + 52
24  libcoreclr.dylib              	0x0000000100c5f52c MethodDesc::PrepareInitialCode(CallerGCMode) + 132
25  libcoreclr.dylib              	0x0000000100bea804 NDirect::GetStubForILStub(NDirectMethodDesc*, MethodDesc**, unsigned int) + 228
26  libcoreclr.dylib              	0x0000000100beab94 GetStubForInteropMethod(MethodDesc*, unsigned int, MethodDesc**) + 212
27  libcoreclr.dylib              	0x0000000100c6268c MethodDesc::DoPrestub(MethodTable*, CallerGCMode) + 832
28  libcoreclr.dylib              	0x0000000100c61ef4 PreStubWorker + 544
29  libcoreclr.dylib              	0x0000000100e24e90 ThePreStub + 80
30  ???                           	0x0000000283ade23c 0 + 10799145532
31  ???                           	0x0000000283ade0a4 0 + 10799145124
32  ???                           	0x0000000283add9c4 0 + 10799143364
33  ???                           	0x0000000283adcf38 0 + 10799140664
34  ???                           	0x0000000283adcb40 0 + 10799139648
35  ???                           	0x0000000283adc950 0 + 10799139152
36  ???                           	0x0000000283adc6d4 0 + 10799138516
37  ???                           	0x0000000283adc20c 0 + 10799137292
38  ???                           	0x0000000283aa9a1c 0 + 10798930460
39  ???                           	0x0000000283aa9130 0 + 10798928176
40  ???                           	0x0000000283aa8838 0 + 10798925880
41  ???                           	0x00000002822afbac 0 + 10773789612
42  ???                           	0x00000002822af1e4 0 + 10773787108
43  ???                           	0x00000002822aee80 0 + 10773786240
44  ???                           	0x00000002822aede4 0 + 10773786084
45  ???                           	0x00000002822aec00 0 + 10773785600
46  ???                           	0x00000002822aea4c 0 + 10773785164
47  ???                           	0x00000002822ae40c 0 + 10773783564
48  ???                           	0x00000002822adca4 0 + 10773781668
49  ???                           	0x00000002822ad8dc 0 + 10773780700
50  ???                           	0x00000002822aca84 0 + 10773777028
51  libcoreclr.dylib              	0x0000000100e25988 CallDescrWorkerInternal + 132
52  libcoreclr.dylib              	0x0000000100cb9058 CallDescrWorkerWithHandler(CallDescrData*, int) + 136
53  libcoreclr.dylib              	0x0000000100cb9628 MethodDescCallSite::CallTargetWorker(unsigned long const*, unsigned long*, int) + 772
54  libcoreclr.dylib              	0x0000000100ccf2c0 AppDomainTimerCallback_Worker(void*) + 172
55  libcoreclr.dylib              	0x0000000100c8669c ManagedThreadBase_DispatchOuter(ManagedThreadCallState*) + 260
56  libcoreclr.dylib              	0x0000000100c86c40 ManagedThreadBase::ThreadPool(void (*)(void*), void*) + 32
57  libcoreclr.dylib              	0x0000000100ccf380 AppDomainTimerCallback(void*, unsigned char) + 148
58  libcoreclr.dylib              	0x0000000100ca5344 ThreadpoolMgr::AsyncTimerCallbackCompletion(void*) + 80
59  libcoreclr.dylib              	0x0000000100cce840 ThreadPoolNative::ExecuteUnmanagedThreadPoolWorkItem(unsigned int (*)(void*), void*) + 88
60  ???                           	0x00000002822ac858 0 + 10773776472
61  ???                           	0x00000002822a8c70 0 + 10773761136
62  ???                           	0x00000002822a5144 0 + 10773745988
63  ???                           	0x00000002822a368c 0 + 10773739148
64  ???                           	0x00000002822a34a8 0 + 10773738664
65  ???                           	0x00000002822a3360 0 + 10773738336
66  libcoreclr.dylib              	0x0000000100e25988 CallDescrWorkerInternal + 132
67  libcoreclr.dylib              	0x0000000100cb9058 CallDescrWorkerWithHandler(CallDescrData*, int) + 136
68  libcoreclr.dylib              	0x0000000100cb92e8 DispatchCallSimple(unsigned long*, unsigned int, unsigned long, unsigned int) + 192
69  libcoreclr.dylib              	0x0000000100cc8714 ThreadNative::KickOffThread_Worker(void*) + 148
70  libcoreclr.dylib              	0x0000000100c8669c ManagedThreadBase_DispatchOuter(ManagedThreadCallState*) + 260
71  libcoreclr.dylib              	0x0000000100c86c14 ManagedThreadBase::KickOff(void (*)(void*), void*) + 32
72  libcoreclr.dylib              	0x0000000100cc87f0 ThreadNative::KickOffThread(void*) + 176
73  libcoreclr.dylib              	0x0000000100b8e4c4 CorUnix::CPalThread::ThreadEntry(void*) + 380
74  libsystem_pthread.dylib       	0x0000000182776fd4 _pthread_start + 320
75  libsystem_pthread.dylib       	0x0000000182771d3c thread_start + 8

Activity

  1. ghost added
    untriaged
    on Mar 11, 2021
  2. added this to the 6.0.0 milestone on Mar 12, 2021
  3. sdmaclea commented on Mar 12, 2021

    @sdmaclea
    Contributor

    @danwalmsley I don't seem to have permission to see your repro.

    Based on the call stack it looks like perhaps the GCInfo might be allocated in executable memory and needs special handling to deal with the Apple Silicon Write No Execute policy.

  4. danwalmsley commented on Mar 12, 2021

    @danwalmsley
    Author

    @sdmaclea I accidentally deleted the file, the link should work now

  5. sdmaclea commented on Mar 12, 2021

    @sdmaclea
    Contributor

    @danwalmsley I still see the link as broken.

  6. sdmaclea commented on Mar 13, 2021

    @sdmaclea
    Contributor

    Thanks. That worked. I'll look at it next week..

  7. removed
    untriaged
    on Mar 16, 2021
  8. sdmaclea commented on Mar 17, 2021

    @sdmaclea
    Contributor

    I took a quick look. The segmentation fault is caused by a null pointer. It probably is similar to the root cause for #49365. (And similar lower level test failures).

    This is not trivial to fix.

    We will focus on stabilizing the runtime tests then the libraries tests. I would asssume this will automatically get fixed when as a side effect of that work.

  9. sdmaclea commented on Apr 8, 2021

    @sdmaclea
    Contributor

    @danwalmsley I am using macOS 11.3 Beta 6 with preview3. Stability is much improved. Can you try this again? The major improvement seems to come from the OS update.

  10. danwalmsley commented on Apr 12, 2021

    @danwalmsley
    Author

    @sdmaclea Iv tried and the behavior seems to have changed slightly....

    but still
    dotnet bin/Debug/net6.0/ControlCatalog.NetCore.dll
    [1] 12827 segmentation fault dotnet bin/Debug/net6.0/ControlCatalog.NetCore.dll

  11. danwalmsley commented on Apr 12, 2021

    @danwalmsley
    Author

    image

  12. changed the title [-]Segmentation faults on Apple Sillicon dotnet 6 preview 2[/-] [+]Segmentation faults on Apple Sillicon dotnet 6 preview 3[/+] on Apr 13, 2021
  13. danwalmsley commented on May 6, 2021

    @danwalmsley
    Author

    I can confirm this is no longer an issue on the version I tested:

    Runtime Environment:
    OS Name: Mac OS X
    OS Version: 11.4
    OS Platform: Darwin
    RID: osx.11.0-arm64
    Base Path: /usr/local/share/dotnet/sdk/6.0.100-preview.5.21256.4/

    Host (useful for support):
    Version: 6.0.0-preview.5.21254.12
    Commit: 65020c9

  14. sdmaclea commented on May 6, 2021

    @sdmaclea
    Contributor
  15. ghost locked as resolved and limited conversation to collaborators on Jun 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions