Skip to content

Commit 898f09a

Browse files
authored
[release/6.0] Change macOS activatin injection failure handling (#63393)
Backport of #59045 to release/6.0 The pthread_kill can fail with ENOTSUP on macOS when the target thread is a dispatch queue thread. Instead of aborting the process, it is better to fail to inject the activation and rely on return address hijacking and other means of syncing with GC.
1 parent b71484c commit 898f09a

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

src/coreclr/pal/src/exception/signal.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -845,6 +845,15 @@ PAL_ERROR InjectActivationInternal(CorUnix::CPalThread* pThread)
845845
// We can get EAGAIN when printing stack overflow stack trace and when other threads hit
846846
// stack overflow too. Those are held in the sigsegv_handler with blocked signals until
847847
// the process exits.
848+
849+
#ifdef __APPLE__
850+
// On Apple, pthread_kill is not allowed to be sent to dispatch queue threads
851+
if (status == ENOTSUP)
852+
{
853+
return ERROR_NOT_SUPPORTED;
854+
}
855+
#endif
856+
848857
if ((status != 0) && (status != EAGAIN))
849858
{
850859
// Failure to send the signal is fatal. There are only two cases when sending

0 commit comments

Comments
 (0)