Revert 251095 "Revert 250828 "Add a UMA stat to track if the Bro..."

Speculative re-land to see if this causes sync tests failures again.
If it does, then we will know if this is the cause.

> Revert 250828 "Add a UMA stat to track if the Browser blacklist ..."
> 
> Speculative revert for failures here:
> 
> http://build.chromium.org/p/chromium.win/builders/Win7%20Sync%20x64/builds/11201
> 
> > Add a UMA stat to track if the Browser blacklist is Set on the Renderer
> > 
> > This shouldn't be happening, but we got some crash reports suggesting it
> > does. Unable to repo locally so this stat will verify it does occur and
> > then can be used to verify our fixes actually fix it.
> > 
> > BUG=329023
> > 
> > Review URL: https://codereview.chromium.org/140763008
> 
> TBR=csharp@chromium.org
> 
> Review URL: https://codereview.chromium.org/163633005

TBR=asvitkine@chromium.org

Review URL: https://codereview.chromium.org/164833002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@251134 0039d316-1c4b-4281-b951-d872f2087c98
parent 951a7e9c
...@@ -441,6 +441,9 @@ ...@@ -441,6 +441,9 @@
], ],
}], }],
['OS=="win"', { ['OS=="win"', {
'dependencies': [
'../chrome_elf/chrome_elf.gyp:chrome_elf',
],
'include_dirs': [ 'include_dirs': [
'<(DEPTH)/third_party/wtl/include', '<(DEPTH)/third_party/wtl/include',
], ],
......
...@@ -76,6 +76,7 @@ ...@@ -76,6 +76,7 @@
'isolate_dependency_tracked': [ 'isolate_dependency_tracked': [
'../net/data/ssl/certificates/foaf.me.chromium-test-cert.der', '../net/data/ssl/certificates/foaf.me.chromium-test-cert.der',
'../net/data/ssl/certificates/mit.davidben.der', '../net/data/ssl/certificates/mit.davidben.der',
'<(PRODUCT_DIR)/chrome_elf.dll',
'<(PRODUCT_DIR)/d3dcompiler_46.dll', '<(PRODUCT_DIR)/d3dcompiler_46.dll',
'<(PRODUCT_DIR)/ffmpegsumo.dll', '<(PRODUCT_DIR)/ffmpegsumo.dll',
'<(PRODUCT_DIR)/libEGL.dll', '<(PRODUCT_DIR)/libEGL.dll',
......
include_rules = [ include_rules = [
"+chrome_elf",
"+components/autofill/content/common", "+components/autofill/content/common",
"+components/autofill/content/renderer", "+components/autofill/content/renderer",
"+components/autofill/core/common", "+components/autofill/core/common",
......
...@@ -116,6 +116,10 @@ ...@@ -116,6 +116,10 @@
#include "chrome/renderer/spellchecker/spellcheck_provider.h" #include "chrome/renderer/spellchecker/spellcheck_provider.h"
#endif #endif
#if defined(OS_WIN)
#include "chrome_elf/blacklist/blacklist.h"
#endif // OS_WIN
using autofill::AutofillAgent; using autofill::AutofillAgent;
using autofill::PasswordAutofillAgent; using autofill::PasswordAutofillAgent;
using autofill::PasswordGenerationAgent; using autofill::PasswordGenerationAgent;
...@@ -353,6 +357,19 @@ void ChromeContentRendererClient::RenderThreadStarted() { ...@@ -353,6 +357,19 @@ void ChromeContentRendererClient::RenderThreadStarted() {
extensions::ExtensionsClient::Set( extensions::ExtensionsClient::Set(
extensions::ChromeExtensionsClient::GetInstance()); 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())
UMA_HISTOGRAM_BOOLEAN("Blacklist.PatchedInRenderer", true);
#endif
} }
void ChromeContentRendererClient::RenderFrameCreated( void ChromeContentRendererClient::RenderFrameCreated(
......
...@@ -108,7 +108,8 @@ ...@@ -108,7 +108,8 @@
['OS=="win"', { ['OS=="win"', {
'variables': { 'variables': {
'isolate_dependency_tracked': [ 'isolate_dependency_tracked': [
'<(PRODUCT_DIR)/ffmpegsumo.dll', '<(PRODUCT_DIR)/chrome_elf.dll',
'<(PRODUCT_DIR)/ffmpegsumo.dll',
], ],
'isolate_dependency_untracked': [ 'isolate_dependency_untracked': [
'../ppapi/lib/gl/include/KHR/', '../ppapi/lib/gl/include/KHR/',
......
...@@ -60,6 +60,10 @@ enum WOW64Status { ...@@ -60,6 +60,10 @@ enum WOW64Status {
WOW64_UNKNOWN, 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() { WOW64Status GetWOW64StatusForCurrentProcess() {
typedef BOOL (WINAPI* IsWow64ProcessFunc)(HANDLE, PBOOL); typedef BOOL (WINAPI* IsWow64ProcessFunc)(HANDLE, PBOOL);
IsWow64ProcessFunc is_wow64_process = reinterpret_cast<IsWow64ProcessFunc>( IsWow64ProcessFunc is_wow64_process = reinterpret_cast<IsWow64ProcessFunc>(
...@@ -272,6 +276,10 @@ int BlacklistSize() { ...@@ -272,6 +276,10 @@ int BlacklistSize() {
return size; return size;
} }
bool IsBlacklistInitialized() {
return g_blacklist_initialized;
}
bool AddDllToBlacklist(const wchar_t* dll_name) { bool AddDllToBlacklist(const wchar_t* dll_name) {
int blacklist_size = BlacklistSize(); int blacklist_size = BlacklistSize();
// We need to leave one space at the end for the null pointer. // We need to leave one space at the end for the null pointer.
...@@ -373,6 +381,9 @@ bool Initialize(bool force) { ...@@ -373,6 +381,9 @@ bool Initialize(bool force) {
} }
#endif #endif
// Record that we have initialized the blacklist.
g_blacklist_initialized = true;
BYTE* thunk_storage = reinterpret_cast<BYTE*>(&g_thunk_storage); BYTE* thunk_storage = reinterpret_cast<BYTE*>(&g_thunk_storage);
// Mark the thunk storage as readable and writeable, since we // Mark the thunk storage as readable and writeable, since we
......
...@@ -61,6 +61,9 @@ bool ResetBeacon(); ...@@ -61,6 +61,9 @@ bool ResetBeacon();
// Return the size of the current blacklist. // Return the size of the current blacklist.
int BlacklistSize(); 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 // 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 // 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 // |dll_name| and will leak it on exit if the string is not subsequently removed
......
...@@ -32,6 +32,7 @@ extern "C" { ...@@ -32,6 +32,7 @@ extern "C" {
// functions on the test blacklist dll, not the ones linked into the test // functions on the test blacklist dll, not the ones linked into the test
// executable itself. // executable itself.
__declspec(dllimport) bool TestDll_AddDllToBlacklist(const wchar_t* dll_name); __declspec(dllimport) bool TestDll_AddDllToBlacklist(const wchar_t* dll_name);
__declspec(dllimport) bool TestDLL_IsBlacklistInitialized();
__declspec(dllimport) bool TestDll_RemoveDllFromBlacklist( __declspec(dllimport) bool TestDll_RemoveDllFromBlacklist(
const wchar_t* dll_name); const wchar_t* dll_name);
} }
...@@ -120,6 +121,9 @@ TEST_F(BlacklistTest, LoadBlacklistedLibrary) { ...@@ -120,6 +121,9 @@ TEST_F(BlacklistTest, LoadBlacklistedLibrary) {
base::FilePath current_dir; base::FilePath current_dir;
ASSERT_TRUE(PathService::Get(base::DIR_EXE, &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. // Test that an un-blacklisted DLL can load correctly.
base::ScopedNativeLibrary dll1(current_dir.Append(kTestDllName1)); base::ScopedNativeLibrary dll1(current_dir.Append(kTestDllName1));
EXPECT_TRUE(dll1.is_valid()); EXPECT_TRUE(dll1.is_valid());
......
...@@ -6,5 +6,6 @@ LIBRARY "blacklist_test_main_dll.dll" ...@@ -6,5 +6,6 @@ LIBRARY "blacklist_test_main_dll.dll"
EXPORTS EXPORTS
TestDll_AddDllToBlacklist=AddDllToBlacklist TestDll_AddDllToBlacklist=AddDllToBlacklist
TestDLL_IsBlacklistInitialized=IsBlacklistInitialized
TestDll_RemoveDllFromBlacklist=RemoveDllFromBlacklist TestDll_RemoveDllFromBlacklist=RemoveDllFromBlacklist
InitBlacklistTestDll InitBlacklistTestDll
\ No newline at end of file
...@@ -6,4 +6,5 @@ LIBRARY "chrome_elf.dll" ...@@ -6,4 +6,5 @@ LIBRARY "chrome_elf.dll"
EXPORTS EXPORTS
CreateFileW=CreateFileWRedirect CreateFileW=CreateFileWRedirect
IsBlacklistInitialized
SignalChromeElf SignalChromeElf
...@@ -1282,6 +1282,13 @@ other types of suffix sets. ...@@ -1282,6 +1282,13 @@ other types of suffix sets.
</summary> </summary>
</histogram> </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"> <histogram name="Blacklist.Setup" enum="BlacklistSetup">
<summary> <summary>
Records the successes and failures when running the browser blacklist setup Records the successes and failures when running the browser blacklist setup
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment