Skip to content

Application crash while stepping into if 'justMyCode' is disabled #68018

Open
@ArseniiCherniaev

Description

Description

We've noticed the following problem with the debugging of applications if justMyCode option is disabled. Stepping into a code could cause target process crash. Only macos-arm64 configurations are affected.

Process:               dotnet [2347]
Path:                  /usr/local/share/dotnet/dotnet
Identifier:            dotnet
Version:               ???
Code Type:             ARM-64 (Native)
Parent Process:        dotnet [2344]
Responsible:           rider [926]
User ID:               502

Date/Time:             2022-04-14 12:46:20.611 +03:00
OS Version:            macOS 12.3.1 (21E258)
Report Version:        12
Anonymous UUID:        56926882-A171-9A29-1ACF-C4826A4C5C72

Time Awake Since Boot: 720 seconds

System Integrity Protection: enabled

Crashed Thread:        29

Exception Type:        EXC_BAD_ACCESS (SIGBUS)
Exception Codes:       KERN_PROTECTION_FAILURE at 0x0000000290e46320
Exception Note:        EXC_CORPSE_NOTIFY

Termination Reason:    Namespace SIGNAL, Code 0xa
Terminating Process:   exc handler [2347]

VM Region Info: 0x290e46320 is in 0x285360000-0x2ffff0000;  bytes after start: 195978016  bytes before end: 1864015071
      REGION TYPE                    START - END         [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      VM_ALLOCATE                 2852a0000-285360000    [  768K] rw-/rwx SM=ZER  
--->  VM_ALLOCATE                 285360000-2ffff0000    [  1.9G] ---/rwx SM=ZER  
      VM_ALLOCATE                 2ffff0000-2ffff8000    [   32K] rw-/rwx SM=PRV  

...

Thread 29 Crashed:: .NET ThreadPool Worker
0   libcoreclr.dylib                  0x0000000100f548ec VirtualCallStubManager::predictStubKind(unsigned long) + 152
1   libcoreclr.dylib                  0x0000000100f548d8 VirtualCallStubManager::predictStubKind(unsigned long) + 132
2   libcoreclr.dylib                  0x0000000100f57c78 VirtualCallStubManager::getStubKind(unsigned long, int) + 36
3   libcoreclr.dylib                  0x0000000100f57e20 VirtualCallStubManager::CheckIsStub_Internal(unsigned long) + 16
4   libcoreclr.dylib                  0x0000000100f5c5a4 VirtualCallStubManagerManager::CheckIsStub_Internal(unsigned long) + 116
5   libcoreclr.dylib                  0x0000000100f34878 StubManager::CheckIsStub_Worker(unsigned long) + 188
6   libcoreclr.dylib                  0x0000000100f34bdc StubManager::TraceStub(unsigned long, TraceDestination*) + 164
7   libcoreclr.dylib                  0x0000000100eab830 EEDbgInterfaceImpl::TraceStub(unsigned char const*, TraceDestination*) + 20
8   libcoreclr.dylib                  0x0000000101140d68 DebuggerStepper::TrapStepInto(ControllerStackInfo*, unsigned char const*, TraceDestination*) + 164
9   libcoreclr.dylib                  0x0000000101140e00 DebuggerStepper::TrapStepInHelper(ControllerStackInfo*, unsigned char const*, unsigned char const*, bool, bool) + 32
10  libcoreclr.dylib                  0x0000000101141250 DebuggerStepper::TrapStep(ControllerStackInfo*, bool) + 900
11  libcoreclr.dylib                  0x000000010114314c DebuggerStepper::TriggerSingleStep(Thread*, unsigned char const*) + 1256
12  libcoreclr.dylib                  0x000000010113d8c0 DebuggerController::ScanForTriggers(unsigned char const*, Thread*, _CONTEXT*, DebuggerControllerQueue*, SCAN_TRIGGER, TP_RESULT*) + 316
13  libcoreclr.dylib                  0x000000010113e294 DebuggerController::DispatchPatchOrSingleStep(Thread*, _CONTEXT*, unsigned char const*, SCAN_TRIGGER) + 268
14  libcoreclr.dylib                  0x000000010113f6cc DebuggerController::DispatchNativeException(_EXCEPTION_RECORD*, _CONTEXT*, unsigned int, Thread*) + 596
15  libcoreclr.dylib                  0x000000010114bf28 Debugger::FirstChanceNativeException(_EXCEPTION_RECORD*, _CONTEXT*, unsigned int, Thread*) + 124
16  libcoreclr.dylib                  0x0000000101079300 HandleHardwareException(PAL_SEHException*) + 272
17  libcoreclr.dylib                  0x0000000100e21c18 SEHProcessException(PAL_SEHException*) + 352
18  libcoreclr.dylib                  0x0000000100e58184 PAL_DispatchException + 196
19  libcoreclr.dylib                  0x0000000100e57dd8 PAL_DispatchExceptionWrapper + 16
20  ???                               0x000000028010c404 0x0 + 10738516996
21  ???                               0x0000000283cb2c1c 0x0 + 10801064988
22  ???                               0x0000000285024cf4 0x0 + 10821455092
23  ???                               0x0000000285024bf8 0x0 + 10821454840
24  ???                               0x0000000285024848 0x0 + 10821453896
25  ???                               0x00000002850222d8 0x0 + 10821444312
26  ???                               0x00000002850244b4 0x0 + 10821452980
27  ???                               0x00000002850221bc 0x0 + 10821444028
28  ???                               0x00000002850244b4 0x0 + 10821452980
29  ???                               0x00000002850221bc 0x0 + 10821444028
30  ???                               0x00000002850219a8 0x0 + 10821441960
31  ???                               0x0000000285021414 0x0 + 10821440532
32  ???                               0x000000028501f1b0 0x0 + 10821431728
33  ???                               0x000000028501ed98 0x0 + 10821430680
34  ???                               0x00000002850103ec 0x0 + 10821370860
35  ???                               0x000000028500fa78 0x0 + 10821368440
36  ???                               0x000000028500c720 0x0 + 10821355296
37  ???                               0x000000028500c32c 0x0 + 10821354284
38  ???                               0x000000028500c280 0x0 + 10821354112
39  ???                               0x000000028500be18 0x0 + 10821352984
40  ???                               0x000000028500b7c0 0x0 + 10821351360
41  ???                               0x000000028500af64 0x0 + 10821349220
42  ???                               0x0000000284a62cd0 0x0 + 10815417552
43  ???                               0x0000000284a6205c 0x0 + 10815414364
44  ???                               0x0000000284a61fb0 0x0 + 10815414192
45  ???                               0x0000000284a61f50 0x0 + 10815414096
46  ???                               0x0000000284a5fde8 0x0 + 10815405544
47  ???                               0x0000000284a5fc34 0x0 + 10815405108
48  ???                               0x0000000284a5fb88 0x0 + 10815404936
49  ???                               0x0000000284a5fb28 0x0 + 10815404840
50  ???                               0x0000000283cb039c 0x0 + 10801054620
51  ???                               0x0000000284a540ec 0x0 + 10815357164
52  ???                               0x0000000284a53f00 0x0 + 10815356672
53  ???                               0x0000000284a306a8 0x0 + 10815211176
54  ???                               0x0000000284a2ff3c 0x0 + 10815209276
55  ???                               0x0000000284a2f9c4 0x0 + 10815207876
56  ???                               0x0000000284a2f918 0x0 + 10815207704
57  ???                               0x0000000284a2f8b4 0x0 + 10815207604
58  ???                               0x0000000284a2c800 0x0 + 10815195136
59  ???                               0x0000000284a2c72c 0x0 + 10815194924
60  ???                               0x00000002849f9390 0x0 + 10814985104
61  ???                               0x0000000284fafa50 0x0 + 10820975184
62  ???                               0x0000000282831ba8 0x0 + 10779564968
63  ???                               0x0000000284faf784 0x0 + 10820974468
64  ???                               0x0000000284faf5a0 0x0 + 10820973984
65  ???                               0x000000028498f140 0x0 + 10814550336
66  ???                               0x000000028498eb10 0x0 + 10814548752
67  ???                               0x000000028498ad74 0x0 + 10814532980
68  ???                               0x0000000284faf544 0x0 + 10820973892
69  ???                               0x0000000284faf434 0x0 + 10820973620
70  ???                               0x00000002849feb68 0x0 + 10815007592
71  ???                               0x00000002849fb350 0x0 + 10814993232
72  ???                               0x0000000284faf348 0x0 + 10820973384
73  ???                               0x0000000282831ba8 0x0 + 10779564968
74  ???                               0x0000000284faf190 0x0 + 10820972944
75  ???                               0x0000000284faf058 0x0 + 10820972632
76  ???                               0x000000028498f140 0x0 + 10814550336
77  ???                               0x000000028498eb10 0x0 + 10814548752
78  ???                               0x000000028498ad74 0x0 + 10814532980
79  ???                               0x00000002849d6cd0 0x0 + 10814844112
80  ???                               0x00000002849d6be0 0x0 + 10814843872
81  ???                               0x00000002849d6acc 0x0 + 10814843596
82  ???                               0x00000002849fc79c 0x0 + 10814998428
83  ???                               0x0000000284faf000 0x0 + 10820972544
84  ???                               0x0000000282831ba8 0x0 + 10779564968
85  ???                               0x0000000284faee48 0x0 + 10820972104
86  ???                               0x0000000284faed10 0x0 + 10820971792
87  ???                               0x000000028497e728 0x0 + 10814482216
88  ???                               0x00000002849a9d08 0x0 + 10814659848
89  ???                               0x00000002849a9bb4 0x0 + 10814659508
90  ???                               0x00000002849a9b54 0x0 + 10814659412
91  ???                               0x00000002849a99bc 0x0 + 10814659004
92  ???                               0x00000002849a6c48 0x0 + 10814647368
93  ???                               0x00000002849d5c30 0x0 + 10814839856
94  ???                               0x0000000282831ba8 0x0 + 10779564968
95  ???                               0x00000002849d596c 0x0 + 10814839148
96  ???                               0x00000002849d5484 0x0 + 10814837892
97  ???                               0x0000000283359ca8 0x0 + 10791263400
98  ???                               0x0000000283354bd4 0x0 + 10791242708
99  ???                               0x0000000283353598 0x0 + 10791237016
100 ???                               0x000000028200d8b4 0x0 + 10771028148
101 ???                               0x000000028200d6c4 0x0 + 10771027652
102 ???                               0x000000028200cf50 0x0 + 10771025744
103 libcoreclr.dylib                  0x0000000101107d88 CallDescrWorkerInternal + 132
104 libcoreclr.dylib                  0x0000000100f78484 DispatchCallSimple(unsigned long*, unsigned int, unsigned long, unsigned int) + 284
105 libcoreclr.dylib                  0x0000000100f8d854 ThreadNative::KickOffThread_Worker(void*) + 148
106 libcoreclr.dylib                  0x0000000100f43320 ManagedThreadBase_DispatchOuter(ManagedThreadCallState*) + 260
107 libcoreclr.dylib                  0x0000000100f43898 ManagedThreadBase::KickOff(void (*)(void*), void*) + 32
108 libcoreclr.dylib                  0x0000000100f8d92c ThreadNative::KickOffThread(void*) + 172
109 libcoreclr.dylib                  0x0000000100e55e68 CorUnix::CPalThread::ThreadEntry(void*) + 380
110 libsystem_pthread.dylib           0x00000001aceee26c _pthread_start + 148
111 libsystem_pthread.dylib           0x00000001acee908c thread_start + 8

...

Thread 29 crashed with ARM Thread State (64-bit):
   x0: 0x0000600003740730   x1: 0x0000000290e46320   x2: 0x0000000000000001   x3: 0x0000000100e68918
   x4: 0x0000000000000000   x5: 0x0000000000000000   x6: 0x0000000170a3b368   x7: 0x0000000170a3b308
   x8: 0x0000000170a3d220   x9: 0x000000013501a000  x10: 0x0000000000000002  x11: 0x0000000000000000
  x12: 0x0000000280134f61  x13: 0x0000000170a43220  x14: 0x0000000000000000  x15: 0x00000001acef5630
  x16: 0x00000000000000a0  x17: 0x0000600003740690  x18: 0x0000000000000000  x19: 0x0000000290e46320
  x20: 0x000000010130ca60  x21: 0x00000001acef5630  x22: 0x0000000170a3d2f8  x23: 0x00000001acef5630
  x24: 0x0000000170a3d2f0  x25: 0x0000000101314000  x26: 0x0000000101315670  x27: 0x00000000ffffffff
  x28: 0x0000000000000002   fp: 0x0000000170a3d280   lr: 0x0000000100f548d8
   sp: 0x0000000170a3d220   pc: 0x0000000100f548ec cpsr: 0x0000000060001000  far: 0x0000000290e46320
  esr: 0x0000000092000006

Binary Images:
       0x1003dc000 -        0x1003e8000 +dotnet (???) <0ED2FF17-1F2E-3580-8655-B55846441074> /usr/local/share/dotnet/dotnet
       0x100498000 -        0x1004f8000 dyld (???) <FBB89662-E6F2-3434-B542-F75185AC5E74> /usr/lib/dyld
       0x1006bc000 -        0x100700000 +libhostfxr.dylib (???) <FC549AD0-AF0B-3A5F-B737-A438074D62B7> /usr/local/share/dotnet/host/fxr/6.0.0/libhostfxr.dylib
       0x10072c000 -        0x100768000 +libhostpolicy.dylib (???) <6281B33A-19D4-3EB6-8AF0-16022A2562CA> /usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.0/libhostpolicy.dylib
       0x100e18000 -        0x1012e8000 +libcoreclr.dylib (???) <40D5325D-B096-3BA7-977A-C338C716C45C> /usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.0/libcoreclr.dylib
       0x10d614000 -        0x10d624000 +libSystem.Native.dylib (???) <22ADAF12-9321-36F7-BA85-ABC08EA66E7B> /usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.0/libSystem.Native.dylib
       0x1aceaf000 -        0x1acee7000 libsystem_kernel.dylib (???) <1D7B3B8E-75A1-34EA-AA52-9F7C23155C55> /usr/lib/system/libsystem_kernel.dylib
       0x1acee7000 -        0x1acef4000 libsystem_pthread.dylib (???) <CEE8BC77-6923-34D9-89A3-6F8F7279605E> /usr/lib/system/libsystem_pthread.dylib
       0x1acf36000 -        0x1ad47c000 com.apple.CoreFoundation (6.9 - 1858.112) <8E1809FF-F5B1-3D9E-BE15-F2E7B1D8CE51> /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation

External Modification Summary:
 Calls made by other processes targeting this process:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0
 Calls made by this process:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0
 Calls made by all processes on this machine:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0

VM Region Summary:
ReadOnly portion of Libraries: Total=670.9M resident=0K(0%) swapped_out_or_unallocated=670.9M(100%)
Writable regions: Total=1.3G written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=1.3G(100%)

                                VIRTUAL   REGION 
REGION TYPE                        SIZE    COUNT (non-coalesced) 
===========                     =======  ======= 
Activity Tracing                   256K        1 
Kernel Alloc Once                   32K        1 
MALLOC                           256.2M       32 
MALLOC guard page                   96K        5 
MALLOC_MEDIUM (reserved)         584.0M        5         reserved VM address space (unallocated)
MALLOC_NANO (reserved)           384.0M        1         reserved VM address space (unallocated)
STACK GUARD                       56.5M       32 
Stack                             24.0M       32 
VM_ALLOCATE                       22.2G      921 
VM_ALLOCATE (reserved)              64K        1         reserved VM address space (unallocated)
__AUTH                             220K       44 
__AUTH_CONST                      2887K      122 
__DATA                            1259K      122 
__DATA_CONST                      3904K      130 
__DATA_DIRTY                       233K       50 
__LINKEDIT                       586.3M        9 
__OBJC_CONST                       260K       29 
__OBJC_RO                         82.9M        1 
__OBJC_RW                         3152K        1 
__TEXT                            84.5M      136 
__UNICODE                          592K        1 
dyld private memory               1024K        1 
mapped file                       33.6M       21 
shared memory                       80K        5 
===========                     =======  ======= 
TOTAL                             24.3G     1703 
TOTAL, minus reserved VM space    23.3G     1703 

Here's the initial ips report file.

Reproduction Steps

  • Open the following project in VS Code
  • Toggle a breakpoint in file WeatherForecastController.cs on line 25
  • Start debugging and perform Get request
  • Press step into

Expected behavior

The debug session is still alive and the app is working

Actual behavior

Application crash

Regression?

No response

Known Workarounds

Setting 'justMyCode' property to true allows me to properly debug the application.

Configuration

  • .NET 6
  • macOS
  • ARM 64

The issue is specific to this configuration

Other information

No response

Metadata

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions