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

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

Issue 2680123003: Multi-Process Tracking Support (Closed)
Patch Set: record command-line when a process is started Created 3 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
« base/process/launch_win.cc ('K') | « content/app/content_main.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_process.h" 5 #include "sandbox/win/src/target_process.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
11 #include <utility> 11 #include <utility>
12 12
13 #include "base/debug/activity_tracker.h"
13 #include "base/macros.h" 14 #include "base/macros.h"
14 #include "base/memory/free_deleter.h" 15 #include "base/memory/free_deleter.h"
15 #include "base/win/startup_information.h" 16 #include "base/win/startup_information.h"
16 #include "base/win/windows_version.h" 17 #include "base/win/windows_version.h"
17 #include "sandbox/win/src/crosscall_client.h" 18 #include "sandbox/win/src/crosscall_client.h"
18 #include "sandbox/win/src/crosscall_server.h" 19 #include "sandbox/win/src/crosscall_server.h"
19 #include "sandbox/win/src/policy_low_level.h" 20 #include "sandbox/win/src/policy_low_level.h"
20 #include "sandbox/win/src/sandbox_types.h" 21 #include "sandbox/win/src/sandbox_types.h"
21 #include "sandbox/win/src/sharedmem_ipc_server.h" 22 #include "sandbox/win/src/sharedmem_ipc_server.h"
22 #include "sandbox/win/src/win_utils.h" 23 #include "sandbox/win/src/win_utils.h"
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 } 154 }
154 155
155 base_address_ = GetProcessBaseAddress(process_info.process_handle()); 156 base_address_ = GetProcessBaseAddress(process_info.process_handle());
156 DCHECK(base_address_); 157 DCHECK(base_address_);
157 if (!base_address_) { 158 if (!base_address_) {
158 *win_error = ::GetLastError(); 159 *win_error = ::GetLastError();
159 ::TerminateProcess(process_info.process_handle(), 0); 160 ::TerminateProcess(process_info.process_handle(), 0);
160 return SBOX_ERROR_CANNOT_FIND_BASE_ADDRESS; 161 return SBOX_ERROR_CANNOT_FIND_BASE_ADDRESS;
161 } 162 }
162 163
164 base::debug::GlobalActivityTracker* tracker =
manzagop (departed) 2017/02/24 15:56:35 Use your *IfEnabled counterpart?
165 base::debug::GlobalActivityTracker::Get();
166 if (tracker) {
167 tracker->RecordProcessLaunch(process_info.process_id(), exe_path,
168 command_line);
169 }
163 sandbox_process_info_.Set(process_info.Take()); 170 sandbox_process_info_.Set(process_info.Take());
164 return SBOX_ALL_OK; 171 return SBOX_ALL_OK;
165 } 172 }
166 173
167 ResultCode TargetProcess::TransferVariable(const char* name, void* address, 174 ResultCode TargetProcess::TransferVariable(const char* name, void* address,
168 size_t size) { 175 size_t size) {
169 if (!sandbox_process_info_.IsValid()) 176 if (!sandbox_process_info_.IsValid())
170 return SBOX_ERROR_UNEXPECTED_CALL; 177 return SBOX_ERROR_UNEXPECTED_CALL;
171 178
172 void* child_var = address; 179 void* child_var = address;
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 TargetProcess* target = new TargetProcess( 322 TargetProcess* target = new TargetProcess(
316 base::win::ScopedHandle(), base::win::ScopedHandle(), NULL, NULL); 323 base::win::ScopedHandle(), base::win::ScopedHandle(), NULL, NULL);
317 PROCESS_INFORMATION process_info = {}; 324 PROCESS_INFORMATION process_info = {};
318 process_info.hProcess = process; 325 process_info.hProcess = process;
319 target->sandbox_process_info_.Set(process_info); 326 target->sandbox_process_info_.Set(process_info);
320 target->base_address_ = base_address; 327 target->base_address_ = base_address;
321 return target; 328 return target;
322 } 329 }
323 330
324 } // namespace sandbox 331 } // namespace sandbox
OLDNEW
« base/process/launch_win.cc ('K') | « content/app/content_main.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698