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

Unified Diff: content/common/sandbox_linux/sandbox_linux.cc

Issue 280303002: Add sandbox support for AsanCoverage. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: helper exits on 0 bytes received, zygote waits on it Created 6 years, 7 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
Index: content/common/sandbox_linux/sandbox_linux.cc
diff --git a/content/common/sandbox_linux/sandbox_linux.cc b/content/common/sandbox_linux/sandbox_linux.cc
index 237cc89deb9947af3d96fe8753e641a7c907f07a..37ebae7c8f7029c362839ee7effb2472e78529bc 100644
--- a/content/common/sandbox_linux/sandbox_linux.cc
+++ b/content/common/sandbox_linux/sandbox_linux.cc
@@ -34,6 +34,11 @@
#include "sandbox/linux/services/yama.h"
#include "sandbox/linux/suid/client/setuid_sandbox_client.h"
+#if defined(ADDRESS_SANITIZER) || defined(MEMORY_SANITIZER) || \
+ defined(LEAK_SANITIZER)
+#include <sanitizer/common_interface_defs.h>
+#endif
+
using sandbox::Yama;
namespace {
@@ -109,10 +114,16 @@ LinuxSandbox::LinuxSandbox()
pre_initialized_(false),
seccomp_bpf_supported_(false),
yama_is_enforcing_(false),
- setuid_sandbox_client_(sandbox::SetuidSandboxClient::Create()) {
+ setuid_sandbox_client_(sandbox::SetuidSandboxClient::Create())
+{
if (setuid_sandbox_client_ == NULL) {
LOG(FATAL) << "Failed to instantiate the setuid sandbox client.";
}
+#if defined(ADDRESS_SANITIZER) || defined(MEMORY_SANITIZER) || \
+ defined(LEAK_SANITIZER)
+ sanitizer_args_ = make_scoped_ptr(new __sanitizer_sandbox_arguments);
+ *sanitizer_args_ = {0};
+#endif
}
LinuxSandbox::~LinuxSandbox() {
@@ -124,20 +135,15 @@ LinuxSandbox* LinuxSandbox::GetInstance() {
return instance;
}
-#if (defined(ADDRESS_SANITIZER) || defined(MEMORY_SANITIZER) || \
- defined(LEAK_SANITIZER)) && defined(OS_LINUX)
-// Sanitizer API call to notify the tool the sandbox is going to be turned on.
-extern "C" void __sanitizer_sandbox_on_notify(void *reserved);
-#endif
-
void LinuxSandbox::PreinitializeSandbox() {
CHECK(!pre_initialized_);
seccomp_bpf_supported_ = false;
-#if (defined(ADDRESS_SANITIZER) || defined(MEMORY_SANITIZER) || \
- defined(LEAK_SANITIZER)) && defined(OS_LINUX)
+#if defined(ADDRESS_SANITIZER) || defined(MEMORY_SANITIZER) || \
+ defined(LEAK_SANITIZER)
// Sanitizers need to open some resources before the sandbox is enabled.
// This should not fork, not launch threads, not open a directory.
- __sanitizer_sandbox_on_notify(/*reserved*/ NULL);
+ __sanitizer_sandbox_on_notify(sanitizer_args());
+ sanitizer_args_.reset();
#endif
#if !defined(NDEBUG)

Powered by Google App Engine
This is Rietveld 408576698