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" |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 31 #include "content/public/common/dwrite_font_platform_win.h" | 31 #include "content/public/common/dwrite_font_platform_win.h" |
| 32 #include "content/public/common/sandbox_init.h" | 32 #include "content/public/common/sandbox_init.h" |
| 33 #include "content/public/common/sandboxed_process_launcher_delegate.h" | 33 #include "content/public/common/sandboxed_process_launcher_delegate.h" |
| 34 #include "sandbox/win/src/process_mitigations.h" | 34 #include "sandbox/win/src/process_mitigations.h" |
| 35 #include "sandbox/win/src/sandbox.h" | 35 #include "sandbox/win/src/sandbox.h" |
| 36 #include "sandbox/win/src/sandbox_nt_util.h" | 36 #include "sandbox/win/src/sandbox_nt_util.h" |
| 37 #include "sandbox/win/src/sandbox_policy_base.h" | 37 #include "sandbox/win/src/sandbox_policy_base.h" |
| 38 #include "sandbox/win/src/win_utils.h" | 38 #include "sandbox/win/src/win_utils.h" |
| 39 #include "ui/gfx/win/direct_write.h" | 39 #include "ui/gfx/win/direct_write.h" |
| 40 | 40 |
| 41 #if defined(OS_WIN) | |
|
brettw
2015/11/18 19:24:16
Ditto
| |
| 42 #include "base/win/win_util.h" | |
| 43 #endif | |
| 41 static sandbox::BrokerServices* g_broker_services = NULL; | 44 static sandbox::BrokerServices* g_broker_services = NULL; |
| 42 static sandbox::TargetServices* g_target_services = NULL; | 45 static sandbox::TargetServices* g_target_services = NULL; |
| 43 | 46 |
| 44 namespace content { | 47 namespace content { |
| 45 namespace { | 48 namespace { |
| 46 | 49 |
| 47 // The DLLs listed here are known (or under strong suspicion) of causing crashes | 50 // The DLLs listed here are known (or under strong suspicion) of causing crashes |
| 48 // when they are loaded in the renderer. Note: at runtime we generate short | 51 // when they are loaded in the renderer. Note: at runtime we generate short |
| 49 // versions of the dll name only if the dll has an extension. | 52 // versions of the dll name only if the dll has an extension. |
| 50 // For more information about how this list is generated, and how to get off | 53 // For more information about how this list is generated, and how to get off |
| (...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 738 // renderer process. This is needed because renderer processes on | 741 // renderer process. This is needed because renderer processes on |
| 739 // Windows 8+ may be running in an AppContainer sandbox and hence their | 742 // Windows 8+ may be running in an AppContainer sandbox and hence their |
| 740 // kernel object namespace may be partitioned. | 743 // kernel object namespace may be partitioned. |
| 741 std::string name(content::kFontCacheSharedSectionName); | 744 std::string name(content::kFontCacheSharedSectionName); |
| 742 name.append(base::UintToString(base::GetCurrentProcId())); | 745 name.append(base::UintToString(base::GetCurrentProcId())); |
| 743 | 746 |
| 744 base::SharedMemory direct_write_font_cache_section; | 747 base::SharedMemory direct_write_font_cache_section; |
| 745 if (direct_write_font_cache_section.Open(name, true)) { | 748 if (direct_write_font_cache_section.Open(name, true)) { |
| 746 void* shared_handle = policy->AddHandleToShare( | 749 void* shared_handle = policy->AddHandleToShare( |
| 747 direct_write_font_cache_section.handle().GetHandle()); | 750 direct_write_font_cache_section.handle().GetHandle()); |
| 748 cmd_line->AppendSwitchASCII(switches::kFontCacheSharedHandle, | 751 cmd_line->AppendSwitchASCII( |
| 749 base::UintToString(reinterpret_cast<unsigned int>(shared_handle))); | 752 switches::kFontCacheSharedHandle, |
| 753 base::UintToString(base::win::HandleToUint32(shared_handle))); | |
| 750 } | 754 } |
| 751 } | 755 } |
| 752 } | 756 } |
| 753 #endif | 757 #endif |
| 754 | 758 |
| 755 if (type_str != switches::kRendererProcess) { | 759 if (type_str != switches::kRendererProcess) { |
| 756 // Hack for Google Desktop crash. Trick GD into not injecting its DLL into | 760 // Hack for Google Desktop crash. Trick GD into not injecting its DLL into |
| 757 // this subprocess. See | 761 // this subprocess. See |
| 758 // http://code.google.com/p/chromium/issues/detail?id=25580 | 762 // http://code.google.com/p/chromium/issues/detail?id=25580 |
| 759 cmd_line->AppendSwitchASCII("ignored", " --type=renderer "); | 763 cmd_line->AppendSwitchASCII("ignored", " --type=renderer "); |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 851 } | 855 } |
| 852 | 856 |
| 853 return false; | 857 return false; |
| 854 } | 858 } |
| 855 | 859 |
| 856 bool BrokerAddTargetPeer(HANDLE peer_process) { | 860 bool BrokerAddTargetPeer(HANDLE peer_process) { |
| 857 return g_broker_services->AddTargetPeer(peer_process) == sandbox::SBOX_ALL_OK; | 861 return g_broker_services->AddTargetPeer(peer_process) == sandbox::SBOX_ALL_OK; |
| 858 } | 862 } |
| 859 | 863 |
| 860 } // namespace content | 864 } // namespace content |
| OLD | NEW |