Index: sandbox/src/broker_services.h |
=================================================================== |
--- sandbox/src/broker_services.h (revision 131361) |
+++ 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" |
@@ -45,6 +47,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: |
@@ -62,6 +66,14 @@ |
} |
}; |
+ // Helper structure that allows the broker to track peer processes |
+ typedef struct PeerTracker { |
cpu_(ooo_6.6-7.5)
2012/04/10 22:00:14
please add a fwd decl here are move PeerTracker de
|
+ HANDLE wait_object_; |
+ base::win::ScopedHandle process_; |
+ PeerTracker() : wait_object_(NULL) { |
+ } |
+ }; |
+ |
// Releases the Job and notifies the associated Policy object to its |
// resources as well. |
static void FreeResources(JobTracker* tracker); |
@@ -70,6 +82,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 RemovePeerData(PVOID parameter, BOOLEAN); |
+ |
// The completion port used by the job objects to communicate events to |
// the worker thread. |
HANDLE job_port_; |
@@ -92,6 +107,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_; |