summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/chrome_elf_init_win.cc63
-rw-r--r--chrome_elf/blacklist.gypi1
-rw-r--r--chrome_elf/blacklist/blacklist.cc18
-rw-r--r--chrome_elf/blacklist/test/blacklist_test.cc11
4 files changed, 28 insertions, 65 deletions
diff --git a/chrome/browser/chrome_elf_init_win.cc b/chrome/browser/chrome_elf_init_win.cc
index 0ea4e0d..79465b8 100644
--- a/chrome/browser/chrome_elf_init_win.cc
+++ b/chrome/browser/chrome_elf_init_win.cc
@@ -112,13 +112,40 @@ void BrowserBlacklistBeaconSetup() {
if (!blacklist_registry_key.Valid())
return;
+ // Record the results of the last blacklist setup.
+ DWORD blacklist_state = blacklist::BLACKLIST_STATE_MAX;
+ blacklist_registry_key.ReadValueDW(blacklist::kBeaconState, &blacklist_state);
+
+ if (blacklist_state == blacklist::BLACKLIST_ENABLED) {
+ RecordBlacklistSetupEvent(BLACKLIST_SETUP_RAN_SUCCESSFULLY);
+ } else {
+ switch (blacklist_state) {
+ case blacklist::BLACKLIST_SETUP_RUNNING:
+ RecordBlacklistSetupEvent(BLACKLIST_SETUP_FAILED);
+ break;
+ case blacklist::BLACKLIST_THUNK_SETUP:
+ RecordBlacklistSetupEvent(BLACKLIST_THUNK_SETUP_FAILED);
+ break;
+ case blacklist::BLACKLIST_INTERCEPTING:
+ RecordBlacklistSetupEvent(BLACKLIST_INTERCEPTION_FAILED);
+ break;
+ }
+
+ // Since some part of the blacklist failed, mark it as disabled
+ // for this version.
+ if (blacklist_state != blacklist::BLACKLIST_DISABLED) {
+ blacklist_registry_key.WriteValue(blacklist::kBeaconState,
+ blacklist::BLACKLIST_DISABLED);
+ }
+ }
+
// Find the last recorded blacklist version.
base::string16 blacklist_version;
blacklist_registry_key.ReadValue(blacklist::kBeaconVersion,
&blacklist_version);
if (blacklist_version != TEXT(CHROME_VERSION_STRING)) {
- // The blacklist hasn't run for this version yet, so enable it.
+ // The blacklist hasn't been enabled for this version yet, so enable it.
LONG set_version = blacklist_registry_key.WriteValue(
blacklist::kBeaconVersion,
TEXT(CHROME_VERSION_STRING));
@@ -131,39 +158,5 @@ void BrowserBlacklistBeaconSetup() {
// succeed, since otherwise the blacklist wasn't properly setup.
if (set_version == ERROR_SUCCESS && set_state == ERROR_SUCCESS)
RecordBlacklistSetupEvent(BLACKLIST_SETUP_ENABLED);
-
- // Don't try to record if the blacklist setup succeeded or failed in the
- // run since it could have been from either this version or the previous
- // version (since crashes occur before we set the version in the registry).
- } else {
- // The blacklist version didn't change, so record the results of the
- // latest setup.
- DWORD blacklist_state = blacklist::BLACKLIST_STATE_MAX;
- blacklist_registry_key.ReadValueDW(blacklist::kBeaconState,
- &blacklist_state);
-
- // Record the results of the latest blacklist setup.
- if (blacklist_state == blacklist::BLACKLIST_ENABLED) {
- RecordBlacklistSetupEvent(BLACKLIST_SETUP_RAN_SUCCESSFULLY);
- } else {
- switch (blacklist_state) {
- case blacklist::BLACKLIST_SETUP_RUNNING:
- RecordBlacklistSetupEvent(BLACKLIST_SETUP_FAILED);
- break;
- case blacklist::BLACKLIST_THUNK_SETUP:
- RecordBlacklistSetupEvent(BLACKLIST_THUNK_SETUP_FAILED);
- break;
- case blacklist::BLACKLIST_INTERCEPTING:
- RecordBlacklistSetupEvent(BLACKLIST_INTERCEPTION_FAILED);
- break;
- }
-
- // Since some part of the blacklist failed, ensure it is now disabled
- // for this version.
- if (blacklist_state != blacklist::BLACKLIST_DISABLED) {
- blacklist_registry_key.WriteValue(blacklist::kBeaconState,
- blacklist::BLACKLIST_DISABLED);
- }
- }
}
}
diff --git a/chrome_elf/blacklist.gypi b/chrome_elf/blacklist.gypi
index 86c97c9..7ab5be1 100644
--- a/chrome_elf/blacklist.gypi
+++ b/chrome_elf/blacklist.gypi
@@ -21,7 +21,6 @@
# as that would risk pulling in base's link-time dependencies which
# chrome_elf cannot do.
'../base/base.gyp:base_static',
- '../chrome/chrome.gyp:chrome_version_header',
'../chrome_elf/chrome_elf.gyp:chrome_elf_breakpad',
'../chrome_elf/chrome_elf.gyp:chrome_elf_constants',
'../sandbox/sandbox.gyp:sandbox',
diff --git a/chrome_elf/blacklist/blacklist.cc b/chrome_elf/blacklist/blacklist.cc
index 681427a..23a06b4 100644
--- a/chrome_elf/blacklist/blacklist.cc
+++ b/chrome_elf/blacklist/blacklist.cc
@@ -15,7 +15,6 @@
#include "sandbox/win/src/internal_types.h"
#include "sandbox/win/src/sandbox_utils.h"
#include "sandbox/win/src/service_resolver.h"
-#include "version.h" // NOLINT
// http://blogs.msdn.com/oldnewthing/archive/2004/10/25/247180.aspx
extern "C" IMAGE_DOS_HEADER __ImageBase;
@@ -205,23 +204,6 @@ bool LeaveSetupBeacon() {
return false;
}
- // If the blacklist wasn't set as enabled for this version, don't
- // use it.
- wchar_t key_data[255] = {};
- DWORD key_data_size = sizeof(key_data);
- result = ::RegQueryValueEx(key,
- blacklist::kBeaconVersion,
- 0,
- &type,
- reinterpret_cast<LPBYTE>(key_data),
- &key_data_size);
-
- if (wcscmp(key_data, TEXT(CHROME_VERSION_STRING)) != 0 ||
- result != ERROR_SUCCESS || type != REG_SZ) {
- ::RegCloseKey(key);
- return false;
- }
-
// Mark the blacklist setup code as running so if it crashes the blacklist
// won't be enabled for the next run.
blacklist_state = BLACKLIST_SETUP_RUNNING;
diff --git a/chrome_elf/blacklist/test/blacklist_test.cc b/chrome_elf/blacklist/test/blacklist_test.cc
index e507446..05aeb14 100644
--- a/chrome_elf/blacklist/test/blacklist_test.cc
+++ b/chrome_elf/blacklist/test/blacklist_test.cc
@@ -82,17 +82,6 @@ TEST_F(BlacklistTest, Beacon) {
// Resetting the beacon should work when setup beacon is present.
EXPECT_TRUE(blacklist::ResetBeacon());
-
- // Change the version and ensure that the setup fails due to the version
- // mismatch.
- base::string16 different_version(L"other_version");
- ASSERT_NE(different_version, TEXT(CHROME_VERSION_STRING));
-
- result = blacklist_registry_key.WriteValue(blacklist::kBeaconVersion,
- different_version.c_str());
- EXPECT_EQ(ERROR_SUCCESS, result);
-
- EXPECT_FALSE(blacklist::LeaveSetupBeacon());
}
TEST_F(BlacklistTest, AddAndRemoveModules) {