Skip to content

Commit a25236e

Browse files
[release/11.0-preview2] Revert forwarding activation signal (#124894)
Backport of #124877 to release/11.0-preview2 /cc @janvorli ## Customer Impact - [x] Customer reported - [ ] Found internally The current CheckActivationSafePoint uses thread local storage to get the current Thread instance. But this function is called from async signal handler (the activation signal handler) and it is not allowed to access TLS variables there because the access can allocate and if the interrupted code was running in an allocation code, it could crash. There was no problem with this since .NET 1.0, but a change in the recent glibc version has broken this. We've got reports of crashes in this code e.g on recent Ubuntu 25.04 due to this issue. ## Regression - [ ] Yes - [x] No ## Testing CI tests, local manual directed tests ## Risk Low, the change was in main for the past two months and we haven't seen any issues related to it. The newly added code is executed very frequently. Co-authored-by: Jan Vorlicek <janvorli@microsoft.com>
1 parent a92d749 commit a25236e

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

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

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -965,20 +965,22 @@ static void inject_activation_handler(int code, siginfo_t *siginfo, void *contex
965965
CONTEXTToNativeContext(&winContext, ucontext);
966966
}
967967
}
968-
969-
// Call the original handler when it is not ignored or default (terminate).
970-
if (g_previous_activation.sa_flags & SA_SIGINFO)
971-
{
972-
_ASSERTE(g_previous_activation.sa_sigaction != NULL);
973-
g_previous_activation.sa_sigaction(code, siginfo, context);
974-
}
975968
else
976969
{
977-
if (g_previous_activation.sa_handler != SIG_IGN &&
978-
g_previous_activation.sa_handler != SIG_DFL)
970+
// Call the original handler when it is not ignored or default (terminate).
971+
if (g_previous_activation.sa_flags & SA_SIGINFO)
972+
{
973+
_ASSERTE(g_previous_activation.sa_sigaction != NULL);
974+
g_previous_activation.sa_sigaction(code, siginfo, context);
975+
}
976+
else
979977
{
980-
_ASSERTE(g_previous_activation.sa_handler != NULL);
981-
g_previous_activation.sa_handler(code);
978+
if (g_previous_activation.sa_handler != SIG_IGN &&
979+
g_previous_activation.sa_handler != SIG_DFL)
980+
{
981+
_ASSERTE(g_previous_activation.sa_handler != NULL);
982+
g_previous_activation.sa_handler(code);
983+
}
982984
}
983985
}
984986
}

0 commit comments

Comments
 (0)