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

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

Issue 868253011: Make chrome.exe built with ASan/Win work with sandbox enabled (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed a review comment 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
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 "sandbox/win/src/crosscall_client.h" 10 #include "sandbox/win/src/crosscall_client.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 TargetServicesBase::TargetServicesBase() { 67 TargetServicesBase::TargetServicesBase() {
68 } 68 }
69 69
70 ResultCode TargetServicesBase::Init() { 70 ResultCode TargetServicesBase::Init() {
71 process_state_.SetInitCalled(); 71 process_state_.SetInitCalled();
72 return SBOX_ALL_OK; 72 return SBOX_ALL_OK;
73 } 73 }
74 74
75 // Failure here is a breach of security so the process is terminated. 75 // Failure here is a breach of security so the process is terminated.
76 void TargetServicesBase::LowerToken() { 76 void TargetServicesBase::LowerToken() {
77 #if defined(ADDRESS_SANITIZER)
78 // Bind and leak dbghelp.dll before the token is lowered, otherwise
79 // AddressSanitizer will crash when trying to symbolize a report.
80 // TODO: find a better place to do this?
rvargas (doing something else) 2015/02/02 20:55:58 I'd say this is a type of warming so it should be
Timur Iskhodzhanov 2015/02/02 21:28:38 Carlos, do you agree? Btw, the *.pdb policy is se
81 if (!LoadLibraryA("dbghelp.dll"))
82 // TODO: If this is a good place, define a new SBOX_FATAL exit code.
83 ::TerminateProcess(::GetCurrentProcess(), 0x1234);
84 #endif
77 if (ERROR_SUCCESS != 85 if (ERROR_SUCCESS !=
78 SetProcessIntegrityLevel(g_shared_delayed_integrity_level)) 86 SetProcessIntegrityLevel(g_shared_delayed_integrity_level))
79 ::TerminateProcess(::GetCurrentProcess(), SBOX_FATAL_INTEGRITY); 87 ::TerminateProcess(::GetCurrentProcess(), SBOX_FATAL_INTEGRITY);
80 process_state_.SetRevertedToSelf(); 88 process_state_.SetRevertedToSelf();
81 // If the client code as called RegOpenKey, advapi32.dll has cached some 89 // If the client code as called RegOpenKey, advapi32.dll has cached some
82 // handles. The following code gets rid of them. 90 // handles. The following code gets rid of them.
83 if (!::RevertToSelf()) 91 if (!::RevertToSelf())
84 ::TerminateProcess(::GetCurrentProcess(), SBOX_FATAL_DROPTOKEN); 92 ::TerminateProcess(::GetCurrentProcess(), SBOX_FATAL_DROPTOKEN);
85 if (!FlushCachedRegHandles()) 93 if (!FlushCachedRegHandles())
86 ::TerminateProcess(::GetCurrentProcess(), SBOX_FATAL_FLUSHANDLES); 94 ::TerminateProcess(::GetCurrentProcess(), SBOX_FATAL_FLUSHANDLES);
(...skipping 98 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

Powered by Google App Engine
This is Rietveld 408576698