Submitting this on behalf of Xiaoling Bao.

Make custom info population before dump generation as an optional operation.  This is part of a security change to move the crash generation and upload out of Google updater process.
Review URL: https://breakpad.appspot.com/586003

git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1186 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
ivan.penkov@gmail.com 2013-05-20 18:55:54 +00:00
parent ecd727f386
commit e4d3cca3ef
4 changed files with 17 additions and 4 deletions

View File

@ -206,7 +206,7 @@ bool ClientInfo::PopulateCustomInfo() {
} }
SetProcessUptime(); SetProcessUptime();
return (bytes_count != read_count); return (bytes_count == read_count);
} }
CustomClientInfo ClientInfo::GetCustomInfo() const { CustomClientInfo ClientInfo::GetCustomInfo() const {

View File

@ -66,6 +66,9 @@ class ClientInfo {
HANDLE dump_requested_handle() const { return dump_requested_handle_; } HANDLE dump_requested_handle() const { return dump_requested_handle_; }
HANDLE dump_generated_handle() const { return dump_generated_handle_; } HANDLE dump_generated_handle() const { return dump_generated_handle_; }
DWORD crash_id() const { return crash_id_; } DWORD crash_id() const { return crash_id_; }
const CustomClientInfo& custom_client_info() const {
return custom_client_info_;
}
void set_dump_request_wait_handle(HANDLE value) { void set_dump_request_wait_handle(HANDLE value) {
dump_request_wait_handle_ = value; dump_request_wait_handle_ = value;

View File

@ -116,7 +116,8 @@ CrashGenerationServer::CrashGenerationServer(
server_state_(IPC_SERVER_STATE_UNINITIALIZED), server_state_(IPC_SERVER_STATE_UNINITIALIZED),
shutting_down_(false), shutting_down_(false),
overlapped_(), overlapped_(),
client_info_(NULL) { client_info_(NULL),
pre_fetch_custom_info_(true) {
InitializeCriticalSection(&sync_); InitializeCriticalSection(&sync_);
if (dump_path) { if (dump_path) {
@ -831,10 +832,12 @@ void CALLBACK CrashGenerationServer::OnPipeConnected(void* context, BOOLEAN) {
void CALLBACK CrashGenerationServer::OnDumpRequest(void* context, BOOLEAN) { void CALLBACK CrashGenerationServer::OnDumpRequest(void* context, BOOLEAN) {
assert(context); assert(context);
ClientInfo* client_info = reinterpret_cast<ClientInfo*>(context); ClientInfo* client_info = reinterpret_cast<ClientInfo*>(context);
client_info->PopulateCustomInfo();
CrashGenerationServer* crash_server = client_info->crash_server(); CrashGenerationServer* crash_server = client_info->crash_server();
assert(crash_server); assert(crash_server);
if (crash_server->pre_fetch_custom_info_) {
client_info->PopulateCustomInfo();
}
crash_server->HandleDumpRequest(*client_info); crash_server->HandleDumpRequest(*client_info);
ResetEvent(client_info->dump_requested_handle()); ResetEvent(client_info->dump_requested_handle());

View File

@ -102,6 +102,10 @@ class CrashGenerationServer {
// Returns true if initialization is successful; false otherwise. // Returns true if initialization is successful; false otherwise.
bool Start(); bool Start();
void pre_fetch_custom_info(bool do_pre_fetch) {
pre_fetch_custom_info_ = do_pre_fetch;
}
private: private:
// Various states the client can be in during the handshake with // Various states the client can be in during the handshake with
// the server. // the server.
@ -261,6 +265,9 @@ class CrashGenerationServer {
// Whether to generate dumps. // Whether to generate dumps.
bool generate_dumps_; bool generate_dumps_;
// Wether to populate custom information up-front.
bool pre_fetch_custom_info_;
// Instance of a mini dump generator. // Instance of a mini dump generator.
scoped_ptr<MinidumpGenerator> dump_generator_; scoped_ptr<MinidumpGenerator> dump_generator_;