Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/metrics/field_trial.h" | 6 #include "base/metrics/field_trial.h" |
| 7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
| 8 #include "base/metrics/sparse_histogram.h" | 8 #include "base/metrics/sparse_histogram.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "base/win/registry.h" | 10 #include "base/win/registry.h" |
| 11 #include "base/win/windows_version.h" | |
| 11 #include "chrome/browser/chrome_elf_init_win.h" | 12 #include "chrome/browser/chrome_elf_init_win.h" |
| 12 #include "chrome/common/chrome_version.h" | 13 #include "chrome/common/chrome_version.h" |
| 13 #include "chrome_elf/blacklist/blacklist.h" | 14 #include "chrome_elf/blacklist/blacklist.h" |
| 14 #include "chrome_elf/chrome_elf_constants.h" | 15 #include "chrome_elf/chrome_elf_constants.h" |
| 15 #include "chrome_elf/dll_hash/dll_hash.h" | 16 #include "chrome_elf/dll_hash/dll_hash.h" |
| 16 #include "components/variations/variations_associated_data.h" | 17 #include "components/variations/variations_associated_data.h" |
| 17 #include "content/public/browser/browser_thread.h" | 18 #include "content/public/browser/browser_thread.h" |
| 18 | 19 |
| 19 const char kBrowserBlacklistTrialName[] = "BrowserBlacklist"; | 20 const char kBrowserBlacklistTrialName[] = "BrowserBlacklist"; |
| 20 const char kBrowserBlacklistTrialDisabledGroupName[] = "NoBlacklist"; | 21 const char kBrowserBlacklistTrialDisabledGroupName[] = "NoBlacklist"; |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 79 base::WideToUTF8(blocked_dlls[i], wcslen(blocked_dlls[i]), &dll_name_utf8); | 80 base::WideToUTF8(blocked_dlls[i], wcslen(blocked_dlls[i]), &dll_name_utf8); |
| 80 int uma_hash = DllNameToHash(dll_name_utf8); | 81 int uma_hash = DllNameToHash(dll_name_utf8); |
| 81 | 82 |
| 82 UMA_HISTOGRAM_SPARSE_SLOWLY("Blacklist.Blocked", uma_hash); | 83 UMA_HISTOGRAM_SPARSE_SLOWLY("Blacklist.Blocked", uma_hash); |
| 83 } | 84 } |
| 84 } | 85 } |
| 85 | 86 |
| 86 } // namespace | 87 } // namespace |
| 87 | 88 |
| 88 void InitializeChromeElf() { | 89 void InitializeChromeElf() { |
| 90 if (base::win::GetVersion() >= base::win::VERSION_WIN8 && | |
| 91 base::FieldTrialList::FindFullName("WindowsHookBlocking") != "Disabled") { | |
|
robertshield
2015/11/18 17:51:03
Not sure it's useful to apply the policy here. Thi
jschuh
2015/11/18 18:21:15
Okay, that makes a lot more sense. Because I trace
robertshield
2015/11/18 19:50:29
You can, but there are hoops to jump through and i
| |
| 92 typedef BOOL(WINAPI * SetProcessMitigationPolicyFunction)( | |
| 93 PROCESS_MITIGATION_POLICY mitigation_policy, PVOID buffer, | |
| 94 SIZE_T length); | |
| 95 | |
| 96 PROCESS_MITIGATION_EXTENSION_POINT_DISABLE_POLICY policy = {}; | |
| 97 policy.DisableExtensionPoints = true; | |
| 98 SetProcessMitigationPolicyFunction set_process_mitigation_policy = | |
| 99 reinterpret_cast<SetProcessMitigationPolicyFunction>(::GetProcAddress( | |
| 100 ::GetModuleHandleA("kernel32.dll"), "SetProcessMitigationPolicy")); | |
| 101 bool result = !!set_process_mitigation_policy( | |
| 102 ProcessExtensionPointDisablePolicy, &policy, sizeof(policy)); | |
| 103 DCHECK(result); | |
| 104 } | |
| 105 | |
| 89 if (base::FieldTrialList::FindFullName(kBrowserBlacklistTrialName) == | 106 if (base::FieldTrialList::FindFullName(kBrowserBlacklistTrialName) == |
| 90 kBrowserBlacklistTrialDisabledGroupName) { | 107 kBrowserBlacklistTrialDisabledGroupName) { |
| 91 // Disable the blacklist for all future runs by removing the beacon. | 108 // Disable the blacklist for all future runs by removing the beacon. |
| 92 base::win::RegKey blacklist_registry_key(HKEY_CURRENT_USER); | 109 base::win::RegKey blacklist_registry_key(HKEY_CURRENT_USER); |
| 93 blacklist_registry_key.DeleteKey(blacklist::kRegistryBeaconPath); | 110 blacklist_registry_key.DeleteKey(blacklist::kRegistryBeaconPath); |
| 94 } else { | 111 } else { |
| 95 AddFinchBlacklistToRegistry(); | 112 AddFinchBlacklistToRegistry(); |
| 96 BrowserBlacklistBeaconSetup(); | 113 BrowserBlacklistBeaconSetup(); |
| 97 } | 114 } |
| 98 | 115 |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 197 | 214 |
| 198 blacklist_registry_key.WriteValue(blacklist::kBeaconAttemptCount, | 215 blacklist_registry_key.WriteValue(blacklist::kBeaconAttemptCount, |
| 199 static_cast<DWORD>(0)); | 216 static_cast<DWORD>(0)); |
| 200 | 217 |
| 201 // Only report the blacklist as getting setup when both registry writes | 218 // Only report the blacklist as getting setup when both registry writes |
| 202 // succeed, since otherwise the blacklist wasn't properly setup. | 219 // succeed, since otherwise the blacklist wasn't properly setup. |
| 203 if (set_version == ERROR_SUCCESS && set_state == ERROR_SUCCESS) | 220 if (set_version == ERROR_SUCCESS && set_state == ERROR_SUCCESS) |
| 204 RecordBlacklistSetupEvent(BLACKLIST_SETUP_ENABLED); | 221 RecordBlacklistSetupEvent(BLACKLIST_SETUP_ENABLED); |
| 205 } | 222 } |
| 206 } | 223 } |
| OLD | NEW |