Backed out changeset 98e368b5c4be (bug 1463035) for failures in tools/profiler/tests/chrome/test_profile_worker.html on a CLOSED TREE
authorNoemi Erli <nerli@mozilla.com>
Tue, 22 May 2018 03:16:44 +0300
changeset 419225 0ee7d4aa1799029d38c95d75eefe4a401cbd2800
parent 419224 0c033165b03fe8f9b25b63f67d9d1d772f708b8f
child 419226 5c86999026eaf01f11b1fb58e18ccae0c03c1781
push id34031
push usernbeleuzu@mozilla.com
push dateTue, 22 May 2018 09:47:31 +0000
treeherdermozilla-central@ac1c5c363e29 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1463035
milestone62.0a1
backs out98e368b5c4beb0a183b1260236f47e0c5937d9a8
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 98e368b5c4be (bug 1463035) for failures in tools/profiler/tests/chrome/test_profile_worker.html on a CLOSED TREE
mfbt/LinuxSignal.h
mfbt/moz.build
tools/profiler/core/platform-linux-android.cpp
new file mode 100644
--- /dev/null
+++ b/mfbt/LinuxSignal.h
@@ -0,0 +1,45 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef mozilla_LinuxSignal_h
+#define mozilla_LinuxSignal_h
+
+namespace mozilla {
+
+#if defined(__arm__)
+
+// Some (old) Linux kernels on ARM have a bug where a signal handler
+// can be called without clearing the IT bits in CPSR first. The result
+// is that the first few instructions of the handler could be skipped,
+// ultimately resulting in crashes. To workaround this bug, the handler
+// on ARM is a trampoline that starts with enough NOP instructions, so
+// that even if the IT bits are not cleared, only the NOP instructions
+// will be skipped over.
+
+template <void (*H)(int, siginfo_t*, void*)>
+__attribute__((naked)) void
+SignalTrampoline(int aSignal, siginfo_t* aInfo, void* aContext)
+{
+  asm volatile (
+    "nop; nop; nop; nop"
+    : : : "memory");
+
+  asm volatile (
+    "b %0"
+    :
+    : "X"(H)
+    : "memory");
+}
+
+# define MOZ_SIGNAL_TRAMPOLINE(h) (mozilla::SignalTrampoline<h>)
+
+#else // __arm__
+
+# define MOZ_SIGNAL_TRAMPOLINE(h) (h)
+
+#endif // __arm__
+
+} // namespace mozilla
+
+#endif // mozilla_LinuxSignal_h
--- a/mfbt/moz.build
+++ b/mfbt/moz.build
@@ -117,16 +117,20 @@ EXPORTS["double-conversion"] = [
 LOCAL_INCLUDES += [
     '/mfbt/double-conversion',
 ]
 
 if CONFIG['OS_ARCH'] == 'WINNT':
     EXPORTS.mozilla += [
         'WindowsVersion.h',
     ]
+elif CONFIG['OS_ARCH'] == 'Linux':
+    EXPORTS.mozilla += [
+        'LinuxSignal.h',
+    ]
 
 UNIFIED_SOURCES += [
     'Assertions.cpp',
     'ChaosMode.cpp',
     'double-conversion/double-conversion/bignum-dtoa.cc',
     'double-conversion/double-conversion/bignum.cc',
     'double-conversion/double-conversion/cached-powers.cc',
     'double-conversion/double-conversion/diy-fp.cc',
--- a/tools/profiler/core/platform-linux-android.cpp
+++ b/tools/profiler/core/platform-linux-android.cpp
@@ -55,16 +55,17 @@
 #ifdef __GLIBC__
 #include <execinfo.h>   // backtrace, backtrace_symbols
 #endif  // def __GLIBC__
 #include <strings.h>    // index
 #include <errno.h>
 #include <stdarg.h>
 
 #include "prenv.h"
+#include "mozilla/LinuxSignal.h"
 #include "mozilla/PodOperations.h"
 #include "mozilla/DebugOnly.h"
 
 #include <string.h>
 #include <list>
 
 using namespace mozilla;
 
@@ -271,17 +272,17 @@ Sampler::Sampler(PSLockRef aLock)
 
   // NOTE: We don't initialize LUL here, instead initializing it in
   // SamplerThread's constructor. This is because with the
   // profiler_suspend_and_sample_thread entry point, we want to be able to
   // sample without waiting for LUL to be initialized.
 
   // Request profiling signals.
   struct sigaction sa;
-  sa.sa_sigaction = SigprofHandler;
+  sa.sa_sigaction = MOZ_SIGNAL_TRAMPOLINE(SigprofHandler);
   sigemptyset(&sa.sa_mask);
   sa.sa_flags = SA_RESTART | SA_SIGINFO;
   if (sigaction(SIGPROF, &sa, &mOldSigprofHandler) != 0) {
     MOZ_CRASH("Error installing SIGPROF handler in the profiler");
   }
 }
 
 void