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

Unified Diff: content/common/sandbox_win.cc

Issue 1140653002: 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, 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
« 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 915f145d0ff74500ab39c449e54f558985beb652..08f5dd91eb962afce5e995ae7bc5d81ad2921245 100644
--- a/content/common/sandbox_win.cc
+++ b/content/common/sandbox_win.cc
@@ -359,6 +359,26 @@ bool AddGenericPolicy(sandbox::TargetPolicy* policy) {
return false;
#endif
+#if defined(SANITIZER_COVERAGE)
+ DWORD coverage_dir_size =
+ ::GetEnvironmentVariable(L"SANITIZER_COVERAGE_DIR", NULL, 0);
+ if (coverage_dir_size == 0) {
+ LOG(WARNING) << "SANITIZER_COVERAGE_DIR was not set, coverage won't work.";
+ } else {
+ std::wstring coverage_dir(coverage_dir_size);
+ coverage_dir_size = ::GetEnvironmentVariable(
+ L"SANITIZER_COVERAGE_DIR", coverage_dir.data(), coverage_dir_size);
cpu_(ooo_6.6-7.5) 2015/05/12 00:53:56 lgtm, please use base's WriteInto() instead of 36
Reid Kleckner 2015/05/12 16:03:07 Sure. I felt like the CHECK was calling out the as
+ CHECK(coverage_dir.size() == coverage_dir_size);
+ base::FilePath sancov_path =
+ base::FilePath(coverage_dir).Append(L"*.sancov");
+ 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