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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
696 // Pre-startup mitigations. | 696 // Pre-startup mitigations. |
697 sandbox::MitigationFlags mitigations = | 697 sandbox::MitigationFlags mitigations = |
698 sandbox::MITIGATION_HEAP_TERMINATE | | 698 sandbox::MITIGATION_HEAP_TERMINATE | |
699 sandbox::MITIGATION_BOTTOM_UP_ASLR | | 699 sandbox::MITIGATION_BOTTOM_UP_ASLR | |
700 sandbox::MITIGATION_DEP | | 700 sandbox::MITIGATION_DEP | |
701 sandbox::MITIGATION_DEP_NO_ATL_THUNK | | 701 sandbox::MITIGATION_DEP_NO_ATL_THUNK | |
702 sandbox::MITIGATION_SEHOP | | 702 sandbox::MITIGATION_SEHOP | |
703 sandbox::MITIGATION_NONSYSTEM_FONT_DISABLE | | 703 sandbox::MITIGATION_NONSYSTEM_FONT_DISABLE | |
704 sandbox::MITIGATION_IMAGE_LOAD_NO_REMOTE | | 704 sandbox::MITIGATION_IMAGE_LOAD_NO_REMOTE | |
705 sandbox::MITIGATION_IMAGE_LOAD_NO_LOW_LABEL; | 705 sandbox::MITIGATION_IMAGE_LOAD_NO_LOW_LABEL; |
706 | 706 |
jschuh
2016/02/22 22:30:25
Strike MITIGATION_NONSYSTEM_FONT_DISABLE in the de
penny
2016/02/23 05:30:37
Done. I'm fairly sure it needs to be wrapped in "
Will Harris
2016/02/23 05:46:02
yes it does - since direct_write.cc isn't compiled
| |
707 if (policy->SetProcessMitigations(mitigations) != sandbox::SBOX_ALL_OK) | 707 if (policy->SetProcessMitigations(mitigations) != sandbox::SBOX_ALL_OK) |
708 return base::Process(); | 708 return base::Process(); |
709 | 709 |
710 #if !defined(NACL_WIN64) | 710 #if !defined(NACL_WIN64) |
711 if (type_str == switches::kRendererProcess && | 711 if (type_str == switches::kRendererProcess && |
712 IsWin32kRendererLockdownEnabled()) { | 712 IsWin32kRendererLockdownEnabled()) { |
713 if (!AddWin32kLockdownPolicy(policy)) | 713 if (!AddWin32kLockdownPolicy(policy)) |
714 return base::Process(); | 714 return base::Process(); |
715 } | 715 } |
716 #endif | 716 #endif |
(...skipping 15 matching lines...) Expand all Loading... | |
732 #if !defined(NACL_WIN64) | 732 #if !defined(NACL_WIN64) |
733 if (type_str == switches::kRendererProcess || | 733 if (type_str == switches::kRendererProcess || |
734 type_str == switches::kPpapiPluginProcess) { | 734 type_str == switches::kPpapiPluginProcess) { |
735 if (gfx::win::ShouldUseDirectWrite()) { | 735 if (gfx::win::ShouldUseDirectWrite()) { |
736 AddDirectory(base::DIR_WINDOWS_FONTS, | 736 AddDirectory(base::DIR_WINDOWS_FONTS, |
737 NULL, | 737 NULL, |
738 true, | 738 true, |
739 sandbox::TargetPolicy::FILES_ALLOW_READONLY, | 739 sandbox::TargetPolicy::FILES_ALLOW_READONLY, |
740 policy); | 740 policy); |
741 | 741 |
742 // Turn off the MITIGATION_NONSYSTEM_FONT_DISABLE mitigation | |
743 // when Direct Write is enabled. | |
jschuh
2016/02/22 22:30:24
I think this is backward. Don't you want to enable
penny
2016/02/23 05:30:37
Done.
| |
744 sandbox::MitigationFlags temp = | |
745 ~sandbox::MITIGATION_NONSYSTEM_FONT_DISABLE; | |
746 mitigations = policy->GetProcessMitigations(); | |
747 mitigations &= temp; | |
748 if (policy->SetProcessMitigations(mitigations) != sandbox::SBOX_ALL_OK) | |
749 return base::Process(); | |
750 | |
742 if (!ShouldUseDirectWriteFontProxyFieldTrial()) { | 751 if (!ShouldUseDirectWriteFontProxyFieldTrial()) { |
743 // If DirectWrite is enabled for font rendering then open the font | 752 // If DirectWrite is enabled for font rendering then open the font |
744 // cache section which is created by the browser and pass the handle to | 753 // cache section which is created by the browser and pass the handle to |
745 // the renderer process. This is needed because renderer processes on | 754 // the renderer process. This is needed because renderer processes on |
746 // Windows 8+ may be running in an AppContainer sandbox and hence their | 755 // Windows 8+ may be running in an AppContainer sandbox and hence their |
747 // kernel object namespace may be partitioned. | 756 // kernel object namespace may be partitioned. |
748 std::string name(content::kFontCacheSharedSectionName); | 757 std::string name(content::kFontCacheSharedSectionName); |
749 name.append(base::UintToString(base::GetCurrentProcId())); | 758 name.append(base::UintToString(base::GetCurrentProcId())); |
750 | 759 |
751 base::SharedMemory direct_write_font_cache_section; | 760 base::SharedMemory direct_write_font_cache_section; |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
860 } | 869 } |
861 | 870 |
862 return false; | 871 return false; |
863 } | 872 } |
864 | 873 |
865 bool BrokerAddTargetPeer(HANDLE peer_process) { | 874 bool BrokerAddTargetPeer(HANDLE peer_process) { |
866 return g_broker_services->AddTargetPeer(peer_process) == sandbox::SBOX_ALL_OK; | 875 return g_broker_services->AddTargetPeer(peer_process) == sandbox::SBOX_ALL_OK; |
867 } | 876 } |
868 | 877 |
869 } // namespace content | 878 } // namespace content |
OLD | NEW |