Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(444)

Unified Diff: sandbox/linux/services/syscall_wrappers.cc

Issue 1103263003: Re-enable Trap.SigSysAction test under tsan. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sandbox/linux/seccomp-bpf/trap_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sandbox/linux/services/syscall_wrappers.cc
diff --git a/sandbox/linux/services/syscall_wrappers.cc b/sandbox/linux/services/syscall_wrappers.cc
index fdfcb94a8c403a15767446679ee503a49229ff23..a84d3299371ebe2ffcefda39a01fe3955f0345f7 100644
--- a/sandbox/linux/services/syscall_wrappers.cc
+++ b/sandbox/linux/services/syscall_wrappers.cc
@@ -148,18 +148,25 @@ int sys_sigprocmask(int how, const sigset_t* set, decltype(nullptr) oldset) {
sizeof(linux_value));
}
-#if defined(MEMORY_SANITIZER) || \
- (defined(ARCH_CPU_X86_64) && defined(__GNUC__) && !defined(__clang__))
-// If MEMORY_SANITIZER is enabled, it is necessary to call sigaction() here,
-// rather than the direct syscall (sys_sigaction() defined by ourselves).
-// It is because, if MEMORY_SANITIZER is enabled, sigaction is wrapped, and
-// |act->sa_handler| is injected in order to unpoisonize the memory passed via
-// callback's arguments. Please see msan_interceptors.cc for more details.
-// So, if the direct syscall is used, as MEMORY_SANITIZER does not know about
-// it, sigaction() invocation in other places would be broken (in more precise,
-// returned |oldact| would have a broken |sa_handler| callback).
+#if defined(MEMORY_SANITIZER) || defined(THREAD_SANITIZER) || \
+ (defined(ARCH_CPU_X86_64) && !defined(__clang__))
+// If MEMORY_SANITIZER or THREAD_SANITIZER is enabled, it is necessary to call
+// sigaction() here, rather than the direct syscall (sys_sigaction() defined
+// by ourselves).
+// It is because, if MEMORY_SANITIZER or THREAD_SANITIZER is enabled, sigaction
+// is wrapped, and |act->sa_handler| is injected in order to unpoisonize the
+// memory passed via callback's arguments for MEMORY_SANITIZER, or handle
+// signals to check thread consistency for THREAD_SANITIZER. Please see
+// msan_interceptors.cc and tsan_interceptors.cc for more details.
+// So, specifically, if MEMORY_SANITIZER is enabled while the direct syscall is
+// used, as MEMORY_SANITIZER does not know about it, sigaction() invocation in
+// other places would be broken (in more precise, returned |oldact| would have
+// a broken |sa_handler| callback).
// Practically, it would break NaCl's signal handler installation.
// cf) native_client/src/trusted/service_runtime/linux/nacl_signal.c.
+// As for THREAD_SANITIZER, the intercepted signal handlers are processed more
+// in other libc functions' interceptors (such as for raise()), so that it
+// would not work properly.
//
// Also on x86_64 architecture, we need naked function for rt_sigreturn.
// However, there is no simple way to define it with GCC. Note that the body
« no previous file with comments | « sandbox/linux/seccomp-bpf/trap_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698