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 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
691 cmd_line->HasSwitch(switches::kNoSandbox)) { | 691 cmd_line->HasSwitch(switches::kNoSandbox)) { |
692 base::Process process = | 692 base::Process process = |
693 base::LaunchProcess(*cmd_line, base::LaunchOptions()); | 693 base::LaunchProcess(*cmd_line, base::LaunchOptions()); |
694 // TODO(rvargas) crbug.com/417532: Don't share a raw handle. | 694 // TODO(rvargas) crbug.com/417532: Don't share a raw handle. |
695 g_broker_services->AddTargetPeer(process.Handle()); | 695 g_broker_services->AddTargetPeer(process.Handle()); |
696 return process.Pass(); | 696 return process.Pass(); |
697 } | 697 } |
698 | 698 |
699 sandbox::TargetPolicy* policy = g_broker_services->CreatePolicy(); | 699 sandbox::TargetPolicy* policy = g_broker_services->CreatePolicy(); |
700 | 700 |
701 sandbox::MitigationFlags mitigations = sandbox::MITIGATION_HEAP_TERMINATE | | 701 // Pre-startup mitigations. |
702 sandbox::MITIGATION_BOTTOM_UP_ASLR | | 702 sandbox::MitigationFlags mitigations = |
703 sandbox::MITIGATION_DEP | | 703 sandbox::MITIGATION_HEAP_TERMINATE | |
704 sandbox::MITIGATION_DEP_NO_ATL_THUNK | | 704 sandbox::MITIGATION_BOTTOM_UP_ASLR | |
705 sandbox::MITIGATION_SEHOP; | 705 sandbox::MITIGATION_DEP | |
706 sandbox::MITIGATION_DEP_NO_ATL_THUNK | | |
707 sandbox::MITIGATION_SEHOP | | |
708 sandbox::MITIGATION_NONSYSTEM_FONT_DISABLE | | |
jschuh
2016/01/25 23:53:51
This will break the GDI path, which some people ar
penny
2016/01/26 22:37:09
Acknowledged. I was not aware of this at all, tha
| |
709 sandbox::MITIGATION_IMAGE_LOAD_NO_REMOTE | | |
710 sandbox::MITIGATION_IMAGE_LOAD_NO_LOW_LABEL | | |
711 sandbox::MITIGATION_CHILD_PROCESS_CREATION_RESTRICTED; | |
706 | 712 |
707 if (policy->SetProcessMitigations(mitigations) != sandbox::SBOX_ALL_OK) | 713 if (policy->SetProcessMitigations(mitigations) != sandbox::SBOX_ALL_OK) |
708 return base::Process(); | 714 return base::Process(); |
709 | 715 |
710 #if !defined(NACL_WIN64) | 716 #if !defined(NACL_WIN64) |
711 if (type_str == switches::kRendererProcess && | 717 if (type_str == switches::kRendererProcess && |
712 IsWin32kRendererLockdownEnabled()) { | 718 IsWin32kRendererLockdownEnabled()) { |
713 if (!AddWin32kLockdownPolicy(policy)) | 719 if (!AddWin32kLockdownPolicy(policy)) |
714 return base::Process(); | 720 return base::Process(); |
715 } | 721 } |
716 #endif | 722 #endif |
717 | 723 |
724 // Post-startup mitigations. | |
718 mitigations = sandbox::MITIGATION_STRICT_HANDLE_CHECKS | | 725 mitigations = sandbox::MITIGATION_STRICT_HANDLE_CHECKS | |
719 sandbox::MITIGATION_DLL_SEARCH_ORDER; | 726 sandbox::MITIGATION_DLL_SEARCH_ORDER; |
720 | 727 |
721 if (policy->SetDelayedProcessMitigations(mitigations) != sandbox::SBOX_ALL_OK) | 728 if (policy->SetDelayedProcessMitigations(mitigations) != sandbox::SBOX_ALL_OK) |
722 return base::Process(); | 729 return base::Process(); |
723 | 730 |
724 SetJobLevel(*cmd_line, sandbox::JOB_LOCKDOWN, 0, policy); | 731 SetJobLevel(*cmd_line, sandbox::JOB_LOCKDOWN, 0, policy); |
725 | 732 |
726 if (!delegate->DisableDefaultPolicy()) { | 733 if (!delegate->DisableDefaultPolicy()) { |
727 if (!AddPolicyForSandboxedProcess(policy)) | 734 if (!AddPolicyForSandboxedProcess(policy)) |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
859 } | 866 } |
860 | 867 |
861 return false; | 868 return false; |
862 } | 869 } |
863 | 870 |
864 bool BrokerAddTargetPeer(HANDLE peer_process) { | 871 bool BrokerAddTargetPeer(HANDLE peer_process) { |
865 return g_broker_services->AddTargetPeer(peer_process) == sandbox::SBOX_ALL_OK; | 872 return g_broker_services->AddTargetPeer(peer_process) == sandbox::SBOX_ALL_OK; |
866 } | 873 } |
867 | 874 |
868 } // namespace content | 875 } // namespace content |
OLD | NEW |