Bug 1154803 - Put our sigaction diversion in __sigaction if it exists. r=glandium, a=lmandel
authortravis <travis@browser.html>
Mon, 20 Apr 2015 17:15:32 -0500
changeset 265741 70f812c7460df6d7d7edc72a02a504f6fe03d396
parent 265740 e9dea8904981f1e433509f85663c38d6b16cea5c
child 265742 a0044e233d6ad7e058b7052b445db63ca698a4d0
push id4718
push userraliiev@mozilla.com
push dateMon, 11 May 2015 18:39:53 +0000
treeherdermozilla-beta@c20c4ef55f08 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium, lmandel
bugs1154803
milestone39.0a2
Bug 1154803 - Put our sigaction diversion in __sigaction if it exists. r=glandium, a=lmandel
mozglue/linker/ElfLoader.cpp
--- a/mozglue/linker/ElfLoader.cpp
+++ b/mozglue/linker/ElfLoader.cpp
@@ -1111,18 +1111,27 @@ SEGVHandler::FinishInitialization()
    * - Calls to sigaction from system library and faulty.lib-loaded libraries
    *   all go to the libc's sigaction, which end up in our __wrap_sigaction.
    * - The signal handler registered to the kernel is ours.
    * - Our handler redispatches according to whatever system library or
    *   faulty.lib-loaded library set with sigaction.
    */
   void *libc = dlopen("libc.so", RTLD_GLOBAL | RTLD_LAZY);
   if (libc) {
-    libc_sigaction =
-      reinterpret_cast<sigaction_func>(dlsym(libc, "sigaction"));
+    /*
+     * Lollipop bionic only has a small trampoline in sigaction, with the real
+     * work happening in __sigaction. Divert there instead of sigaction if it exists.
+     * Bug 1154803
+     */
+    libc_sigaction = reinterpret_cast<sigaction_func>(dlsym(libc, "__sigaction"));
+
+    if (!libc_sigaction) {
+      libc_sigaction =
+        reinterpret_cast<sigaction_func>(dlsym(libc, "sigaction"));
+    }
   } else
 #endif
   {
     libc_sigaction = sigaction;
   }
 
   if (!Divert(libc_sigaction, __wrap_sigaction))
     return;