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

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

Issue 318603003: Sandbox policy and intercepts for the MITIGATION_WIN32K_DISABLE policy for renderer processes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed presubmit warnings Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | sandbox/win/sandbox_win.gypi » ('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 <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 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 base::FilePath debug_message(long_path_buf); 326 base::FilePath debug_message(long_path_buf);
327 debug_message = debug_message.AppendASCII("debug_message.exe"); 327 debug_message = debug_message.AppendASCII("debug_message.exe");
328 result = policy->AddRule(sandbox::TargetPolicy::SUBSYS_PROCESS, 328 result = policy->AddRule(sandbox::TargetPolicy::SUBSYS_PROCESS,
329 sandbox::TargetPolicy::PROCESS_MIN_EXEC, 329 sandbox::TargetPolicy::PROCESS_MIN_EXEC,
330 debug_message.value().c_str()); 330 debug_message.value().c_str());
331 if (result != sandbox::SBOX_ALL_OK) 331 if (result != sandbox::SBOX_ALL_OK)
332 return false; 332 return false;
333 #endif // NDEBUG 333 #endif // NDEBUG
334 334
335 AddGenericDllEvictionPolicy(policy); 335 AddGenericDllEvictionPolicy(policy);
336
337 return true; 336 return true;
338 } 337 }
339 338
340 bool AddPolicyForSandboxedProcess(sandbox::TargetPolicy* policy) { 339 bool AddPolicyForSandboxedProcess(sandbox::TargetPolicy* policy) {
341 sandbox::ResultCode result; 340 sandbox::ResultCode result;
342 // Renderers need to share events with plugins. 341 // Renderers need to share events with plugins.
343 result = policy->AddRule(sandbox::TargetPolicy::SUBSYS_HANDLES, 342 result = policy->AddRule(sandbox::TargetPolicy::SUBSYS_HANDLES,
344 sandbox::TargetPolicy::HANDLES_DUP_ANY, 343 sandbox::TargetPolicy::HANDLES_DUP_ANY,
345 L"Event"); 344 L"Event");
346 if (result != sandbox::SBOX_ALL_OK) 345 if (result != sandbox::SBOX_ALL_OK)
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 sandbox::MitigationFlags mitigations = sandbox::MITIGATION_HEAP_TERMINATE | 606 sandbox::MitigationFlags mitigations = sandbox::MITIGATION_HEAP_TERMINATE |
608 sandbox::MITIGATION_BOTTOM_UP_ASLR | 607 sandbox::MITIGATION_BOTTOM_UP_ASLR |
609 sandbox::MITIGATION_DEP | 608 sandbox::MITIGATION_DEP |
610 sandbox::MITIGATION_DEP_NO_ATL_THUNK | 609 sandbox::MITIGATION_DEP_NO_ATL_THUNK |
611 sandbox::MITIGATION_SEHOP; 610 sandbox::MITIGATION_SEHOP;
612 611
613 if (base::win::GetVersion() >= base::win::VERSION_WIN8 && 612 if (base::win::GetVersion() >= base::win::VERSION_WIN8 &&
614 type_str == switches::kRendererProcess && 613 type_str == switches::kRendererProcess &&
615 browser_command_line.HasSwitch( 614 browser_command_line.HasSwitch(
616 switches::kEnableWin32kRendererLockDown)) { 615 switches::kEnableWin32kRendererLockDown)) {
617 mitigations |= sandbox::MITIGATION_WIN32K_DISABLE; 616 if (policy->AddRule(sandbox::TargetPolicy::SUBSYS_WIN32K_LOCKDOWN,
618 } 617 sandbox::TargetPolicy::FAKE_USER_GDI_INIT,
618 NULL) != sandbox::SBOX_ALL_OK) {
619 return 0;
620 }
621 mitigations |= sandbox::MITIGATION_WIN32K_DISABLE;
622 }
619 623
620 if (policy->SetProcessMitigations(mitigations) != sandbox::SBOX_ALL_OK) 624 if (policy->SetProcessMitigations(mitigations) != sandbox::SBOX_ALL_OK)
621 return 0; 625 return 0;
622 626
623 mitigations = sandbox::MITIGATION_STRICT_HANDLE_CHECKS | 627 mitigations = sandbox::MITIGATION_STRICT_HANDLE_CHECKS |
624 sandbox::MITIGATION_DLL_SEARCH_ORDER; 628 sandbox::MITIGATION_DLL_SEARCH_ORDER;
625 629
626 if (policy->SetDelayedProcessMitigations(mitigations) != sandbox::SBOX_ALL_OK) 630 if (policy->SetDelayedProcessMitigations(mitigations) != sandbox::SBOX_ALL_OK)
627 return 0; 631 return 0;
628 632
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 } 749 }
746 750
747 return false; 751 return false;
748 } 752 }
749 753
750 bool BrokerAddTargetPeer(HANDLE peer_process) { 754 bool BrokerAddTargetPeer(HANDLE peer_process) {
751 return g_broker_services->AddTargetPeer(peer_process) == sandbox::SBOX_ALL_OK; 755 return g_broker_services->AddTargetPeer(peer_process) == sandbox::SBOX_ALL_OK;
752 } 756 }
753 757
754 } // namespace content 758 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | sandbox/win/sandbox_win.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698