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/logging.h" |
15 #include "base/memory/shared_memory.h" | 15 #include "base/memory/shared_memory.h" |
16 #include "base/metrics/field_trial.h" | 16 #include "base/metrics/field_trial.h" |
17 #include "base/metrics/sparse_histogram.h" | 17 #include "base/metrics/sparse_histogram.h" |
18 #include "base/path_service.h" | 18 #include "base/path_service.h" |
19 #include "base/process/launch.h" | 19 #include "base/process/launch.h" |
20 #include "base/strings/string_number_conversions.h" | 20 #include "base/strings/string_number_conversions.h" |
21 #include "base/strings/string_util.h" | 21 #include "base/strings/string_util.h" |
22 #include "base/strings/stringprintf.h" | 22 #include "base/strings/stringprintf.h" |
23 #include "base/trace_event/trace_event.h" | 23 #include "base/trace_event/trace_event.h" |
24 #include "base/win/iat_patch_function.h" | 24 #include "base/win/iat_patch_function.h" |
25 #include "base/win/scoped_handle.h" | 25 #include "base/win/scoped_handle.h" |
26 #include "base/win/scoped_process_information.h" | 26 #include "base/win/scoped_process_information.h" |
| 27 #include "base/win/win_util.h" |
27 #include "base/win/windows_version.h" | 28 #include "base/win/windows_version.h" |
28 #include "content/common/content_switches_internal.h" | 29 #include "content/common/content_switches_internal.h" |
29 #include "content/public/common/content_client.h" | 30 #include "content/public/common/content_client.h" |
30 #include "content/public/common/content_switches.h" | 31 #include "content/public/common/content_switches.h" |
31 #include "content/public/common/dwrite_font_platform_win.h" | 32 #include "content/public/common/dwrite_font_platform_win.h" |
32 #include "content/public/common/sandbox_init.h" | 33 #include "content/public/common/sandbox_init.h" |
33 #include "content/public/common/sandboxed_process_launcher_delegate.h" | 34 #include "content/public/common/sandboxed_process_launcher_delegate.h" |
34 #include "sandbox/win/src/process_mitigations.h" | 35 #include "sandbox/win/src/process_mitigations.h" |
35 #include "sandbox/win/src/sandbox.h" | 36 #include "sandbox/win/src/sandbox.h" |
36 #include "sandbox/win/src/sandbox_nt_util.h" | 37 #include "sandbox/win/src/sandbox_nt_util.h" |
(...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
736 // renderer process. This is needed because renderer processes on | 737 // renderer process. This is needed because renderer processes on |
737 // Windows 8+ may be running in an AppContainer sandbox and hence their | 738 // Windows 8+ may be running in an AppContainer sandbox and hence their |
738 // kernel object namespace may be partitioned. | 739 // kernel object namespace may be partitioned. |
739 std::string name(content::kFontCacheSharedSectionName); | 740 std::string name(content::kFontCacheSharedSectionName); |
740 name.append(base::UintToString(base::GetCurrentProcId())); | 741 name.append(base::UintToString(base::GetCurrentProcId())); |
741 | 742 |
742 base::SharedMemory direct_write_font_cache_section; | 743 base::SharedMemory direct_write_font_cache_section; |
743 if (direct_write_font_cache_section.Open(name, true)) { | 744 if (direct_write_font_cache_section.Open(name, true)) { |
744 void* shared_handle = policy->AddHandleToShare( | 745 void* shared_handle = policy->AddHandleToShare( |
745 direct_write_font_cache_section.handle().GetHandle()); | 746 direct_write_font_cache_section.handle().GetHandle()); |
746 cmd_line->AppendSwitchASCII(switches::kFontCacheSharedHandle, | 747 cmd_line->AppendSwitchASCII( |
747 base::UintToString(reinterpret_cast<unsigned int>(shared_handle))); | 748 switches::kFontCacheSharedHandle, |
| 749 base::UintToString(base::win::HandleToUint32(shared_handle))); |
748 } | 750 } |
749 } | 751 } |
750 } | 752 } |
751 #endif | 753 #endif |
752 | 754 |
753 if (type_str != switches::kRendererProcess) { | 755 if (type_str != switches::kRendererProcess) { |
754 // Hack for Google Desktop crash. Trick GD into not injecting its DLL into | 756 // Hack for Google Desktop crash. Trick GD into not injecting its DLL into |
755 // this subprocess. See | 757 // this subprocess. See |
756 // http://code.google.com/p/chromium/issues/detail?id=25580 | 758 // http://code.google.com/p/chromium/issues/detail?id=25580 |
757 cmd_line->AppendSwitchASCII("ignored", " --type=renderer "); | 759 cmd_line->AppendSwitchASCII("ignored", " --type=renderer "); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
849 } | 851 } |
850 | 852 |
851 return false; | 853 return false; |
852 } | 854 } |
853 | 855 |
854 bool BrokerAddTargetPeer(HANDLE peer_process) { | 856 bool BrokerAddTargetPeer(HANDLE peer_process) { |
855 return g_broker_services->AddTargetPeer(peer_process) == sandbox::SBOX_ALL_OK; | 857 return g_broker_services->AddTargetPeer(peer_process) == sandbox::SBOX_ALL_OK; |
856 } | 858 } |
857 | 859 |
858 } // namespace content | 860 } // namespace content |
OLD | NEW |