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) |
| 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 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
740 // renderer process. This is needed because renderer processes on | 743 // renderer process. This is needed because renderer processes on |
741 // Windows 8+ may be running in an AppContainer sandbox and hence their | 744 // Windows 8+ may be running in an AppContainer sandbox and hence their |
742 // kernel object namespace may be partitioned. | 745 // kernel object namespace may be partitioned. |
743 std::string name(content::kFontCacheSharedSectionName); | 746 std::string name(content::kFontCacheSharedSectionName); |
744 name.append(base::UintToString(base::GetCurrentProcId())); | 747 name.append(base::UintToString(base::GetCurrentProcId())); |
745 | 748 |
746 base::SharedMemory direct_write_font_cache_section; | 749 base::SharedMemory direct_write_font_cache_section; |
747 if (direct_write_font_cache_section.Open(name, true)) { | 750 if (direct_write_font_cache_section.Open(name, true)) { |
748 void* shared_handle = policy->AddHandleToShare( | 751 void* shared_handle = policy->AddHandleToShare( |
749 direct_write_font_cache_section.handle().GetHandle()); | 752 direct_write_font_cache_section.handle().GetHandle()); |
750 cmd_line->AppendSwitchASCII(switches::kFontCacheSharedHandle, | 753 cmd_line->AppendSwitchASCII( |
751 base::UintToString(reinterpret_cast<unsigned int>(shared_handle))); | 754 switches::kFontCacheSharedHandle, |
| 755 base::UintToString(base::win::HandleToUint32(shared_handle))); |
752 } | 756 } |
753 } | 757 } |
754 } | 758 } |
755 #endif | 759 #endif |
756 | 760 |
757 if (type_str != switches::kRendererProcess) { | 761 if (type_str != switches::kRendererProcess) { |
758 // Hack for Google Desktop crash. Trick GD into not injecting its DLL into | 762 // Hack for Google Desktop crash. Trick GD into not injecting its DLL into |
759 // this subprocess. See | 763 // this subprocess. See |
760 // http://code.google.com/p/chromium/issues/detail?id=25580 | 764 // http://code.google.com/p/chromium/issues/detail?id=25580 |
761 cmd_line->AppendSwitchASCII("ignored", " --type=renderer "); | 765 cmd_line->AppendSwitchASCII("ignored", " --type=renderer "); |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
877 } | 881 } |
878 | 882 |
879 return false; | 883 return false; |
880 } | 884 } |
881 | 885 |
882 bool BrokerAddTargetPeer(HANDLE peer_process) { | 886 bool BrokerAddTargetPeer(HANDLE peer_process) { |
883 return g_broker_services->AddTargetPeer(peer_process) == sandbox::SBOX_ALL_OK; | 887 return g_broker_services->AddTargetPeer(peer_process) == sandbox::SBOX_ALL_OK; |
884 } | 888 } |
885 | 889 |
886 } // namespace content | 890 } // namespace content |
OLD | NEW |