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

Side by Side Diff: sandbox/win/src/target_services.cc

Issue 891973005: Do not close handles in target process on Windows 10. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 | « content/common/sandbox_win.cc ('k') | no next file » | 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 "sandbox/win/src/target_services.h" 5 #include "sandbox/win/src/target_services.h"
6 6
7 #include <process.h> 7 #include <process.h>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/win/windows_version.h"
10 #include "sandbox/win/src/crosscall_client.h" 11 #include "sandbox/win/src/crosscall_client.h"
11 #include "sandbox/win/src/handle_closer_agent.h" 12 #include "sandbox/win/src/handle_closer_agent.h"
12 #include "sandbox/win/src/handle_interception.h" 13 #include "sandbox/win/src/handle_interception.h"
13 #include "sandbox/win/src/ipc_tags.h" 14 #include "sandbox/win/src/ipc_tags.h"
14 #include "sandbox/win/src/process_mitigations.h" 15 #include "sandbox/win/src/process_mitigations.h"
15 #include "sandbox/win/src/restricted_token_utils.h" 16 #include "sandbox/win/src/restricted_token_utils.h"
16 #include "sandbox/win/src/sandbox.h" 17 #include "sandbox/win/src/sandbox.h"
17 #include "sandbox/win/src/sandbox_types.h" 18 #include "sandbox/win/src/sandbox_types.h"
18 #include "sandbox/win/src/sharedmem_ipc_client.h" 19 #include "sandbox/win/src/sharedmem_ipc_client.h"
19 #include "sandbox/win/src/sandbox_nt_util.h" 20 #include "sandbox/win/src/sandbox_nt_util.h"
(...skipping 18 matching lines...) Expand all
38 // although this behavior is undocumented and there is no guarantee that in 39 // although this behavior is undocumented and there is no guarantee that in
39 // fact this will happen in future versions of windows. 40 // fact this will happen in future versions of windows.
40 bool FlushCachedRegHandles() { 41 bool FlushCachedRegHandles() {
41 return (FlushRegKey(HKEY_LOCAL_MACHINE) && 42 return (FlushRegKey(HKEY_LOCAL_MACHINE) &&
42 FlushRegKey(HKEY_CLASSES_ROOT) && 43 FlushRegKey(HKEY_CLASSES_ROOT) &&
43 FlushRegKey(HKEY_USERS)); 44 FlushRegKey(HKEY_USERS));
44 } 45 }
45 46
46 // Checks if we have handle entries pending and runs the closer. 47 // Checks if we have handle entries pending and runs the closer.
47 bool CloseOpenHandles() { 48 bool CloseOpenHandles() {
49 // Windows 10 has FLG_ENABLE_HANDLE_EXCEPTIONS enabled by default so causes
50 // exceptions to be raised if target process attempts to close a handle that
51 // has already been closed by HandleCloser. Therefore, do not close any
52 // handles on Windows 10 until this flag is removed by MS.
53 // See crbug.com/452613.
54 if (base::win::GetVersion() == base::win::VERSION_WIN10)
55 return true;
48 if (sandbox::HandleCloserAgent::NeedsHandlesClosed()) { 56 if (sandbox::HandleCloserAgent::NeedsHandlesClosed()) {
49 sandbox::HandleCloserAgent handle_closer; 57 sandbox::HandleCloserAgent handle_closer;
50 58
51 handle_closer.InitializeHandlesToClose(); 59 handle_closer.InitializeHandlesToClose();
52 if (!handle_closer.CloseHandles()) 60 if (!handle_closer.CloseHandles())
53 return false; 61 return false;
54 } 62 }
55 63
56 return true; 64 return true;
57 } 65 }
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 ResultCode TargetServicesBase::DuplicateHandle(HANDLE source_handle, 193 ResultCode TargetServicesBase::DuplicateHandle(HANDLE source_handle,
186 DWORD target_process_id, 194 DWORD target_process_id,
187 HANDLE* target_handle, 195 HANDLE* target_handle,
188 DWORD desired_access, 196 DWORD desired_access,
189 DWORD options) { 197 DWORD options) {
190 return sandbox::DuplicateHandleProxy(source_handle, target_process_id, 198 return sandbox::DuplicateHandleProxy(source_handle, target_process_id,
191 target_handle, desired_access, options); 199 target_handle, desired_access, options);
192 } 200 }
193 201
194 } // namespace sandbox 202 } // namespace sandbox
OLDNEW
« no previous file with comments | « content/common/sandbox_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698