Registering for EXC_CRASH in-process triggers in-kernel deadlock

Originator:landon.j.fuller
Number:rdar://14845058 Date Originated:27-Aug-2013 11:42 AM
Status:Open Resolved:
Product:OS X Product Version:
Classification:Crash/Hang/Data Loss Reproducible:Always
 
27-Aug-2013 11:42 AM Landon Fuller:
Summary:

If one registers a task exception port handled by an in-process exception server for EXC_CRASH, the process will deadlock in the kernel (process stuck in uninterruptible wait) when a SIGABRT signal is delivered.

Steps to Reproduce:

Register an in-process Mach exception server for EXC_CRASH, trigger SIGABRT(). The attached project contains a reproduction case.

Expected Results:

The EXC_CRASH message is delivered to the in-process exception handler, execution continues.

Actual Results:

The process deadlocks in-kernel:

  Thread 0xd2a7     DispatchQueue 1          priority 31
  999 start + 1 (libdyld.dylib) [0x7fff89bf65fd]
    999 main + 34 (main.m:13 in DeadLockExample) [0x10fcc3962]
      999 NSApplicationMain + 940 (AppKit) [0x7fff84fd6783]
        999 -[NSApplication run] + 553 (AppKit) [0x7fff8502c05c]
          999 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 122 (AppKit) [0x7fff85033dcb]
            999 _DPSNextEvent + 1026 (AppKit) [0x7fff850345e6]
              999 AEProcessAppleEvent + 56 (HIToolbox) [0x7fff8e278dcf]
                999 aeProcessAppleEvent + 315 (AE) [0x7fff8f49c446]
                  999 dispatchEventAndSendReply(AEDesc const*, AEDesc*) + 31 (AE) [0x7fff8f49c582]
                    999 aeDispatchAppleEvent(AEDesc const*, AEDesc*, unsigned int, unsigned char*) + 381 (AE) [0x7fff8f49c76f]
                      999 _NSAppleEventManagerGenericHandler + 106 (Foundation) [0x7fff8c031d7d]
                        999 -[NSAppleEventManager dispatchRawAppleEvent:withRawReply:handlerRefCon:] + 294 (Foundation) [0x7fff8c031f0a]
                          999 -[NSApplication(NSAppleEventHandling) _handleCoreEvent:withReplyEvent:] + 242 (AppKit) [0x7fff85037fab]
                            999 -[NSApplication(NSAppleEventHandling) _handleAEOpenEvent:] + 570 (AppKit) [0x7fff85038496]
                              999 -[NSApplication _sendFinishLaunchingNotification] + 195 (AppKit) [0x7fff85039eae]
                                999 -[NSApplication _postDidFinishNotification] + 289 (AppKit) [0x7fff8503a18b]
                                  999 -[NSNotificationCenter postNotificationName:object:userInfo:] + 68 (Foundation) [0x7fff8c0181fa]
                                    999 _CFXNotificationPost + 3203 (CoreFoundation) [0x7fff8b66f393]
                                      999 -[DLAppDelegate applicationDidFinishLaunching:] + 39 (DLAppDelegate.m:48 in DeadLockExample) [0x10fcc3bb7]
                                        999 -[DLAppDelegate triggerDeadlock] + 421 (DLAppDelegate.m:42 in DeadLockExample) [0x10fcc3b55]
                                          999 abort + 125 (libsystem_c.dylib) [0x7fff8ec3fbba]
                                            999 __pthread_kill + 10 (libsystem_kernel.dylib) [0x7fff89e47866]
                                             *999 return_from_trap + 178 (mach_kernel) [0xffffff80002f34f2]
                                               *999 i386_astintr + 35 (mach_kernel) [0xffffff80002dc7e3]
                                                 *999 ast_taken + 187 (mach_kernel) [0xffffff8000220a6b]
                                                   *999 bsd_ast + 807 (mach_kernel) [0xffffff80005df6c7]
                                                     *999 postsig_locked + 1037 (mach_kernel) [0xffffff80005df34d]
                                                       *999 exit1_internal + 662 (mach_kernel) [0xffffff80005cb9d6]
                                                         *999 proc_prepareexit + 135 (mach_kernel) [0xffffff80005cbaa7]
                                                           *999 task_exception_notify + 64 (mach_kernel) [0xffffff8000224070]
                                                             *999 exception_triage + 117 (mach_kernel) [0xffffff8000223f75]
                                                               *999 exception_deliver + 758 (mach_kernel) [0xffffff8000223e26]
                                                                 *999 mach_exception_raise + 158 (mach_kernel) [0xffffff800025d0be]
                                                                   *999 mach_msg_rpc_from_kernel_body + 252 (mach_kernel) [0xffffff8000226fcc]
                                                                     *999 ipc_mqueue_receive + 66 (mach_kernel) [0xffffff8000216832]
                                                                       *999 thread_block_reason + 204 (mach_kernel) [0xffffff8000235c7c]
                                                                         *999 ??? (mach_kernel + 223355) [0xffffff800023687b]
                                                                           *999 machine_switch_context + 354 (mach_kernel) [0xffffff80002d81e2]
                                                                             *999 <suspended>


27-Aug-2013 11:42 AM Landon Fuller:
'DeadLockExample-2.zip' was successfully uploaded

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!