Commit 1ffd85df authored by jln@chromium.org's avatar jln@chromium.org

TSANv2: disable non sandbox-related threading checks under TSAN.

Allow Chromium to start under TSAN by removing the threading checks
before fork() in that environment.

Note that TSANv2 doesn't reliably support non-spawn fork() for now:
https://code.google.com/p/thread-sanitizer/issues/detail?id=44

But at least this allows using it on Chrome despite risks of running
into deadlocks.

NOTRY=true

Review URL: https://codereview.chromium.org/130423014

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@247708 0039d316-1c4b-4281-b951-d872f2087c98
parent 1a064769
...@@ -709,12 +709,12 @@ void RenderSandboxHostLinux::Init(const std::string& sandbox_path) { ...@@ -709,12 +709,12 @@ void RenderSandboxHostLinux::Init(const std::string& sandbox_path) {
childs_lifeline_fd_ = pipefds[1]; childs_lifeline_fd_ = pipefds[1];
// We need to be monothreaded before we fork(). // We need to be monothreaded before we fork().
#if !defined(TOOLKIT_GTK) #if !defined(TOOLKIT_GTK) && !defined(THREAD_SANITIZER)
// Exclude gtk port as TestSuite in base/tests/test_suite.cc is calling // Exclude gtk port as TestSuite in base/tests/test_suite.cc is calling
// gtk_init. // gtk_init.
// TODO(oshima): Remove ifdef when above issues are resolved. // TODO(oshima): Remove ifdef when above issues are resolved.
DCHECK_EQ(1, base::GetNumberOfThreads(base::GetCurrentProcessHandle())); DCHECK_EQ(1, base::GetNumberOfThreads(base::GetCurrentProcessHandle()));
#endif #endif // !defined(TOOLKIT_GTK) && !defined(THREAD_SANITIZER)
pid_ = fork(); pid_ = fork();
if (pid_ == 0) { if (pid_ == 0) {
if (IGNORE_EINTR(close(fds[0])) < 0) if (IGNORE_EINTR(close(fds[0])) < 0)
......
...@@ -332,7 +332,9 @@ static bool EnterSuidSandbox(LinuxSandbox* linux_sandbox, ...@@ -332,7 +332,9 @@ static bool EnterSuidSandbox(LinuxSandbox* linux_sandbox,
PreSandboxInit(); PreSandboxInit();
// Check that the pre-sandbox initialization didn't spawn threads. // Check that the pre-sandbox initialization didn't spawn threads.
#if !defined(THREAD_SANITIZER)
DCHECK(linux_sandbox->IsSingleThreaded()); DCHECK(linux_sandbox->IsSingleThreaded());
#endif
if (setuid_sandbox->IsSuidSandboxChild()) { if (setuid_sandbox->IsSuidSandboxChild()) {
// Use the SUID sandbox. This still allows the seccomp sandbox to // Use the SUID sandbox. This still allows the seccomp sandbox to
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment