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 <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" |
11 #include "base/debug/profiler.h" | 11 #include "base/debug/profiler.h" |
12 #include "base/debug/trace_event.h" | 12 #include "base/debug/trace_event.h" |
13 #include "base/files/file_util.h" | 13 #include "base/files/file_util.h" |
14 #include "base/hash.h" | 14 #include "base/hash.h" |
15 #include "base/path_service.h" | 15 #include "base/path_service.h" |
16 #include "base/process/launch.h" | 16 #include "base/process/launch.h" |
17 #include "base/strings/string_util.h" | 17 #include "base/strings/string_util.h" |
18 #include "base/strings/stringprintf.h" | 18 #include "base/strings/stringprintf.h" |
19 #include "base/win/iat_patch_function.h" | 19 #include "base/win/iat_patch_function.h" |
20 #include "base/win/scoped_handle.h" | 20 #include "base/win/scoped_handle.h" |
21 #include "base/win/scoped_process_information.h" | 21 #include "base/win/scoped_process_information.h" |
22 #include "base/win/windows_version.h" | 22 #include "base/win/windows_version.h" |
| 23 #include "content/common/content_switches_internal.h" |
23 #include "content/public/common/content_client.h" | 24 #include "content/public/common/content_client.h" |
24 #include "content/public/common/content_switches.h" | 25 #include "content/public/common/content_switches.h" |
25 #include "content/public/common/sandbox_init.h" | 26 #include "content/public/common/sandbox_init.h" |
26 #include "content/public/common/sandboxed_process_launcher_delegate.h" | 27 #include "content/public/common/sandboxed_process_launcher_delegate.h" |
27 #include "sandbox/win/src/process_mitigations.h" | 28 #include "sandbox/win/src/process_mitigations.h" |
28 #include "sandbox/win/src/sandbox.h" | 29 #include "sandbox/win/src/sandbox.h" |
29 #include "sandbox/win/src/sandbox_nt_util.h" | 30 #include "sandbox/win/src/sandbox_nt_util.h" |
30 #include "sandbox/win/src/win_utils.h" | 31 #include "sandbox/win/src/win_utils.h" |
31 #include "ui/gfx/win/direct_write.h" | 32 #include "ui/gfx/win/direct_write.h" |
32 | 33 |
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
613 } | 614 } |
614 | 615 |
615 sandbox::TargetPolicy* policy = g_broker_services->CreatePolicy(); | 616 sandbox::TargetPolicy* policy = g_broker_services->CreatePolicy(); |
616 | 617 |
617 sandbox::MitigationFlags mitigations = sandbox::MITIGATION_HEAP_TERMINATE | | 618 sandbox::MitigationFlags mitigations = sandbox::MITIGATION_HEAP_TERMINATE | |
618 sandbox::MITIGATION_BOTTOM_UP_ASLR | | 619 sandbox::MITIGATION_BOTTOM_UP_ASLR | |
619 sandbox::MITIGATION_DEP | | 620 sandbox::MITIGATION_DEP | |
620 sandbox::MITIGATION_DEP_NO_ATL_THUNK | | 621 sandbox::MITIGATION_DEP_NO_ATL_THUNK | |
621 sandbox::MITIGATION_SEHOP; | 622 sandbox::MITIGATION_SEHOP; |
622 | 623 |
623 if (base::win::GetVersion() >= base::win::VERSION_WIN8 && | 624 #if !defined(NACL_WIN64) |
624 type_str == switches::kRendererProcess && | 625 if (type_str == switches::kRendererProcess && |
625 switches::IsWin32kRendererLockdownEnabled()) { | 626 IsWin32kRendererLockdownEnabled()) { |
626 if (policy->AddRule(sandbox::TargetPolicy::SUBSYS_WIN32K_LOCKDOWN, | 627 if (policy->AddRule(sandbox::TargetPolicy::SUBSYS_WIN32K_LOCKDOWN, |
627 sandbox::TargetPolicy::FAKE_USER_GDI_INIT, | 628 sandbox::TargetPolicy::FAKE_USER_GDI_INIT, |
628 NULL) != sandbox::SBOX_ALL_OK) { | 629 NULL) != sandbox::SBOX_ALL_OK) { |
629 return base::Process(); | 630 return base::Process(); |
630 } | 631 } |
631 mitigations |= sandbox::MITIGATION_WIN32K_DISABLE; | 632 mitigations |= sandbox::MITIGATION_WIN32K_DISABLE; |
632 } | 633 } |
| 634 #endif |
633 | 635 |
634 if (policy->SetProcessMitigations(mitigations) != sandbox::SBOX_ALL_OK) | 636 if (policy->SetProcessMitigations(mitigations) != sandbox::SBOX_ALL_OK) |
635 return base::Process(); | 637 return base::Process(); |
636 | 638 |
637 mitigations = sandbox::MITIGATION_STRICT_HANDLE_CHECKS | | 639 mitigations = sandbox::MITIGATION_STRICT_HANDLE_CHECKS | |
638 sandbox::MITIGATION_DLL_SEARCH_ORDER; | 640 sandbox::MITIGATION_DLL_SEARCH_ORDER; |
639 | 641 |
640 if (policy->SetDelayedProcessMitigations(mitigations) != sandbox::SBOX_ALL_OK) | 642 if (policy->SetDelayedProcessMitigations(mitigations) != sandbox::SBOX_ALL_OK) |
641 return base::Process(); | 643 return base::Process(); |
642 | 644 |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
762 } | 764 } |
763 | 765 |
764 return false; | 766 return false; |
765 } | 767 } |
766 | 768 |
767 bool BrokerAddTargetPeer(HANDLE peer_process) { | 769 bool BrokerAddTargetPeer(HANDLE peer_process) { |
768 return g_broker_services->AddTargetPeer(peer_process) == sandbox::SBOX_ALL_OK; | 770 return g_broker_services->AddTargetPeer(peer_process) == sandbox::SBOX_ALL_OK; |
769 } | 771 } |
770 | 772 |
771 } // namespace content | 773 } // namespace content |
OLD | NEW |