-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[mono][ios] Mono prevents crash logs from being generated in case SIGSEGV
is raised from native code
#106064
Comments
/cc: @rolfbjarne |
This sounds a bit weird. If the SIGSEGV comes from managed code, the signal handler should raise a NullReferenceException. This didn't happen, so the SIGSEGV didn't come from managed code, and in that case the signal handler should chain to the previous signal handler. This didn't happen (presumably because there was no previous signal handler), and in that case Mono will print native crash info and call abort: runtime/src/mono/mono/mini/mini-posix.c Lines 225 to 226 in af1b3b0
But that didn't happen? Instead we got a double fault... it sounds like the second SIGSEGV didn't come from returning from the first signal handler, but instead occurred during the first signal handler. |
If I am not mistaken the code you linked is the We are instead reaching this code: runtime/src/mono/mono/mini/mini-runtime.c Line 3808 in af1b3b0
which further handles the signal and returns since signal chaining is enabled: runtime/src/mono/mono/mini/mini-runtime.c Lines 3908 to 3912 in af1b3b0
|
Ah my bad, sorry about the confusion. I'm just really surprised this isn't a regression, because I'm certain I've seen crash reports for SIGSEGVs originating in native code before (but then again I might be misremembering - I just tried in .NET 8, and I got the double fault with no crash report). |
FWIW I've seen customers run into this now. |
Do we have a specific issue to link to this one + raise a priority on fixing this? |
The customer in question is the one who reported this: #107641 Although much of the interaction happened via email, so reading the issue isn't all that useful. |
@ivanpovazan @steveisok @vitek-karas this one is happening more frequently with customers now - could we get this prioritized? I think @StephaneDelcroix can provide a repro... |
If you have a repro, great and I'll work with @vitek-karas to get this prioritized. |
I just synced with @vitek-karas I will look into this as soon as possible. |
Description
While investigating the behavior of the crash reported in: #105245 on iOS device we noticed that such error does not:
Console.app
Repro
Debug
mode:Console.app
shows only that the program exited:Investigation
As initially assumed, the crash was not caused by asserting from the runtime (where we
abort()
properly), but instead the code was trying to read from an invalid memory address (something like 0xa8) soSIGSEGV
was raised.The mono's signal handler catches this, but does not remove it self as a
SIGSEGV
handler when it starts handling the signal.After the handling is done, the handler returns, but the same signal is caught again and on second handling the program exits out with -1 in case of double faulting:
runtime/src/mono/mono/mini/mini-posix.c
Lines 789 to 792 in fdb7415
This causes the app to silently exit not including any information about the crash.
Additionally, the messages from the signal handler (like information about the native and managed stack traces) that are using
g_async_safe_printf
are not shown in the system log.FWIW In the signal handler we do unregister the runtime for some signals, but not for
SIGSEGV
:runtime/src/mono/mono/mini/mini-exceptions.c
Lines 2932 to 2942 in d606c60
Proposal
SIGSEGV
handler if we've detected that the signal it's not coming from managed code (to distinguishNullReferenceException
)PS Thanks @lambdageek for assistance
The text was updated successfully, but these errors were encountered: