| 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 | |
| 709 sandbox::MITIGATION_IMAGE_LOAD_NO_REMOTE | |
| 710 sandbox::MITIGATION_IMAGE_LOAD_NO_LOW_LABEL; |
| 706 | 711 |
| 707 if (policy->SetProcessMitigations(mitigations) != sandbox::SBOX_ALL_OK) | 712 if (policy->SetProcessMitigations(mitigations) != sandbox::SBOX_ALL_OK) |
| 708 return base::Process(); | 713 return base::Process(); |
| 709 | 714 |
| 710 #if !defined(NACL_WIN64) | 715 #if !defined(NACL_WIN64) |
| 711 if (type_str == switches::kRendererProcess && | 716 if (type_str == switches::kRendererProcess && |
| 712 IsWin32kRendererLockdownEnabled()) { | 717 IsWin32kRendererLockdownEnabled()) { |
| 713 if (!AddWin32kLockdownPolicy(policy)) | 718 if (!AddWin32kLockdownPolicy(policy)) |
| 714 return base::Process(); | 719 return base::Process(); |
| 715 } | 720 } |
| 716 #endif | 721 #endif |
| 717 | 722 |
| 723 // Post-startup mitigations. |
| 718 mitigations = sandbox::MITIGATION_STRICT_HANDLE_CHECKS | | 724 mitigations = sandbox::MITIGATION_STRICT_HANDLE_CHECKS | |
| 719 sandbox::MITIGATION_DLL_SEARCH_ORDER; | 725 sandbox::MITIGATION_DLL_SEARCH_ORDER; |
| 720 | 726 |
| 721 if (policy->SetDelayedProcessMitigations(mitigations) != sandbox::SBOX_ALL_OK) | 727 if (policy->SetDelayedProcessMitigations(mitigations) != sandbox::SBOX_ALL_OK) |
| 722 return base::Process(); | 728 return base::Process(); |
| 723 | 729 |
| 724 SetJobLevel(*cmd_line, sandbox::JOB_LOCKDOWN, 0, policy); | 730 SetJobLevel(*cmd_line, sandbox::JOB_LOCKDOWN, 0, policy); |
| 725 | 731 |
| 726 if (!delegate->DisableDefaultPolicy()) { | 732 if (!delegate->DisableDefaultPolicy()) { |
| 727 if (!AddPolicyForSandboxedProcess(policy)) | 733 if (!AddPolicyForSandboxedProcess(policy)) |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 859 } | 865 } |
| 860 | 866 |
| 861 return false; | 867 return false; |
| 862 } | 868 } |
| 863 | 869 |
| 864 bool BrokerAddTargetPeer(HANDLE peer_process) { | 870 bool BrokerAddTargetPeer(HANDLE peer_process) { |
| 865 return g_broker_services->AddTargetPeer(peer_process) == sandbox::SBOX_ALL_OK; | 871 return g_broker_services->AddTargetPeer(peer_process) == sandbox::SBOX_ALL_OK; |
| 866 } | 872 } |
| 867 | 873 |
| 868 } // namespace content | 874 } // namespace content |
| OLD | NEW |