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 "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 Loading... | |
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? | |
Timur Iskhodzhanov
2015/01/30 16:05:30
Please advise where to move this code?
Will Harris
2015/01/30 17:49:17
Warmup is usually done specific for each sandboxed
Timur Iskhodzhanov
2015/02/02 15:38:58
I actually want it to run always (including chrome
| |
81 if (!LoadLibraryA("dbghelp.dll")) | |
82 // TODO: If this is a good place, define a new SBOX_FATAL exit code. | |
83 ::TerminateProcess(::GetCurrentProcess(), 0x1234); | |
cpu_(ooo_6.6-7.5)
2015/01/30 20:28:24
correct, this happens ahead on each client.
Timur Iskhodzhanov
2015/02/02 15:38:58
Can you please clarify this comment?
Did you mean
| |
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 Loading... | |
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 |
OLD | NEW |