Backed out changeset 628ebca30ce3 (bug 1490240) for bustages on [Unified_cpp_crashreporter0.obj]. CLOSED TREE
authorBrindusan Cristian <cbrindusan@mozilla.com>
Mon, 24 Sep 2018 17:10:58 +0300
changeset 493610 bdc24dded5656cf650d9cac7d6e4e43fd214d58c
parent 493609 863ee0115b822dc8a8a8dca6cac3e2e481f0da0f
child 493640 ea12f08bca89233f4f1037b6061a3877ab81d841
child 493641 3c7a1fb334621318a2d4a98c1622c0d9fb469fef
push id9984
push userffxbld-merge
push dateMon, 15 Oct 2018 21:07:35 +0000
treeherdermozilla-beta@183d27ea8570 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1490240
milestone64.0a1
backs out628ebca30ce356acab1e9f0497c20492a3899d57
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset 628ebca30ce3 (bug 1490240) for bustages on [Unified_cpp_crashreporter0.obj]. CLOSED TREE
mozglue/misc/interceptor/PatcherNopSpace.h
mozglue/misc/interceptor/TargetFunction.h
toolkit/crashreporter/breakpad-client/linux/moz.build
toolkit/crashreporter/breakpad-client/mac/handler/moz.build
toolkit/crashreporter/client/crashreporter_win.cpp
toolkit/crashreporter/client/moz.build
toolkit/crashreporter/google-breakpad/src/common/mac/moz.build
toolkit/crashreporter/google-breakpad/src/common/moz.build
toolkit/crashreporter/moz.build
toolkit/crashreporter/nsExceptionHandler.cpp
toolkit/crashreporter/test/moz.build
toolkit/crashreporter/test/nsTestCrasher.cpp
--- a/mozglue/misc/interceptor/PatcherNopSpace.h
+++ b/mozglue/misc/interceptor/PatcherNopSpace.h
@@ -147,50 +147,49 @@ public:
 
     ReadOnlyTargetFunction<MMPolicyT> readOnlyTargetFn(
       this->ResolveRedirectedAddress(aTargetFn));
 
     if (!WriteHook(readOnlyTargetFn, aHookDest, aOrigFunc)) {
       return false;
     }
 
-    return mPatchedFns.append(
-      reinterpret_cast<void*>(readOnlyTargetFn.GetBaseAddress()));
+    mPatchedFns.append(reinterpret_cast<void*>(readOnlyTargetFn.GetBaseAddress()));
+    return true;
   }
 
   bool WriteHook(const ReadOnlyTargetFunction<MMPolicyT>& aFn,
                  intptr_t aHookDest, void** aOrigFunc)
   {
     // Ensure we can read and write starting at fn - 5 (for the long jmp we're
     // going to write) and ending at fn + 2 (for the short jmp up to the long
     // jmp). These bytes may span two pages with different protection.
     WritableTargetFunction<MMPolicyT> writableFn(aFn.Promote(7, -5));
     if (!writableFn) {
       return false;
     }
 
     // Check that the 5 bytes before the function are NOP's or INT 3's,
     const uint8_t nopOrBp[] = { 0x90, 0xCC };
-    if (!writableFn.template VerifyValuesAreOneOf<uint8_t, 5>(nopOrBp)) {
+    if (!writableFn.VerifyValuesAreOneOf<uint8_t, 5>(nopOrBp)) {
       return false;
     }
 
     // ... and that the first 2 bytes of the function are mov(edi, edi).
     // There are two ways to encode the same thing:
     //
     //   0x89 0xff == mov r/m, r
     //   0x8b 0xff == mov r, r/m
     //
     // where "r" is register and "r/m" is register or memory.
     // Windows seems to use 0x8B 0xFF. We include 0x89 0xFF out of paranoia.
 
     // (These look backwards because little-endian)
     const uint16_t possibleEncodings[] = { 0xFF8B, 0xFF89 };
-    if (!writableFn.template VerifyValuesAreOneOf<uint16_t, 1>(
-            possibleEncodings, 5)) {
+    if (!writableFn.VerifyValuesAreOneOf<uint16_t, 1>(possibleEncodings, 5)) {
       return false;
     }
 
     // Write a long jump into the space above the function.
     writableFn.WriteByte(0xe9); // jmp
     if (!writableFn) {
       return false;
     }
--- a/mozglue/misc/interceptor/TargetFunction.h
+++ b/mozglue/misc/interceptor/TargetFunction.h
@@ -590,91 +590,92 @@ private:
   static const size_t kInlineStorage = 32;
 #endif
 
   const MMPolicyOutOfProcess&     mMMPolicy;
   Vector<uint8_t, kInlineStorage> mLocalBytes;
   uint8_t const * const           mBase;
 };
 
-template <typename TargetMMPolicy> class TargetBytesPtr;
-
-template<>
-class TargetBytesPtr<MMPolicyInProcess>
-{
-public:
-  typedef TargetBytesPtr<MMPolicyInProcess> Type;
-
-  static Type Make(const MMPolicyInProcess& aMMPolicy, const void* aFunc)
-  {
-    return TargetBytesPtr(aMMPolicy, aFunc);
-  }
-
-  static Type CopyFromOffset(const TargetBytesPtr& aOther,
-                             const uint32_t aOffsetFromOther)
-  {
-    return TargetBytesPtr(aOther, aOffsetFromOther);
-  }
-
-  ReadOnlyTargetBytes<MMPolicyInProcess>* operator->()
-  {
-    return &mTargetBytes;
-  }
-
-  TargetBytesPtr(TargetBytesPtr&& aOther)
-    : mTargetBytes(std::move(aOther.mTargetBytes))
-  {
-  }
-
-  TargetBytesPtr(const TargetBytesPtr& aOther)
-    : mTargetBytes(aOther.mTargetBytes)
-  {
-  }
-
-  TargetBytesPtr& operator=(const TargetBytesPtr&) = delete;
-  TargetBytesPtr& operator=(TargetBytesPtr&&) = delete;
-
-private:
-  TargetBytesPtr(const MMPolicyInProcess& aMMPolicy, const void* aFunc)
-    : mTargetBytes(aMMPolicy, aFunc)
-  {
-  }
-
-  TargetBytesPtr(const TargetBytesPtr& aOther,
-                 const uint32_t aOffsetFromOther)
-    : mTargetBytes(aOther.mTargetBytes, aOffsetFromOther)
-  {
-  }
-
-  ReadOnlyTargetBytes<MMPolicyInProcess> mTargetBytes;
-};
-
-template <>
-class TargetBytesPtr<MMPolicyOutOfProcess>
-{
-public:
-  typedef std::shared_ptr<ReadOnlyTargetBytes<MMPolicyOutOfProcess>> Type;
-
-  static Type Make(const MMPolicyOutOfProcess& aMMPolicy, const void* aFunc)
-  {
-    return std::make_shared<ReadOnlyTargetBytes<MMPolicyOutOfProcess>>(
-                  aMMPolicy, aFunc);
-  }
-
-  static Type CopyFromOffset(const Type& aOther,
-                             const uint32_t aOffsetFromOther)
-  {
-    return std::make_shared<ReadOnlyTargetBytes<MMPolicyOutOfProcess>>(
-                  *aOther, aOffsetFromOther);
-  }
-};
-
 template <typename MMPolicy>
 class MOZ_STACK_CLASS ReadOnlyTargetFunction final
 {
+  template <typename TargetMMPolicy>
+  class TargetBytesPtr;
+
+  template<>
+  class TargetBytesPtr<MMPolicyInProcess>
+  {
+  public:
+    typedef TargetBytesPtr<MMPolicyInProcess> Type;
+
+    static Type Make(const MMPolicyInProcess& aMMPolicy, const void* aFunc)
+    {
+      return std::move(TargetBytesPtr(aMMPolicy, aFunc));
+    }
+
+    static Type CopyFromOffset(const TargetBytesPtr& aOther,
+                               const uint32_t aOffsetFromOther)
+    {
+      return std::move(TargetBytesPtr(aOther, aOffsetFromOther));
+    }
+
+    ReadOnlyTargetBytes<MMPolicyInProcess>* operator->()
+    {
+      return &mTargetBytes;
+    }
+
+    TargetBytesPtr(TargetBytesPtr&& aOther)
+      : mTargetBytes(std::move(aOther.mTargetBytes))
+    {
+    }
+
+    TargetBytesPtr(const TargetBytesPtr& aOther)
+      : mTargetBytes(aOther.mTargetBytes)
+    {
+    }
+
+    TargetBytesPtr& operator=(const TargetBytesPtr&) = delete;
+    TargetBytesPtr& operator=(TargetBytesPtr&&) = delete;
+
+  private:
+    TargetBytesPtr(const MMPolicyInProcess& aMMPolicy, const void* aFunc)
+      : mTargetBytes(aMMPolicy, aFunc)
+    {
+    }
+
+    TargetBytesPtr(const TargetBytesPtr& aOther,
+                   const uint32_t aOffsetFromOther)
+      : mTargetBytes(aOther.mTargetBytes, aOffsetFromOther)
+    {
+    }
+
+    ReadOnlyTargetBytes<MMPolicyInProcess> mTargetBytes;
+  };
+
+  template <>
+  class TargetBytesPtr<MMPolicyOutOfProcess>
+  {
+  public:
+    typedef std::shared_ptr<ReadOnlyTargetBytes<MMPolicyOutOfProcess>> Type;
+
+    static Type Make(const MMPolicyOutOfProcess& aMMPolicy, const void* aFunc)
+    {
+      return std::move(std::make_shared<ReadOnlyTargetBytes<MMPolicyOutOfProcess>>(
+                    aMMPolicy, aFunc));
+    }
+
+    static Type CopyFromOffset(const Type& aOther,
+                               const uint32_t aOffsetFromOther)
+    {
+      return std::move(std::make_shared<ReadOnlyTargetBytes<MMPolicyOutOfProcess>>(
+                    *aOther, aOffsetFromOther));
+    }
+  };
+
 public:
   ReadOnlyTargetFunction(const MMPolicy& aMMPolicy, const void* aFunc)
     : mTargetBytes(TargetBytesPtr<MMPolicy>::Make(aMMPolicy, aFunc))
     , mOffset(0)
   {
   }
 
   ReadOnlyTargetFunction(const MMPolicy& aMMPolicy, FARPROC aFunc)
--- a/toolkit/crashreporter/breakpad-client/linux/moz.build
+++ b/toolkit/crashreporter/breakpad-client/linux/moz.build
@@ -25,11 +25,14 @@ if CONFIG['OS_TARGET'] == 'Linux' or CON
 
 if CONFIG['OS_TARGET'] == 'Android':
     DEFINES['ANDROID_NDK_MAJOR_VERSION'] = CONFIG['ANDROID_NDK_MAJOR_VERSION']
     DEFINES['ANDROID_NDK_MINOR_VERSION'] = CONFIG['ANDROID_NDK_MINOR_VERSION']
     LOCAL_INCLUDES += [
         '/toolkit/crashreporter/google-breakpad/src/common/android/include',
     ]
 
+# We allow warnings for third-party code that can be updated from upstream.
+AllowCompilerWarnings()
+
 FINAL_LIBRARY = 'xul'
 
 include('/toolkit/crashreporter/crashreporter.mozbuild')
--- a/toolkit/crashreporter/breakpad-client/mac/handler/moz.build
+++ b/toolkit/crashreporter/breakpad-client/mac/handler/moz.build
@@ -6,15 +6,18 @@
 
 UNIFIED_SOURCES += [
     'breakpad_nlist_64.cc',
     'dynamic_images.cc',
     'exception_handler.cc',
     'minidump_generator.cc',
 ]
 
+# We allow warnings for third-party code that can be updated from upstream.
+AllowCompilerWarnings()
+
 FINAL_LIBRARY = 'xul'
 
 LOCAL_INCLUDES += [
     '/toolkit/crashreporter/breakpad-client',
     '/toolkit/crashreporter/google-breakpad/src',
 ]
 
--- a/toolkit/crashreporter/client/crashreporter_win.cpp
+++ b/toolkit/crashreporter/client/crashreporter_win.cpp
@@ -278,18 +278,17 @@ static string FormatLastError()
     // strip off any trailing newlines
     string::size_type n = message.find_last_not_of("\r\n");
     if (n < message.size() - 1) {
       message.erase(n+1);
     }
   }
   else {
     char buf[64];
-    sprintf(buf, "Unknown error, error code: 0x%08x",
-            static_cast<unsigned int>(err));
+    sprintf(buf, "Unknown error, error code: 0x%08x", err);
     message += buf;
   }
   return message;
 }
 
 #define TS_DRAW 2
 #define BP_CHECKBOX  3
 
@@ -344,16 +343,28 @@ static void GetRelativeRect(HWND hwnd, H
 
 static void SetDlgItemVisible(HWND hwndDlg, UINT item, bool visible)
 {
   HWND hwnd = GetDlgItem(hwndDlg, item);
 
   ShowWindow(hwnd, visible ? SW_SHOW : SW_HIDE);
 }
 
+static void SetDlgItemDisabled(HWND hwndDlg, UINT item, bool disabled)
+{
+  HWND hwnd = GetDlgItem(hwndDlg, item);
+  LONG style = GetWindowLong(hwnd, GWL_STYLE);
+  if (!disabled)
+    style |= WS_DISABLED;
+  else
+    style &= ~WS_DISABLED;
+
+  SetWindowLong(hwnd, GWL_STYLE, style);
+}
+
 /* === Crash Reporting Dialog === */
 
 static void StretchDialog(HWND hwndDlg, int ydiff)
 {
   RECT r;
   GetWindowRect(hwndDlg, &r);
   r.bottom += ydiff;
   MoveWindow(hwndDlg, r.left, r.top,
--- a/toolkit/crashreporter/client/moz.build
+++ b/toolkit/crashreporter/client/moz.build
@@ -94,8 +94,11 @@ DEFINES['BIN_SUFFIX'] = '"%s"' % CONFIG[
 
 RCINCLUDE = 'crashreporter.rc'
 
 # Don't use the STL wrappers in the crashreporter clients; they don't
 # link with -lmozalloc, and it really doesn't matter here anyway.
 DisableStlWrapping()
 
 include('/toolkit/crashreporter/crashreporter.mozbuild')
+
+if CONFIG['CC_TYPE'] == 'clang-cl':
+    AllowCompilerWarnings()  # workaround for bug 1090497
--- a/toolkit/crashreporter/google-breakpad/src/common/mac/moz.build
+++ b/toolkit/crashreporter/google-breakpad/src/common/mac/moz.build
@@ -37,13 +37,16 @@ SOURCES += [
     'bootstrap_compat.cc',
     'HTTPMultipartUpload.m',
     'MachIPC.mm',
     'string_utilities.cc',
 ]
 
 Library('breakpad_mac_common_s')
 
+# We allow warnings for third-party code that can be updated from upstream.
+AllowCompilerWarnings()
+
 FINAL_LIBRARY = 'xul'
 
 CMFLAGS += ['-std=c99']
 
 include('/toolkit/crashreporter/crashreporter.mozbuild')
--- a/toolkit/crashreporter/google-breakpad/src/common/moz.build
+++ b/toolkit/crashreporter/google-breakpad/src/common/moz.build
@@ -65,11 +65,14 @@ if CONFIG['OS_TARGET'] == 'Android':
         'android/breakpad_getcontext.S',
     ]
     LOCAL_INCLUDES += [
         '/toolkit/crashreporter/google-breakpad/src/common/android/include',
     ]
 
 Library('breakpad_common_s')
 
+# We allow warnings for third-party code that can be updated from upstream.
+AllowCompilerWarnings()
+
 FINAL_LIBRARY = 'xul'
 
 include('/toolkit/crashreporter/crashreporter.mozbuild')
--- a/toolkit/crashreporter/moz.build
+++ b/toolkit/crashreporter/moz.build
@@ -136,8 +136,11 @@ crash_annotations = GENERATED_FILES['Cra
 crash_annotations.script = 'generate_crash_reporter_sources.py:emit_header'
 crash_annotations.inputs = [
     'CrashAnnotations.h.in',
     'CrashAnnotations.yaml',
 ]
 
 with Files('**'):
     BUG_COMPONENT = ('Toolkit', 'Crash Reporting')
+
+if CONFIG['CC_TYPE'] == 'clang-cl':
+    AllowCompilerWarnings()  # workaround for bug 1090497
--- a/toolkit/crashreporter/nsExceptionHandler.cpp
+++ b/toolkit/crashreporter/nsExceptionHandler.cpp
@@ -7,17 +7,16 @@
 #include "nsExceptionHandler.h"
 #include "nsExceptionHandlerUtils.h"
 
 #include "nsAppDirectoryServiceDefs.h"
 #include "nsDirectoryServiceDefs.h"
 #include "nsDirectoryService.h"
 #include "nsDataHashtable.h"
 #include "mozilla/ArrayUtils.h"
-#include "mozilla/DebugOnly.h"
 #include "mozilla/EnumeratedRange.h"
 #include "mozilla/Services.h"
 #include "nsIObserverService.h"
 #include "mozilla/Unused.h"
 #include "mozilla/Printf.h"
 #include "mozilla/Sprintf.h"
 #include "mozilla/SyncRunnable.h"
 #include "mozilla/TimeStamp.h"
@@ -1325,18 +1324,16 @@ ReserveBreakpadVM()
 static void
 FreeBreakpadVM()
 {
   if (gBreakpadReservedVM) {
     VirtualFree(gBreakpadReservedVM, 0, MEM_RELEASE);
   }
 }
 
-#if defined(XP_WIN)
-
 /**
  * Filters out floating point exceptions which are handled by nsSigHandlers.cpp
  * and should not be handled as crashes.
  *
  * Also calls FreeBreakpadVM if appropriate.
  */
 static bool FPEFilter(void* context, EXCEPTION_POINTERS* exinfo,
                       MDRawAssertionInfo* assertion)
@@ -1377,18 +1374,16 @@ ChildFPEFilter(void* context, EXCEPTION_
 {
   bool result = FPEFilter(context, exinfo, assertion);
   if (result) {
     PrepareChildExceptionTimeAnnotations(context);
   }
   return result;
 }
 
-#endif // defined(XP_WIN)
-
 static MINIDUMP_TYPE
 GetMinidumpType()
 {
   MINIDUMP_TYPE minidump_type = static_cast<MINIDUMP_TYPE>(
       MiniDumpWithFullMemoryInfo | MiniDumpWithUnloadedModules);
 
 #ifdef NIGHTLY_BUILD
   // This is Nightly only because this doubles the size of minidumps based
@@ -1428,18 +1423,16 @@ static bool ShouldReport()
   envvar = PR_GetEnv("MOZ_CRASHREPORTER_FULLDUMP");
   if (envvar && *envvar) {
     return false;
   }
 
   return true;
 }
 
-#if !defined(XP_WIN)
-
 static bool
 Filter(void* context)
 {
   mozilla::IOInterposer::Disable();
 #if defined(DEBUG) && defined(HAS_DLL_BLOCKLIST)
   DllBlocklist_Shutdown();
 #endif
   return true;
@@ -1450,18 +1443,16 @@ ChildFilter(void* context)
 {
   bool result = Filter(context);
   if (result) {
     PrepareChildExceptionTimeAnnotations(context);
   }
   return result;
 }
 
-#endif // !defined(XP_WIN)
-
 static void
 TerminateHandler()
 {
   MOZ_CRASH("Unhandled exception");
 }
 
 #if !defined(MOZ_WIDGET_ANDROID)
 
@@ -1666,20 +1657,19 @@ nsresult SetExceptionHandler(nsIFile* aX
 #ifdef _WIN64
   // Tell JS about the new filter before we disable SetUnhandledExceptionFilter
   SetJitExceptionHandler();
 #endif
 
   // protect the crash reporter from being unloaded
   gBlockUnhandledExceptionFilter = true;
   gKernel32Intercept.Init("kernel32.dll");
-  DebugOnly<bool> ok =
-    stub_SetUnhandledExceptionFilter.Set(gKernel32Intercept,
-                                         "SetUnhandledExceptionFilter",
-                                         &patched_SetUnhandledExceptionFilter);
+  bool ok = stub_SetUnhandledExceptionFilter.Set(gKernel32Intercept,
+                                                 "SetUnhandledExceptionFilter",
+                                                 &patched_SetUnhandledExceptionFilter);
 
 #ifdef DEBUG
   if (!ok)
     printf_stderr ("SetUnhandledExceptionFilter hook failed; crash reporter is vulnerable.\n");
 #endif
 #endif
 
   // store application start time
--- a/toolkit/crashreporter/test/moz.build
+++ b/toolkit/crashreporter/test/moz.build
@@ -54,8 +54,11 @@ TEST_HARNESS_FILES.xpcshell.toolkit.cras
 
 include('/toolkit/crashreporter/crashreporter.mozbuild')
 
 NO_PGO = True
 
 # Temporary workaround for an issue in upstream breakpad
 if CONFIG['CC_TYPE'] in ('msvc', 'clang-cl'):
     CXXFLAGS += ['-wd4334']
+
+if CONFIG['CC_TYPE'] == 'clang-cl':
+    AllowCompilerWarnings()  # workaround for bug 1090497
--- a/toolkit/crashreporter/test/nsTestCrasher.cpp
+++ b/toolkit/crashreporter/test/nsTestCrasher.cpp
@@ -171,17 +171,17 @@ void Crash(int16_t how)
   case CRASH_X64CFI_EPILOG: {
     auto m = GetWin64CFITestMap();
     if (m.find(how) == m.end()) {
       break;
     }
     auto pfnTest = m[how];
     auto pfnLauncher = m[CRASH_X64CFI_LAUNCHER];
     ReserveStack();
-    pfnLauncher(0, reinterpret_cast<void*>(pfnTest));
+    pfnLauncher(0, pfnTest);
     break;
   }
 #endif // XP_WIN && HAVE_64BIT_BUILD && !defined(__MINGW32__)
   default:
     break;
   }
 }