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

Unified Diff: chrome_elf/blacklist/blacklist_interceptions.cc

Issue 154653002: Breakpad coverage for chrome_elf start up (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments and catch crashes in blacklist intercept code 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
Index: chrome_elf/blacklist/blacklist_interceptions.cc
diff --git a/chrome_elf/blacklist/blacklist_interceptions.cc b/chrome_elf/blacklist/blacklist_interceptions.cc
index 642a8b4347004fc2c9801a2862bc8b4ff136c768..2ce76036c1083489895ff86fa4c525f78b97728e 100644
--- a/chrome_elf/blacklist/blacklist_interceptions.cc
+++ b/chrome_elf/blacklist/blacklist_interceptions.cc
@@ -17,6 +17,7 @@
#include "base/strings/string16.h"
#include "base/win/pe_image.h"
#include "chrome_elf/blacklist/blacklist.h"
+#include "chrome_elf/breakpad.h"
#include "sandbox/win/src/internal_types.h"
#include "sandbox/win/src/nt_internals.h"
#include "sandbox/win/src/sandbox_nt_util.h"
@@ -166,25 +167,7 @@ bool IsSameAsCurrentProcess(HANDLE process) {
(::GetProcessId(process) == ::GetCurrentProcessId());
}
-} // namespace
-
-namespace blacklist {
-
-bool InitializeInterceptImports() {
- g_nt_query_section_func = reinterpret_cast<NtQuerySectionFunction>(
- GetNtDllExportByName("NtQuerySection"));
- g_nt_query_virtual_memory_func =
- reinterpret_cast<NtQueryVirtualMemoryFunction>(
- GetNtDllExportByName("NtQueryVirtualMemory"));
- g_nt_unmap_view_of_section_func =
- reinterpret_cast<NtUnmapViewOfSectionFunction>(
- GetNtDllExportByName("NtUnmapViewOfSection"));
-
- return g_nt_query_section_func && g_nt_query_virtual_memory_func &&
- g_nt_unmap_view_of_section_func;
-}
-
-SANDBOX_INTERCEPT NTSTATUS WINAPI BlNtMapViewOfSection(
+NTSTATUS BlNtMapViewOfSectionImpl(
NtMapViewOfSectionFunction orig_MapViewOfSection,
HANDLE section,
HANDLE process,
@@ -226,6 +209,50 @@ SANDBOX_INTERCEPT NTSTATUS WINAPI BlNtMapViewOfSection(
}
}
+
robertshield 2014/02/10 18:43:14 nit: extra blank line?
Cait (Slow) 2014/02/12 19:15:41 Done.
+ return ret;
+}
+
+} // namespace
+
+namespace blacklist {
+
+bool InitializeInterceptImports() {
+ g_nt_query_section_func = reinterpret_cast<NtQuerySectionFunction>(
+ GetNtDllExportByName("NtQuerySection"));
+ g_nt_query_virtual_memory_func =
+ reinterpret_cast<NtQueryVirtualMemoryFunction>(
+ GetNtDllExportByName("NtQueryVirtualMemory"));
+ g_nt_unmap_view_of_section_func =
+ reinterpret_cast<NtUnmapViewOfSectionFunction>(
+ GetNtDllExportByName("NtUnmapViewOfSection"));
+
+ return g_nt_query_section_func && g_nt_query_virtual_memory_func &&
+ g_nt_unmap_view_of_section_func;
+}
+
+SANDBOX_INTERCEPT NTSTATUS WINAPI BlNtMapViewOfSection(
+ NtMapViewOfSectionFunction orig_MapViewOfSection,
+ HANDLE section,
+ HANDLE process,
+ PVOID *base,
+ ULONG_PTR zero_bits,
+ SIZE_T commit_size,
+ PLARGE_INTEGER offset,
+ PSIZE_T view_size,
+ SECTION_INHERIT inherit,
+ ULONG allocation_type,
+ ULONG protect) {
+ NTSTATUS ret = STATUS_UNSUCCESSFUL;
+
+ __try {
+ ret = BlNtMapViewOfSectionImpl(orig_MapViewOfSection, section, process,
+ base, zero_bits, commit_size, offset,
+ view_size, inherit, allocation_type,
+ protect);
+ } __except(GenerateCrashDump(GetExceptionInformation())) {
+ }
+
return ret;
}

Powered by Google App Engine
This is Rietveld 408576698