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

Unified Diff: sandbox/src/broker_services.h

Issue 9960045: Add sandbox support for associating peer processes (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | sandbox/src/broker_services.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sandbox/src/broker_services.h
===================================================================
--- sandbox/src/broker_services.h (revision 132034)
+++ sandbox/src/broker_services.h (working copy)
@@ -6,8 +6,10 @@
#define SANDBOX_SRC_BROKER_SERVICES_H__
#include <list>
+#include <map>
#include <set>
#include "base/basictypes.h"
+#include "base/win/scoped_handle.h"
#include "sandbox/src/crosscall_server.h"
#include "sandbox/src/job.h"
#include "sandbox/src/sandbox.h"
@@ -15,6 +17,13 @@
#include "sandbox/src/win2k_threadpool.h"
#include "sandbox/src/win_utils.h"
+namespace {
+
+struct JobTracker;
+struct PeerTracker;
+
+} // namespace
+
namespace sandbox {
class PolicyBase;
@@ -45,6 +54,8 @@
virtual ResultCode WaitForAllTargets();
+ virtual ResultCode AddTargetPeer(HANDLE peer_process);
+
// Checks if the supplied process ID matches one of the broker's active
// target processes
// Returns:
@@ -52,16 +63,6 @@
bool IsActiveTarget(DWORD process_id);
private:
- // Helper structure that allows the Broker to associate a job notification
- // with a job object and with a policy.
- struct JobTracker {
- HANDLE job;
- PolicyBase* policy;
- JobTracker(HANDLE cjob, PolicyBase* cpolicy)
- : job(cjob), policy(cpolicy) {
- }
- };
-
// Releases the Job and notifies the associated Policy object to its
// resources as well.
static void FreeResources(JobTracker* tracker);
@@ -70,6 +71,9 @@
// notifications and cleanup-related tasks.
static DWORD WINAPI TargetEventsThread(PVOID param);
+ // Removes a target peer from the process list if it expires.
+ static VOID CALLBACK RemovePeer(PVOID parameter, BOOLEAN);
+
// The completion port used by the job objects to communicate events to
// the worker thread.
HANDLE job_port_;
@@ -92,6 +96,11 @@
typedef std::list<JobTracker*> JobTrackerList;
JobTrackerList tracker_list_;
+ // Maps peer process IDs to the saved handle and wait event.
+ // Prevents peer callbacks from accessing the broker after destruction.
+ typedef std::map<DWORD, PeerTracker*> PeerTrackerMap;
+ PeerTrackerMap peer_map_;
+
// Provides a fast lookup to identify sandboxed processes.
std::set<DWORD> child_process_ids_;
« no previous file with comments | « no previous file | sandbox/src/broker_services.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698