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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/common/sandbox_win.h" 5 #include "content/common/sandbox_win.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/base_switches.h" 9 #include "base/base_switches.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 if (!PathService::Get(base::FILE_EXE, &exe)) 352 if (!PathService::Get(base::FILE_EXE, &exe))
353 return false; 353 return false;
354 base::FilePath pdb_path = exe.DirName().Append(L"*.pdb"); 354 base::FilePath pdb_path = exe.DirName().Append(L"*.pdb");
355 result = policy->AddRule(sandbox::TargetPolicy::SUBSYS_FILES, 355 result = policy->AddRule(sandbox::TargetPolicy::SUBSYS_FILES,
356 sandbox::TargetPolicy::FILES_ALLOW_READONLY, 356 sandbox::TargetPolicy::FILES_ALLOW_READONLY,
357 pdb_path.value().c_str()); 357 pdb_path.value().c_str());
358 if (result != sandbox::SBOX_ALL_OK) 358 if (result != sandbox::SBOX_ALL_OK)
359 return false; 359 return false;
360 #endif 360 #endif
361 361
362 #if defined(SANITIZER_COVERAGE)
363 DWORD coverage_dir_size =
364 ::GetEnvironmentVariable(L"SANITIZER_COVERAGE_DIR", NULL, 0);
365 if (coverage_dir_size == 0) {
366 LOG(WARNING) << "SANITIZER_COVERAGE_DIR was not set, coverage won't work.";
367 } else {
368 std::wstring coverage_dir(coverage_dir_size);
369 coverage_dir_size = ::GetEnvironmentVariable(
370 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
371 CHECK(coverage_dir.size() == coverage_dir_size);
372 base::FilePath sancov_path =
373 base::FilePath(coverage_dir).Append(L"*.sancov");
374 result = policy->AddRule(sandbox::TargetPolicy::SUBSYS_FILES,
375 sandbox::TargetPolicy::FILES_ALLOW_ANY,
376 sancov_path.value().c_str());
377 if (result != sandbox::SBOX_ALL_OK)
378 return false;
379 }
380 #endif
381
362 AddGenericDllEvictionPolicy(policy); 382 AddGenericDllEvictionPolicy(policy);
363 return true; 383 return true;
364 } 384 }
365 385
366 bool AddPolicyForSandboxedProcess(sandbox::TargetPolicy* policy) { 386 bool AddPolicyForSandboxedProcess(sandbox::TargetPolicy* policy) {
367 sandbox::ResultCode result; 387 sandbox::ResultCode result;
368 // Renderers need to share events with plugins. 388 // Renderers need to share events with plugins.
369 result = policy->AddRule(sandbox::TargetPolicy::SUBSYS_HANDLES, 389 result = policy->AddRule(sandbox::TargetPolicy::SUBSYS_HANDLES,
370 sandbox::TargetPolicy::HANDLES_DUP_ANY, 390 sandbox::TargetPolicy::HANDLES_DUP_ANY,
371 L"Event"); 391 L"Event");
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
812 } 832 }
813 833
814 return false; 834 return false;
815 } 835 }
816 836
817 bool BrokerAddTargetPeer(HANDLE peer_process) { 837 bool BrokerAddTargetPeer(HANDLE peer_process) {
818 return g_broker_services->AddTargetPeer(peer_process) == sandbox::SBOX_ALL_OK; 838 return g_broker_services->AddTargetPeer(peer_process) == sandbox::SBOX_ALL_OK;
819 } 839 }
820 840
821 } // namespace content 841 } // namespace content
OLDNEW
« 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