OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "android_webview/common/aw_crash_handler.h" | 5 #include "android_webview/common/aw_crash_handler.h" |
6 | 6 |
7 #include <android/log.h> | 7 #include <android/log.h> |
8 #include <signal.h> | 8 #include <signal.h> |
9 #include <sys/prctl.h> | 9 #include <sys/prctl.h> |
10 #include <sys/syscall.h> | 10 #include <sys/syscall.h> |
11 #include <unistd.h> | 11 #include <unistd.h> |
12 | 12 |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "build/build_config.h" |
14 | 15 |
15 namespace { | 16 namespace { |
16 | 17 |
17 const int kExceptionSignals[] = { | 18 const int kExceptionSignals[] = { |
18 SIGSEGV, SIGABRT, SIGFPE, SIGILL, SIGBUS | 19 SIGSEGV, SIGABRT, SIGFPE, SIGILL, SIGBUS |
19 }; | 20 }; |
20 | 21 |
21 struct sigaction old_handlers[arraysize(kExceptionSignals)]; | 22 struct sigaction old_handlers[arraysize(kExceptionSignals)]; |
22 | 23 |
23 bool crash_handler_registered; | 24 bool crash_handler_registered; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 } | 60 } |
60 } | 61 } |
61 } | 62 } |
62 | 63 |
63 } // namespace | 64 } // namespace |
64 | 65 |
65 namespace android_webview { | 66 namespace android_webview { |
66 namespace crash_handler { | 67 namespace crash_handler { |
67 | 68 |
68 void RegisterCrashHandler(const std::string& version) { | 69 void RegisterCrashHandler(const std::string& version) { |
| 70 #if defined(ARCH_CPU_X86_FAMILY) |
| 71 // Don't install signal handler on X86/64 because this breaks binary |
| 72 // translators that handle SIGSEGV in userspace and get chained after our |
| 73 // handler. See crbug.com/477444 |
| 74 return; |
| 75 #endif |
| 76 |
69 if (crash_handler_registered) { | 77 if (crash_handler_registered) { |
70 NOTREACHED(); | 78 NOTREACHED(); |
71 return; | 79 return; |
72 } | 80 } |
73 | 81 |
74 g_crash_msg = "### WebView " + version; | 82 g_crash_msg = "### WebView " + version; |
75 g_crash_msg_ptr = g_crash_msg.c_str(); | 83 g_crash_msg_ptr = g_crash_msg.c_str(); |
76 | 84 |
77 // Fail if unable to store all the old handlers. | 85 // Fail if unable to store all the old handlers. |
78 for (uint32_t i = 0; i < arraysize(kExceptionSignals); ++i) { | 86 for (uint32_t i = 0; i < arraysize(kExceptionSignals); ++i) { |
(...skipping 22 matching lines...) Expand all Loading... |
101 LOG(ERROR) << "Error while overriding handler for signal " | 109 LOG(ERROR) << "Error while overriding handler for signal " |
102 << kExceptionSignals[i]; | 110 << kExceptionSignals[i]; |
103 } | 111 } |
104 } | 112 } |
105 | 113 |
106 crash_handler_registered = true; | 114 crash_handler_registered = true; |
107 } | 115 } |
108 | 116 |
109 } // namespace crash_handler | 117 } // namespace crash_handler |
110 } // namespace android_webview | 118 } // namespace android_webview |
OLD | NEW |