diff options
Diffstat (limited to 'compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cc')
-rw-r--r-- | compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cc | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cc b/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cc index a1c26e47f59..773de69d4d9 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cc @@ -44,6 +44,8 @@ #define MAP_NORESERVE 0 #endif +typedef void (*sa_sigaction_t)(int, siginfo_t *, void *); + namespace __sanitizer { u32 GetUid() { @@ -126,6 +128,14 @@ void SleepForMillis(int millis) { } void Abort() { + // If we are handling SIGABRT, unhandle it first. + if (IsHandledDeadlySignal(SIGABRT)) { + struct sigaction sigact; + internal_memset(&sigact, 0, sizeof(sigact)); + sigact.sa_sigaction = (sa_sigaction_t)SIG_DFL; + internal_sigaction(SIGABRT, &sigact, nullptr); + } + abort(); } @@ -170,7 +180,6 @@ void UnsetAlternateSignalStack() { UnmapOrDie(oldstack.ss_sp, oldstack.ss_size); } -typedef void (*sa_sigaction_t)(int, siginfo_t *, void *); static void MaybeInstallSigaction(int signum, SignalHandlerType handler) { if (!IsHandledDeadlySignal(signum)) |