summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser_tests.isolate1
-rw-r--r--chrome/chrome_renderer.gypi3
-rw-r--r--chrome/interactive_ui_tests.isolate1
-rw-r--r--chrome/renderer/DEPS1
-rw-r--r--chrome/renderer/chrome_content_renderer_client.cc17
-rw-r--r--chrome/unit_tests.isolate1
-rw-r--r--chrome_elf/blacklist/blacklist.cc11
-rw-r--r--chrome_elf/blacklist/blacklist.h3
-rw-r--r--chrome_elf/blacklist/test/blacklist_test.cc4
-rw-r--r--chrome_elf/blacklist/test/blacklist_test_main_dll.def3
-rw-r--r--chrome_elf/chrome_elf.def1
-rw-r--r--tools/metrics/histograms/histograms.xml7
12 files changed, 52 insertions, 1 deletions
diff --git a/chrome/browser_tests.isolate b/chrome/browser_tests.isolate
index 55aadf4..a7d03c1 100644
--- a/chrome/browser_tests.isolate
+++ b/chrome/browser_tests.isolate
@@ -132,6 +132,7 @@
'variables': {
'isolate_dependency_tracked': [
'../native_client/build/build_nexe.py',
+ '<(PRODUCT_DIR)/chrome_elf.dll',
'<(PRODUCT_DIR)/clearkeycdm.dll',
'<(PRODUCT_DIR)/clearkeycdmadapter.dll',
'<(PRODUCT_DIR)/ppapi_tests.dll',
diff --git a/chrome/chrome_renderer.gypi b/chrome/chrome_renderer.gypi
index b546cd6..c1444cc 100644
--- a/chrome/chrome_renderer.gypi
+++ b/chrome/chrome_renderer.gypi
@@ -441,6 +441,9 @@
],
}],
['OS=="win"', {
+ 'dependencies': [
+ '../chrome_elf/chrome_elf.gyp:chrome_elf',
+ ],
'include_dirs': [
'<(DEPTH)/third_party/wtl/include',
],
diff --git a/chrome/interactive_ui_tests.isolate b/chrome/interactive_ui_tests.isolate
index fa70b9b..4738ceb 100644
--- a/chrome/interactive_ui_tests.isolate
+++ b/chrome/interactive_ui_tests.isolate
@@ -77,6 +77,7 @@
'isolate_dependency_tracked': [
'../net/data/ssl/certificates/foaf.me.chromium-test-cert.der',
'../net/data/ssl/certificates/mit.davidben.der',
+ '<(PRODUCT_DIR)/chrome_elf.dll',
'<(PRODUCT_DIR)/d3dcompiler_46.dll',
'<(PRODUCT_DIR)/ffmpegsumo.dll',
'<(PRODUCT_DIR)/libEGL.dll',
diff --git a/chrome/renderer/DEPS b/chrome/renderer/DEPS
index 14a782f..bf9a831f 100644
--- a/chrome/renderer/DEPS
+++ b/chrome/renderer/DEPS
@@ -1,4 +1,5 @@
include_rules = [
+ "+chrome_elf",
"+components/autofill/content/common",
"+components/autofill/content/renderer",
"+components/autofill/core/common",
diff --git a/chrome/renderer/chrome_content_renderer_client.cc b/chrome/renderer/chrome_content_renderer_client.cc
index 9318da9..45a5afe 100644
--- a/chrome/renderer/chrome_content_renderer_client.cc
+++ b/chrome/renderer/chrome_content_renderer_client.cc
@@ -116,6 +116,10 @@
#include "chrome/renderer/spellchecker/spellcheck_provider.h"
#endif
+#if defined(OS_WIN)
+#include "chrome_elf/blacklist/blacklist.h"
+#endif // OS_WIN
+
using autofill::AutofillAgent;
using autofill::PasswordAutofillAgent;
using autofill::PasswordGenerationAgent;
@@ -353,6 +357,19 @@ void ChromeContentRendererClient::RenderThreadStarted() {
extensions::ExtensionsClient::Set(
extensions::ChromeExtensionsClient::GetInstance());
+
+#if defined(OS_WIN)
+ // Report if the renderer process has been patched by chrome_elf.
+ // TODO(csharp): Remove once the renderer is no longer getting
+ // patched this way.
+ typedef bool(*IsBlacklistInitializedFunc)();
+ IsBlacklistInitializedFunc is_blacklist_initialized =
+ reinterpret_cast<IsBlacklistInitializedFunc>(
+ GetProcAddress(GetModuleHandle(L"chrome_elf.dll"),
+ "IsBlacklistInitialized"));
+ if (is_blacklist_initialized && is_blacklist_initialized())
+ UMA_HISTOGRAM_BOOLEAN("Blacklist.PatchedInRenderer", true);
+#endif
}
void ChromeContentRendererClient::RenderFrameCreated(
diff --git a/chrome/unit_tests.isolate b/chrome/unit_tests.isolate
index 0096f1f..ce28077 100644
--- a/chrome/unit_tests.isolate
+++ b/chrome/unit_tests.isolate
@@ -108,6 +108,7 @@
['OS=="win"', {
'variables': {
'isolate_dependency_tracked': [
+ '<(PRODUCT_DIR)/chrome_elf.dll',
'<(PRODUCT_DIR)/ffmpegsumo.dll',
],
'isolate_dependency_untracked': [
diff --git a/chrome_elf/blacklist/blacklist.cc b/chrome_elf/blacklist/blacklist.cc
index ea140c4..32d3cb2 100644
--- a/chrome_elf/blacklist/blacklist.cc
+++ b/chrome_elf/blacklist/blacklist.cc
@@ -60,6 +60,10 @@ enum WOW64Status {
WOW64_UNKNOWN,
};
+// Record if the blacklist was successfully initialized so processes can easily
+// determine if the blacklist is enabled for them.
+bool g_blacklist_initialized = false;
+
WOW64Status GetWOW64StatusForCurrentProcess() {
typedef BOOL (WINAPI* IsWow64ProcessFunc)(HANDLE, PBOOL);
IsWow64ProcessFunc is_wow64_process = reinterpret_cast<IsWow64ProcessFunc>(
@@ -272,6 +276,10 @@ int BlacklistSize() {
return size;
}
+bool IsBlacklistInitialized() {
+ return g_blacklist_initialized;
+}
+
bool AddDllToBlacklist(const wchar_t* dll_name) {
int blacklist_size = BlacklistSize();
// We need to leave one space at the end for the null pointer.
@@ -373,6 +381,9 @@ bool Initialize(bool force) {
}
#endif
+ // Record that we have initialized the blacklist.
+ g_blacklist_initialized = true;
+
BYTE* thunk_storage = reinterpret_cast<BYTE*>(&g_thunk_storage);
// Mark the thunk storage as readable and writeable, since we
diff --git a/chrome_elf/blacklist/blacklist.h b/chrome_elf/blacklist/blacklist.h
index 5237a5c..2e21f20 100644
--- a/chrome_elf/blacklist/blacklist.h
+++ b/chrome_elf/blacklist/blacklist.h
@@ -61,6 +61,9 @@ bool ResetBeacon();
// Return the size of the current blacklist.
int BlacklistSize();
+// Returns if true if the blacklist has been initialized.
+extern "C" bool IsBlacklistInitialized();
+
// 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
diff --git a/chrome_elf/blacklist/test/blacklist_test.cc b/chrome_elf/blacklist/test/blacklist_test.cc
index 3a881ad..39db737 100644
--- a/chrome_elf/blacklist/test/blacklist_test.cc
+++ b/chrome_elf/blacklist/test/blacklist_test.cc
@@ -32,6 +32,7 @@ extern "C" {
// functions on the test blacklist dll, not the ones linked into the test
// executable itself.
__declspec(dllimport) bool TestDll_AddDllToBlacklist(const wchar_t* dll_name);
+__declspec(dllimport) bool TestDLL_IsBlacklistInitialized();
__declspec(dllimport) bool TestDll_RemoveDllFromBlacklist(
const wchar_t* dll_name);
}
@@ -120,6 +121,9 @@ TEST_F(BlacklistTest, LoadBlacklistedLibrary) {
base::FilePath current_dir;
ASSERT_TRUE(PathService::Get(base::DIR_EXE, &current_dir));
+ // Ensure that the blacklist is loaded.
+ ASSERT_TRUE(TestDLL_IsBlacklistInitialized());
+
// Test that an un-blacklisted DLL can load correctly.
base::ScopedNativeLibrary dll1(current_dir.Append(kTestDllName1));
EXPECT_TRUE(dll1.is_valid());
diff --git a/chrome_elf/blacklist/test/blacklist_test_main_dll.def b/chrome_elf/blacklist/test/blacklist_test_main_dll.def
index 63522a0..82e0f0e 100644
--- a/chrome_elf/blacklist/test/blacklist_test_main_dll.def
+++ b/chrome_elf/blacklist/test/blacklist_test_main_dll.def
@@ -6,5 +6,6 @@ LIBRARY "blacklist_test_main_dll.dll"
EXPORTS
TestDll_AddDllToBlacklist=AddDllToBlacklist
+ TestDLL_IsBlacklistInitialized=IsBlacklistInitialized
TestDll_RemoveDllFromBlacklist=RemoveDllFromBlacklist
- InitBlacklistTestDll
+ InitBlacklistTestDll \ No newline at end of file
diff --git a/chrome_elf/chrome_elf.def b/chrome_elf/chrome_elf.def
index 3e88cfa..ee9808f 100644
--- a/chrome_elf/chrome_elf.def
+++ b/chrome_elf/chrome_elf.def
@@ -6,4 +6,5 @@ LIBRARY "chrome_elf.dll"
EXPORTS
CreateFileW=CreateFileWRedirect
+ IsBlacklistInitialized
SignalChromeElf
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml
index 34974cf..abaee59 100644
--- a/tools/metrics/histograms/histograms.xml
+++ b/tools/metrics/histograms/histograms.xml
@@ -1301,6 +1301,13 @@ other types of suffix sets.
</summary>
</histogram>
+<histogram name="Blacklist.PatchedInRenderer" enum="BooleanHit">
+ <summary>
+ Counts the number of times a renderer process is started with the browser
+ blacklist patch. This should never be hit.
+ </summary>
+</histogram>
+
<histogram name="Blacklist.Setup" enum="BlacklistSetup">
<summary>
Records the successes and failures when running the browser blacklist setup