Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(93)

Side by Side Diff: content/common/sandbox_win.cc

Issue 1626623003: [Win10 sandbox mitigations] Four new Win10 mitigations added. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Code review changes, part 5. "Fix the nit." Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/win/windows_version.cc ('k') | sandbox/win/src/broker_services.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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;
706 708
707 if (policy->SetProcessMitigations(mitigations) != sandbox::SBOX_ALL_OK) 709 if (policy->SetProcessMitigations(mitigations) != sandbox::SBOX_ALL_OK)
708 return base::Process(); 710 return base::Process();
709 711
710 #if !defined(NACL_WIN64) 712 #if !defined(NACL_WIN64)
711 if (type_str == switches::kRendererProcess && 713 if (type_str == switches::kRendererProcess &&
712 IsWin32kRendererLockdownEnabled()) { 714 IsWin32kRendererLockdownEnabled()) {
713 if (!AddWin32kLockdownPolicy(policy)) 715 if (!AddWin32kLockdownPolicy(policy))
714 return base::Process(); 716 return base::Process();
715 } 717 }
716 #endif 718 #endif
717 719
720 // Post-startup mitigations.
718 mitigations = sandbox::MITIGATION_STRICT_HANDLE_CHECKS | 721 mitigations = sandbox::MITIGATION_STRICT_HANDLE_CHECKS |
719 sandbox::MITIGATION_DLL_SEARCH_ORDER; 722 sandbox::MITIGATION_DLL_SEARCH_ORDER;
720 723
721 if (policy->SetDelayedProcessMitigations(mitigations) != sandbox::SBOX_ALL_OK) 724 if (policy->SetDelayedProcessMitigations(mitigations) != sandbox::SBOX_ALL_OK)
722 return base::Process(); 725 return base::Process();
723 726
724 SetJobLevel(*cmd_line, sandbox::JOB_LOCKDOWN, 0, policy); 727 SetJobLevel(*cmd_line, sandbox::JOB_LOCKDOWN, 0, policy);
725 728
726 if (!delegate->DisableDefaultPolicy()) { 729 if (!delegate->DisableDefaultPolicy()) {
727 if (!AddPolicyForSandboxedProcess(policy)) 730 if (!AddPolicyForSandboxedProcess(policy))
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
859 } 862 }
860 863
861 return false; 864 return false;
862 } 865 }
863 866
864 bool BrokerAddTargetPeer(HANDLE peer_process) { 867 bool BrokerAddTargetPeer(HANDLE peer_process) {
865 return g_broker_services->AddTargetPeer(peer_process) == sandbox::SBOX_ALL_OK; 868 return g_broker_services->AddTargetPeer(peer_process) == sandbox::SBOX_ALL_OK;
866 } 869 }
867 870
868 } // namespace content 871 } // namespace content
OLDNEW
« no previous file with comments | « base/win/windows_version.cc ('k') | sandbox/win/src/broker_services.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698