From e4d3cca3efe386a9d87849dc64e686eb2339fec1 Mon Sep 17 00:00:00 2001 From: "ivan.penkov@gmail.com" Date: Mon, 20 May 2013 18:55:54 +0000 Subject: [PATCH] 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 --- src/client/windows/crash_generation/client_info.cc | 2 +- src/client/windows/crash_generation/client_info.h | 3 +++ .../windows/crash_generation/crash_generation_server.cc | 9 ++++++--- .../windows/crash_generation/crash_generation_server.h | 7 +++++++ 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/client/windows/crash_generation/client_info.cc b/src/client/windows/crash_generation/client_info.cc index ca10caa4..cd3a18de 100644 --- a/src/client/windows/crash_generation/client_info.cc +++ b/src/client/windows/crash_generation/client_info.cc @@ -206,7 +206,7 @@ bool ClientInfo::PopulateCustomInfo() { } SetProcessUptime(); - return (bytes_count != read_count); + return (bytes_count == read_count); } CustomClientInfo ClientInfo::GetCustomInfo() const { diff --git a/src/client/windows/crash_generation/client_info.h b/src/client/windows/crash_generation/client_info.h index ce33a46b..9f94bec8 100644 --- a/src/client/windows/crash_generation/client_info.h +++ b/src/client/windows/crash_generation/client_info.h @@ -66,6 +66,9 @@ class ClientInfo { HANDLE dump_requested_handle() const { return dump_requested_handle_; } HANDLE dump_generated_handle() const { return dump_generated_handle_; } 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) { dump_request_wait_handle_ = value; diff --git a/src/client/windows/crash_generation/crash_generation_server.cc b/src/client/windows/crash_generation/crash_generation_server.cc index 676dec2d..b98fb5e0 100644 --- a/src/client/windows/crash_generation/crash_generation_server.cc +++ b/src/client/windows/crash_generation/crash_generation_server.cc @@ -116,7 +116,8 @@ CrashGenerationServer::CrashGenerationServer( server_state_(IPC_SERVER_STATE_UNINITIALIZED), shutting_down_(false), overlapped_(), - client_info_(NULL) { + client_info_(NULL), + pre_fetch_custom_info_(true) { InitializeCriticalSection(&sync_); if (dump_path) { @@ -198,7 +199,7 @@ CrashGenerationServer::~CrashGenerationServer() { if (overlapped_.hEvent) { CloseHandle(overlapped_.hEvent); } - + DeleteCriticalSection(&sync_); } @@ -831,10 +832,12 @@ void CALLBACK CrashGenerationServer::OnPipeConnected(void* context, BOOLEAN) { void CALLBACK CrashGenerationServer::OnDumpRequest(void* context, BOOLEAN) { assert(context); ClientInfo* client_info = reinterpret_cast(context); - client_info->PopulateCustomInfo(); CrashGenerationServer* crash_server = client_info->crash_server(); assert(crash_server); + if (crash_server->pre_fetch_custom_info_) { + client_info->PopulateCustomInfo(); + } crash_server->HandleDumpRequest(*client_info); ResetEvent(client_info->dump_requested_handle()); diff --git a/src/client/windows/crash_generation/crash_generation_server.h b/src/client/windows/crash_generation/crash_generation_server.h index 4dcc532d..07019858 100644 --- a/src/client/windows/crash_generation/crash_generation_server.h +++ b/src/client/windows/crash_generation/crash_generation_server.h @@ -102,6 +102,10 @@ class CrashGenerationServer { // Returns true if initialization is successful; false otherwise. bool Start(); + void pre_fetch_custom_info(bool do_pre_fetch) { + pre_fetch_custom_info_ = do_pre_fetch; + } + private: // Various states the client can be in during the handshake with // the server. @@ -261,6 +265,9 @@ class CrashGenerationServer { // Whether to generate dumps. bool generate_dumps_; + // Wether to populate custom information up-front. + bool pre_fetch_custom_info_; + // Instance of a mini dump generator. scoped_ptr dump_generator_;