summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVitaly Buka <vitalybuka@google.com>2017-11-11 03:03:34 +0000
committerVitaly Buka <vitalybuka@google.com>2017-11-11 03:03:34 +0000
commit42df8011b906358522219a262e6fbd2e47e7a3d6 (patch)
tree2f70f85562388ad87ffbc285013063ecd75c4846
parent4eb81d264dde37f70252d16e7428945e8936699e (diff)
[msan] Fix signal chaining
Return internally stored handlers only if handlers is set to wrapper git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@317970 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/msan/msan_interceptors.cc2
-rw-r--r--test/sanitizer_common/TestCases/Linux/allow_user_segv.cc6
2 files changed, 4 insertions, 4 deletions
diff --git a/lib/msan/msan_interceptors.cc b/lib/msan/msan_interceptors.cc
index fd63d0765..43181fb9d 100644
--- a/lib/msan/msan_interceptors.cc
+++ b/lib/msan/msan_interceptors.cc
@@ -1301,7 +1301,7 @@ static int sigaction_impl(int signo, const __sanitizer_sigaction *act,
res = REAL(sigaction)(signo, pnew_act, oldact);
if (res == 0 && oldact) {
uptr cb = (uptr)oldact->sigaction;
- if (cb != __sanitizer::sig_ign && cb != __sanitizer::sig_dfl) {
+ if (cb == (uptr)SignalAction || cb == (uptr)SignalHandler) {
oldact->sigaction = (decltype(oldact->sigaction))old_cb;
}
}
diff --git a/test/sanitizer_common/TestCases/Linux/allow_user_segv.cc b/test/sanitizer_common/TestCases/Linux/allow_user_segv.cc
index ab6b7d75f..70710e34c 100644
--- a/test/sanitizer_common/TestCases/Linux/allow_user_segv.cc
+++ b/test/sanitizer_common/TestCases/Linux/allow_user_segv.cc
@@ -18,7 +18,7 @@
// clang-format on
// Remove when fixed: https://github.com/google/sanitizers/issues/637
-// XFAIL: msan
+
// XFAIL: tsan
// Flaky errors in debuggerd with "waitpid returned unexpected pid (0)" in logcat.
@@ -33,7 +33,7 @@ struct sigaction original_sigaction_sigsegv;
void User_OnSIGSEGV(int signum, siginfo_t *siginfo, void *context) {
fprintf(stderr, "User sigaction called\n");
- struct sigaction original_sigaction;
+ struct sigaction original_sigaction = {};
if (signum == SIGBUS)
original_sigaction = original_sigaction_sigbus;
else if (signum == SIGSEGV)
@@ -58,7 +58,7 @@ int DoSEGV() {
}
bool InstallHandler(int signum, struct sigaction *original_sigaction) {
- struct sigaction user_sigaction;
+ struct sigaction user_sigaction = {};
user_sigaction.sa_sigaction = User_OnSIGSEGV;
user_sigaction.sa_flags = SA_SIGINFO;
if (sigaction(signum, &user_sigaction, original_sigaction)) {