Bug 1154803 - Put our sigaction diversion in __sigaction if it exists. r=glandium, a=sledru
authortravis <travis@browser.html>
Mon, 20 Apr 2015 17:15:32 -0500
changeset 260266 fd5c74651fb2
parent 260265 2025aa8c5b1b
child 260267 38ff61772a2e
push id731
push userryanvm@gmail.com
push date2015-04-24 19:52 +0000
treeherdermozilla-release@38ff61772a2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium, sledru
bugs1154803
milestone38.0
Bug 1154803 - Put our sigaction diversion in __sigaction if it exists. r=glandium, a=sledru
mozglue/linker/ElfLoader.cpp
--- a/mozglue/linker/ElfLoader.cpp
+++ b/mozglue/linker/ElfLoader.cpp
@@ -1107,18 +1107,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;