Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6065)

Unified Diff: chrome_elf/blacklist/blacklist_interceptions.cc

Issue 174013007: Add UMA stats to record when DLLs are successfully blocked in the Browser. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Alignment Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome_elf/blacklist/blacklist.cc ('k') | chrome_elf/blacklist/test/blacklist_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome_elf/blacklist/blacklist_interceptions.cc
diff --git a/chrome_elf/blacklist/blacklist_interceptions.cc b/chrome_elf/blacklist/blacklist_interceptions.cc
index b3f3d8256fceedfb74fd01dcc7382b16403079d3..8496c485cd7cb3761bcea865bbb92622ee3fbd92 100644
--- a/chrome_elf/blacklist/blacklist_interceptions.cc
+++ b/chrome_elf/blacklist/blacklist_interceptions.cc
@@ -35,12 +35,12 @@ FARPROC GetNtDllExportByName(const char* export_name) {
return ::GetProcAddress(ntdll, export_name);
}
-bool DllMatch(const base::string16& module_name) {
+int DllMatch(const base::string16& module_name) {
for (int i = 0; blacklist::g_troublesome_dlls[i] != NULL; ++i) {
if (_wcsicmp(module_name.c_str(), blacklist::g_troublesome_dlls[i]) == 0)
- return true;
+ return i;
}
- return false;
+ return -1;
}
// TODO(robertshield): Some of the helper functions below overlap somewhat with
@@ -203,10 +203,15 @@ NTSTATUS BlNtMapViewOfSectionImpl(
module_name = ExtractLoadedModuleName(file_name);
}
- if (!module_name.empty() && DllMatch(module_name)) {
- DCHECK_NT(g_nt_unmap_view_of_section_func);
- g_nt_unmap_view_of_section_func(process, *base);
- ret = STATUS_UNSUCCESSFUL;
+ if (!module_name.empty()) {
+ int blocked_index = DllMatch(module_name);
+ if (blocked_index != -1) {
+ DCHECK_NT(g_nt_unmap_view_of_section_func);
+ g_nt_unmap_view_of_section_func(process, *base);
+ ret = STATUS_UNSUCCESSFUL;
+
+ blacklist::BlockedDll(blocked_index);
+ }
}
}
« no previous file with comments | « chrome_elf/blacklist/blacklist.cc ('k') | chrome_elf/blacklist/test/blacklist_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698