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

Unified Diff: content/common/sandbox_win.cc

Issue 1113013003: Allow sanitizer coverage to create *.sancov files when sandboxed (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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/sandbox_win.cc
diff --git a/content/common/sandbox_win.cc b/content/common/sandbox_win.cc
index 8398b798d06080dd6cd0e9281ad07005c95b49a8..1966145c36f5ccd0df877779eb8a6cedf2e24aac 100644
--- a/content/common/sandbox_win.cc
+++ b/content/common/sandbox_win.cc
@@ -9,6 +9,7 @@
#include "base/base_switches.h"
#include "base/command_line.h"
#include "base/debug/profiler.h"
+#include "base/environment.h"
#include "base/files/file_util.h"
#include "base/hash.h"
#include "base/metrics/sparse_histogram.h"
@@ -16,6 +17,7 @@
#include "base/process/launch.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
+#include "base/strings/utf_string_conversions.h"
#include "base/trace_event/trace_event.h"
#include "base/win/iat_patch_function.h"
#include "base/win/scoped_handle.h"
@@ -356,6 +358,23 @@ bool AddGenericPolicy(sandbox::TargetPolicy* policy) {
return false;
#endif
+#if defined(SANITIZER_COVERAGE)
+ scoped_ptr<base::Environment> env(base::Environment::Create());
+ std::string coverage_dir;
+ if (!env->GetVar("SANITIZER_COVERAGE_DIR", &coverage_dir)) {
+ LOG(WARNING) << "SANITIZER_COVERAGE_DIR was not set, coverage won't work.";
+ } else {
+ base::FilePath sancov_path =
+ base::FilePath(base::UTF16ToWide(base::ASCIIToUTF16(coverage_dir)))
+ .Append(L"*.sancov");
cpu_(ooo_6.6-7.5) 2015/05/01 17:18:58 use the native environment function so you don't h
+ result = policy->AddRule(sandbox::TargetPolicy::SUBSYS_FILES,
+ sandbox::TargetPolicy::FILES_ALLOW_ANY,
+ sancov_path.value().c_str());
+ if (result != sandbox::SBOX_ALL_OK)
+ return false;
+ }
+#endif
+
AddGenericDllEvictionPolicy(policy);
return true;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698