Chromium Code Reviews| 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" |
| 11 #include "base/debug/profiler.h" | 11 #include "base/debug/profiler.h" |
| 12 #include "base/files/file_util.h" | 12 #include "base/files/file_util.h" |
| 13 #include "base/hash.h" | 13 #include "base/hash.h" |
| 14 #include "base/logging.h" | |
| 14 #include "base/memory/shared_memory.h" | 15 #include "base/memory/shared_memory.h" |
| 15 #include "base/metrics/sparse_histogram.h" | 16 #include "base/metrics/sparse_histogram.h" |
| 16 #include "base/path_service.h" | 17 #include "base/path_service.h" |
| 17 #include "base/process/launch.h" | 18 #include "base/process/launch.h" |
| 18 #include "base/strings/string_number_conversions.h" | 19 #include "base/strings/string_number_conversions.h" |
| 19 #include "base/strings/string_util.h" | 20 #include "base/strings/string_util.h" |
| 20 #include "base/strings/stringprintf.h" | 21 #include "base/strings/stringprintf.h" |
| 21 #include "base/trace_event/trace_event.h" | 22 #include "base/trace_event/trace_event.h" |
| 22 #include "base/win/iat_patch_function.h" | 23 #include "base/win/iat_patch_function.h" |
| 23 #include "base/win/scoped_handle.h" | 24 #include "base/win/scoped_handle.h" |
| (...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 734 exposed_files.value().c_str()); | 735 exposed_files.value().c_str()); |
| 735 if (result != sandbox::SBOX_ALL_OK) | 736 if (result != sandbox::SBOX_ALL_OK) |
| 736 return base::Process(); | 737 return base::Process(); |
| 737 } | 738 } |
| 738 | 739 |
| 739 if (!AddGenericPolicy(policy)) { | 740 if (!AddGenericPolicy(policy)) { |
| 740 NOTREACHED(); | 741 NOTREACHED(); |
| 741 return base::Process(); | 742 return base::Process(); |
| 742 } | 743 } |
| 743 | 744 |
| 745 // Allow the renderer and gpu processes to access the log file. | |
| 746 if (type_str == switches::kRendererProcess || | |
| 747 type_str == switches::kGpuProcess) { | |
| 748 if (logging::IsLoggingToFileEnabled()) { | |
| 749 policy->AddRule(sandbox::TargetPolicy::SUBSYS_FILES, | |
| 750 sandbox::TargetPolicy::FILES_ALLOW_ANY, | |
| 751 logging::GetLogFileFullPath().c_str()); | |
|
scottmg
2015/09/16 23:30:47
is it ok if this path is relative?
ananta
2015/09/16 23:49:38
It will not be relative in this patch. It is updat
| |
| 752 } | |
| 753 } | |
| 754 | |
| 744 #if !defined(OFFICIAL_BUILD) | 755 #if !defined(OFFICIAL_BUILD) |
| 745 // If stdout/stderr point to a Windows console, these calls will | 756 // If stdout/stderr point to a Windows console, these calls will |
| 746 // have no effect. | 757 // have no effect. |
| 747 policy->SetStdoutHandle(GetStdHandle(STD_OUTPUT_HANDLE)); | 758 policy->SetStdoutHandle(GetStdHandle(STD_OUTPUT_HANDLE)); |
| 748 policy->SetStderrHandle(GetStdHandle(STD_ERROR_HANDLE)); | 759 policy->SetStderrHandle(GetStdHandle(STD_ERROR_HANDLE)); |
| 749 #endif | 760 #endif |
| 750 | 761 |
| 751 if (delegate) { | 762 if (delegate) { |
| 752 bool success = true; | 763 bool success = true; |
| 753 delegate->PreSpawnTarget(policy, &success); | 764 delegate->PreSpawnTarget(policy, &success); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 827 } | 838 } |
| 828 | 839 |
| 829 return false; | 840 return false; |
| 830 } | 841 } |
| 831 | 842 |
| 832 bool BrokerAddTargetPeer(HANDLE peer_process) { | 843 bool BrokerAddTargetPeer(HANDLE peer_process) { |
| 833 return g_broker_services->AddTargetPeer(peer_process) == sandbox::SBOX_ALL_OK; | 844 return g_broker_services->AddTargetPeer(peer_process) == sandbox::SBOX_ALL_OK; |
| 834 } | 845 } |
| 835 | 846 |
| 836 } // namespace content | 847 } // namespace content |
| OLD | NEW |