OLD | NEW |
---|---|
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 Loading... | |
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 Loading... | |
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 |
OLD | NEW |