summaryrefslogtreecommitdiff
path: root/chromium/chrome_elf
diff options
context:
space:
mode:
authorZeno Albisser <zeno.albisser@theqtcompany.com>2014-12-05 15:04:29 +0100
committerAndras Becsi <andras.becsi@theqtcompany.com>2014-12-09 10:49:28 +0100
commitaf6588f8d723931a298c995fa97259bb7f7deb55 (patch)
tree060ca707847ba1735f01af2372e0d5e494dc0366 /chromium/chrome_elf
parent2fff84d821cc7b1c785f6404e0f8091333283e74 (diff)
downloadqtwebengine-chromium-af6588f8d723931a298c995fa97259bb7f7deb55.tar.gz
BASELINE: Update chromium to 40.0.2214.28 and ninja to 1.5.3.
Change-Id: I759465284fd64d59ad120219cbe257f7402c4181 Reviewed-by: Andras Becsi <andras.becsi@theqtcompany.com>
Diffstat (limited to 'chromium/chrome_elf')
-rw-r--r--chromium/chrome_elf/OWNERS4
-rw-r--r--chromium/chrome_elf/blacklist/blacklist.cc65
-rw-r--r--chromium/chrome_elf/blacklist/blacklist.h6
-rw-r--r--chromium/chrome_elf/breakpad.cc17
-rw-r--r--chromium/chrome_elf/chrome_elf.def2
-rw-r--r--chromium/chrome_elf/chrome_elf_constants.cc13
-rw-r--r--chromium/chrome_elf/chrome_elf_util_unittest.cc8
-rw-r--r--chromium/chrome_elf/create_file/chrome_create_file_unittest.cc13
-rw-r--r--chromium/chrome_elf/ntdll_cache_unittest.cc2
9 files changed, 87 insertions, 43 deletions
diff --git a/chromium/chrome_elf/OWNERS b/chromium/chrome_elf/OWNERS
index 3d69bab21a6..1056485ac9e 100644
--- a/chromium/chrome_elf/OWNERS
+++ b/chromium/chrome_elf/OWNERS
@@ -1,2 +1,2 @@
- caitkp@chromium.org
- robertshield@chromium.org
+caitkp@chromium.org
+robertshield@chromium.org
diff --git a/chromium/chrome_elf/blacklist/blacklist.cc b/chromium/chrome_elf/blacklist/blacklist.cc
index efb9c97cd20..f775b62d409 100644
--- a/chromium/chrome_elf/blacklist/blacklist.cc
+++ b/chromium/chrome_elf/blacklist/blacklist.cc
@@ -29,19 +29,29 @@ namespace blacklist{
// For more information about how this list is generated, and how to get off
// of it, see:
// https://sites.google.com/a/chromium.org/dev/Home/third-party-developers
+// NOTE: Please remember to update the DllHash enum in histograms.xml when
+// adding a new value to the blacklist.
const wchar_t* g_troublesome_dlls[kTroublesomeDllsMaxCount] = {
L"activedetect32.dll", // Lenovo One Key Theater.
// See crbug.com/379218.
L"activedetect64.dll", // Lenovo One Key Theater.
L"bitguard.dll", // Unknown (suspected malware).
L"chrmxtn.dll", // Unknown (keystroke logger).
+ L"cplushook.dll", // Unknown (suspected malware).
L"datamngr.dll", // Unknown (suspected adware).
L"hk.dll", // Unknown (keystroke logger).
+ L"libapi2hook.dll", // V-Bates.
+ L"libinject.dll", // V-Bates.
+ L"libinject2.dll", // V-Bates.
+ L"libredir2.dll", // V-Bates.
L"libsvn_tsvn32.dll", // TortoiseSVN.
+ L"libwinhook.dll", // V-Bates.
L"lmrn.dll", // Unknown.
- L"scdetour.dll", // Quick Heal Antivirus.
- // See crbug.com/382561.
+ L"minisp.dll", // Unknown (suspected malware).
+ L"safetynut.dll", // Unknown (suspected adware).
L"systemk.dll", // Unknown (suspected adware).
+ L"wajam_goblin_64.dll", // Wajam Internet Technologies.
+ L"wajam_goblin.dll", // Wajam Internet Technologies.
L"windowsapihookdll32.dll", // Lenovo One Key Theater.
// See crbug.com/379218.
L"windowsapihookdll64.dll", // Lenovo One Key Theater.
@@ -77,7 +87,13 @@ DWORD SetDWValue(HKEY* key, const wchar_t* property, DWORD value) {
bool GenerateStateFromBeaconAndAttemptCount(HKEY* key, DWORD blacklist_state) {
LONG result = 0;
- if (blacklist_state == blacklist::BLACKLIST_SETUP_RUNNING) {
+ if (blacklist_state == blacklist::BLACKLIST_ENABLED) {
+ // If the blacklist succeeded on the previous run reset the failure
+ // counter.
+ return (SetDWValue(key,
+ blacklist::kBeaconAttemptCount,
+ static_cast<DWORD>(0)) == ERROR_SUCCESS);
+ } else {
// Some part of the blacklist setup failed last time. If this has occured
// blacklist::kBeaconMaxAttempts times in a row we switch the state to
// failed and skip setting up the blacklist.
@@ -101,18 +117,10 @@ bool GenerateStateFromBeaconAndAttemptCount(HKEY* key, DWORD blacklist_state) {
if (attempt_count >= blacklist::kBeaconMaxAttempts) {
blacklist_state = blacklist::BLACKLIST_SETUP_FAILED;
SetDWValue(key, blacklist::kBeaconState, blacklist_state);
- return false;
- }
- } else if (blacklist_state == blacklist::BLACKLIST_ENABLED) {
- // If the blacklist succeeded on the previous run reset the failure
- // counter.
- result =
- SetDWValue(key, blacklist::kBeaconAttemptCount, static_cast<DWORD>(0));
- if (result != ERROR_SUCCESS) {
- return false;
}
+
+ return false;
}
- return true;
}
} // namespace
@@ -152,7 +160,7 @@ bool LeaveSetupBeacon() {
reinterpret_cast<LPBYTE>(&blacklist_state),
&blacklist_state_size);
- if (blacklist_state == BLACKLIST_DISABLED || result != ERROR_SUCCESS ||
+ if (result != ERROR_SUCCESS || blacklist_state == BLACKLIST_DISABLED ||
type != REG_DWORD) {
::RegCloseKey(key);
return false;
@@ -220,6 +228,14 @@ bool IsBlacklistInitialized() {
return g_blacklist_initialized;
}
+int GetBlacklistIndex(const wchar_t* dll_name) {
+ for (int i = 0; i < kTroublesomeDllsMaxCount && g_troublesome_dlls[i]; ++i) {
+ if (_wcsicmp(dll_name, g_troublesome_dlls[i]) == 0)
+ return i;
+ }
+ return -1;
+}
+
bool AddDllToBlacklist(const wchar_t* dll_name) {
int blacklist_size = BlacklistSize();
// We need to leave one space at the end for the null pointer.
@@ -384,7 +400,7 @@ bool Initialize(bool force) {
return NT_SUCCESS(ret) && page_executable;
}
-bool AddDllsFromRegistryToBlacklist() {
+void AddDllsFromRegistryToBlacklist() {
HKEY key = NULL;
LONG result = ::RegOpenKeyEx(HKEY_CURRENT_USER,
kRegistryFinchListPath,
@@ -393,9 +409,9 @@ bool AddDllsFromRegistryToBlacklist() {
&key);
if (result != ERROR_SUCCESS)
- return false;
+ return;
- // We add dlls from the registry to the blacklist, and then clear registry.
+ // We add dlls from the registry to the blacklist.
DWORD value_len;
DWORD name_len = MAX_PATH;
std::vector<wchar_t> name_buffer(name_len);
@@ -404,24 +420,23 @@ bool AddDllsFromRegistryToBlacklist() {
value_len = 0;
result = ::RegEnumValue(
key, i, &name_buffer[0], &name_len, NULL, NULL, NULL, &value_len);
+ if (result != ERROR_SUCCESS)
+ break;
+
name_len = name_len + 1;
value_len = value_len + 1;
std::vector<wchar_t> value_buffer(value_len);
result = ::RegEnumValue(key, i, &name_buffer[0], &name_len, NULL, NULL,
reinterpret_cast<BYTE*>(&value_buffer[0]),
&value_len);
+ if (result != ERROR_SUCCESS)
+ break;
value_buffer[value_len - 1] = L'\0';
-
- if (result == ERROR_SUCCESS) {
- AddDllToBlacklist(&value_buffer[0]);
- }
+ AddDllToBlacklist(&value_buffer[0]);
}
- // Delete the finch registry key to clear the values.
- result = ::RegDeleteKey(key, L"");
-
::RegCloseKey(key);
- return result == ERROR_SUCCESS;
+ return;
}
} // namespace blacklist
diff --git a/chromium/chrome_elf/blacklist/blacklist.h b/chromium/chrome_elf/blacklist/blacklist.h
index 58cc16b3b8f..8a06ef06e2b 100644
--- a/chromium/chrome_elf/blacklist/blacklist.h
+++ b/chromium/chrome_elf/blacklist/blacklist.h
@@ -40,6 +40,10 @@ int BlacklistSize();
// Returns if true if the blacklist has been initialized.
extern "C" bool IsBlacklistInitialized();
+// Returns the index of the DLL named |dll_name| on the blacklist, or -1 if not
+// found.
+extern "C" int GetBlacklistIndex(const wchar_t* dll_name);
+
// Adds the given dll name to the blacklist. Returns true if the dll name is in
// the blacklist when this returns, false on error. Note that this will copy
// |dll_name| and will leak it on exit if the string is not subsequently removed
@@ -62,7 +66,7 @@ extern "C" void SuccessfullyBlocked(const wchar_t** blocked_dlls, int* size);
// Add the dlls, originally passed in through finch, from the registry to the
// blacklist so that they will be blocked identically to those hard coded in.
-extern "C" bool AddDllsFromRegistryToBlacklist();
+extern "C" void AddDllsFromRegistryToBlacklist();
// Record that the dll at the given index was blocked.
void BlockedDll(size_t blocked_index);
diff --git a/chromium/chrome_elf/breakpad.cc b/chromium/chrome_elf/breakpad.cc
index 4c20324b208..4eeb129f9e3 100644
--- a/chromium/chrome_elf/breakpad.cc
+++ b/chromium/chrome_elf/breakpad.cc
@@ -23,6 +23,8 @@ const wchar_t kBreakpadVersionEntry[] = L"ver";
const wchar_t kBreakpadProdEntry[] = L"prod";
const wchar_t kBreakpadPlatformEntry[] = L"plat";
const wchar_t kBreakpadPlatformWin32[] = L"Win32";
+const wchar_t kBreakpadProcessEntry[] = L"ptype";
+const wchar_t kBreakpadChannelEntry[] = L"channel";
// The protocol for connecting to the out-of-process Breakpad crash
// reporter is different for x86-32 and x86-64: the message sizes
@@ -37,14 +39,27 @@ const wchar_t kNoErrorDialogs[] = L"noerrdialogs";
const wchar_t kChromeHeadless[] = L"CHROME_HEADLESS";
google_breakpad::CustomClientInfo* GetCustomInfo() {
+ base::string16 process = IsNonBrowserProcess() ? L"renderer" : L"browser";
+
+ wchar_t exe_path[MAX_PATH] = {};
+ base::string16 channel;
+ if (GetModuleFileName(NULL, exe_path, arraysize(exe_path)) &&
+ IsCanary(exe_path)) {
+ channel = L"canary";
+ }
+
static google_breakpad::CustomInfoEntry ver_entry(
kBreakpadVersionEntry, TEXT(CHROME_VERSION_STRING));
static google_breakpad::CustomInfoEntry prod_entry(
kBreakpadProdEntry, kBreakpadProductName);
static google_breakpad::CustomInfoEntry plat_entry(
kBreakpadPlatformEntry, kBreakpadPlatformWin32);
+ static google_breakpad::CustomInfoEntry proc_entry(
+ kBreakpadProcessEntry, process.c_str());
+ static google_breakpad::CustomInfoEntry channel_entry(
+ kBreakpadChannelEntry, channel.c_str());
static google_breakpad::CustomInfoEntry entries[] = {
- ver_entry, prod_entry, plat_entry };
+ ver_entry, prod_entry, plat_entry, proc_entry, channel_entry};
static google_breakpad::CustomClientInfo custom_info = {
entries, arraysize(entries) };
return &custom_info;
diff --git a/chromium/chrome_elf/chrome_elf.def b/chromium/chrome_elf/chrome_elf.def
index 566a8fb0657..07541e2e83f 100644
--- a/chromium/chrome_elf/chrome_elf.def
+++ b/chromium/chrome_elf/chrome_elf.def
@@ -10,3 +10,5 @@ EXPORTS
IsBlacklistInitialized
SignalChromeElf
SuccessfullyBlocked
+ GetBlacklistIndex
+ AddDllToBlacklist
diff --git a/chromium/chrome_elf/chrome_elf_constants.cc b/chromium/chrome_elf/chrome_elf_constants.cc
index a7ee1c929c2..ffb9b9d9bd3 100644
--- a/chromium/chrome_elf/chrome_elf_constants.cc
+++ b/chromium/chrome_elf/chrome_elf_constants.cc
@@ -5,6 +5,14 @@
#include "chrome_elf/chrome_elf_constants.h"
#if defined(GOOGLE_CHROME_BUILD)
+#define PRODUCT_STRING_PATH L"Google\\Chrome"
+#elif defined(CHROMIUM_BUILD)
+#define PRODUCT_STRING_PATH L"Chromium"
+#else
+#error Unknown branding
+#endif
+
+#if defined(GOOGLE_CHROME_BUILD)
const wchar_t kAppDataDirName[] = L"Google\\Chrome";
#else
const wchar_t kAppDataDirName[] = L"Chromium";
@@ -16,9 +24,10 @@ const wchar_t kUserDataDirName[] = L"User Data";
namespace blacklist {
-const wchar_t kRegistryBeaconPath[] = L"SOFTWARE\\Google\\Chrome\\BLBeacon";
+const wchar_t kRegistryBeaconPath[] =
+ L"SOFTWARE\\" PRODUCT_STRING_PATH L"\\BLBeacon";
const wchar_t kRegistryFinchListPath[] =
- L"SOFTWARE\\Google\\Chrome\\BLFinchList";
+ L"SOFTWARE\\" PRODUCT_STRING_PATH L"\\BLFinchList";
const wchar_t kBeaconVersion[] = L"version";
const wchar_t kBeaconState[] = L"state";
const wchar_t kBeaconAttemptCount[] = L"failed_count";
diff --git a/chromium/chrome_elf/chrome_elf_util_unittest.cc b/chromium/chrome_elf/chrome_elf_util_unittest.cc
index 1cb6488ecaa..90b04ed126f 100644
--- a/chromium/chrome_elf/chrome_elf_util_unittest.cc
+++ b/chromium/chrome_elf/chrome_elf_util_unittest.cc
@@ -57,11 +57,9 @@ class ChromeElfUtilTest :
const char*,
const char*> > {
protected:
- virtual void SetUp() OVERRIDE {
- override_manager_.OverrideRegistry(HKEY_LOCAL_MACHINE,
- L"chrome_elf_test_local");
- override_manager_.OverrideRegistry(HKEY_CURRENT_USER,
- L"chrome_elf_test_current");
+ virtual void SetUp() override {
+ override_manager_.OverrideRegistry(HKEY_LOCAL_MACHINE);
+ override_manager_.OverrideRegistry(HKEY_CURRENT_USER);
const char* app;
const char* level;
const char* mode;
diff --git a/chromium/chrome_elf/create_file/chrome_create_file_unittest.cc b/chromium/chrome_elf/create_file/chrome_create_file_unittest.cc
index 5b776073681..cd66d470688 100644
--- a/chromium/chrome_elf/create_file/chrome_create_file_unittest.cc
+++ b/chromium/chrome_elf/create_file/chrome_create_file_unittest.cc
@@ -10,8 +10,8 @@
#include <string>
#include "base/base_paths_win.h"
-#include "base/file_util.h"
#include "base/files/file_path.h"
+#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/path_service.h"
#include "base/threading/platform_thread.h"
@@ -76,7 +76,7 @@ class ChromeCreateFileTest : public PlatformTest {
path);
}
- virtual void SetUp() OVERRIDE {
+ virtual void SetUp() override {
original_thread_ = base::PlatformThread::CurrentId();
InitCache();
PlatformTest::SetUp();
@@ -242,8 +242,9 @@ class ChromeCreateFileTest : public PlatformTest {
}
- EXPECT_FALSE(file_handle == INVALID_HANDLE_VALUE);
- ::WriteFile(file_handle, kTestData, buffer_size, &bytes_written, NULL);
+ EXPECT_TRUE(file_handle.IsValid());
+ ::WriteFile(file_handle.Get(), kTestData, buffer_size, &bytes_written,
+ NULL);
EXPECT_EQ(buffer_size, bytes_written);
}
@@ -272,8 +273,8 @@ class ChromeCreateFileTest : public PlatformTest {
NULL));
}
- EXPECT_FALSE(file_handle == INVALID_HANDLE_VALUE);
- ::ReadFile(file_handle, read_buffer, buffer_size, &bytes_read, NULL);
+ EXPECT_TRUE(file_handle.IsValid());
+ ::ReadFile(file_handle.Get(), read_buffer, buffer_size, &bytes_read, NULL);
EXPECT_EQ(buffer_size, bytes_read);
EXPECT_EQ(0, memcmp(kTestData, read_buffer, bytes_read));
}
diff --git a/chromium/chrome_elf/ntdll_cache_unittest.cc b/chromium/chrome_elf/ntdll_cache_unittest.cc
index 3ecc0863431..a96df6156ab 100644
--- a/chromium/chrome_elf/ntdll_cache_unittest.cc
+++ b/chromium/chrome_elf/ntdll_cache_unittest.cc
@@ -13,7 +13,7 @@ namespace {
class NTDLLCacheTest : public testing::Test {
protected:
- virtual void SetUp() OVERRIDE {
+ virtual void SetUp() override {
InitCache();
}