[crashing] Improve crash chaining code#19973
Conversation
30560c7 to
703269e
Compare
|
@lambdageek @vargaz What do you think this code means to do (from master)? Lines 3424 to 3434 in 74f6d2c To me it means that if crash chaining is enabled (and actually has a handler registered), we will never I want to remove this part: and always handle the chaining sequence the same way. |
mono/mini/mini-posix.c
Outdated
There was a problem hiding this comment.
Is it possible to:
- Restore the default signal action
- Restore the original context (i.e. restore the registers, etc. to the values when the signal was raised), so that the process resumes execution with the default signal action (which will presumably terminate the process and cause the OS to produce a crash report).
The point is to leave the process in the same state it was when the signal was raised, except without Mono's signal handler. The reason for this is that when there's a crash in native code, it's quite often very difficult to figure out what happened, and having the original state can be helpful. In particular with crashes due to bugs in Apple's software, it would be much better to be able to provide Apple engineers with a crash report that accurately reflects the process state at the time of the crash instead of a process where Mono stomped all over the place.
There was a problem hiding this comment.
@Rolf (1) is done (now more completely) in mono_handle_native_crash
(2) I will have to think about how that would be possible - restoring the context would naturally divert execution to the new (old) IP.
There was a problem hiding this comment.
@Rolf On further thought, just restoring the context might work - without advancing the IP, the same instruction will execute as before, presumably inducing the same signal which then would be handled by the OS instead of Mono.
703269e to
59c0d62
Compare
|
Windows builds are failing: |
With this change, `mono_post_native_crash_handler` chains the crashing signal directly, instead of that having to happen after `mono_handle_native_crash` returns (which created a fragile repetitive code pattern). Finally, this way `mono_post_native_crash_handler` can also re-raise the signal right after chaining it. Since we remove our crashing signal handlers in `mono_handle_native_crash`, this should allow the OS to handle the signal as the final action. Should fix mono#19860
59c0d62 to
870f2b7
Compare
|
@monojenkins backport to 2020-02 |
|
@alexischr backporting to 2020-02 failed, the patch results in conflicts: Please backport manually! |
…ash() for s390x * Fix exception-s390x so mono_handle_native_crash() is called according to the changes made in mono/mono#19973 * Make roslyn the default compiler for s390x
…ash() for s390x (#38428) * Fix exception-s390x so mono_handle_native_crash() is called according to the changes made in mono/mono#19973 * Make roslyn the default compiler for s390x Co-authored-by: nealef <nealef@users.noreply.github.com>
…ash() for s390x (#38428) * Fix exception-s390x so mono_handle_native_crash() is called according to the changes made in mono/mono#19973 * Make roslyn the default compiler for s390x Co-authored-by: nealef <nealef@users.noreply.github.com>
This reverts commit 7a0425e. This change was causing this android issue: mono#20275
This reverts commit 7a0425e. This change was causing this android issue: mono#20275
With this change,
mono_post_native_crash_handlerchains the crashing signal directly, instead of that having to happen aftermono_handle_native_crashreturns (which created a fragile repetitive code pattern). Finally, this waymono_post_native_crash_handlercan also re-raise the signal right after chaining it. Since we remove our crashing signal handlers inmono_handle_native_crash, this should allow the OS to handle the signal as the final action.TODO:
mono_chain_signalis called beforemono_handle_native_crash, and if the crash is chained,mono_handle_native_crashdoesn't run (example:mini-runtime.c:mono_sigfpe_signal_handler)mono_handle_native_crashFixes #19860