[PATCH] D42329: [ubsan] Disable signal handling on Android.
Evgenii Stepanov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 19 18:24:38 PST 2018
eugenis created this revision.
eugenis added a reviewer: vitalybuka.
Herald added subscribers: kubamracek, srhines.
See rationale in the comments.
https://reviews.llvm.org/D42329
Files:
compiler-rt/lib/ubsan/ubsan_signals_standalone.cc
Index: compiler-rt/lib/ubsan/ubsan_signals_standalone.cc
===================================================================
--- compiler-rt/lib/ubsan/ubsan_signals_standalone.cc
+++ compiler-rt/lib/ubsan/ubsan_signals_standalone.cc
@@ -13,20 +13,32 @@
//===----------------------------------------------------------------------===//
#include "ubsan_platform.h"
+#include "sanitizer_common/sanitizer_platform.h"
#if CAN_SANITIZE_UB
#include "interception/interception.h"
#include "sanitizer_common/sanitizer_stacktrace.h"
#include "ubsan_diag.h"
#include "ubsan_init.h"
+// Interception of signals breaks too many things on Android.
+// * It requires that ubsan is the first dependency of the main executable for
+// the interceptors to work correctly. This complicates deployment, as it
+// prevents us from enabling ubsan on random platform modules independently.
+// * For this to work with ART VM, ubsan signal handler has to be set after the
+// debuggerd handler, but before the ART handler.
+#if SANITIZER_FUCHSIA || SANITIZER_ANDROID
+
+namespace __ubsan {
+void InitializeDeadlySignals() {}
+}
+
+#else
+
#define COMMON_INTERCEPT_FUNCTION(name) INTERCEPT_FUNCTION(name)
#include "sanitizer_common/sanitizer_signal_interceptors.inc"
namespace __ubsan {
-#if SANITIZER_FUCHSIA
-void InitializeDeadlySignals() {}
-#else
static void OnStackUnwind(const SignalContext &sig, const void *,
BufferedStackTrace *stack) {
GetStackTrace(stack, kStackTraceMax, sig.pc, sig.bp, sig.context,
@@ -46,8 +58,9 @@
InitializeSignalInterceptors();
InstallDeadlySignalHandlers(&UBsanOnDeadlySignal);
}
-#endif
} // namespace __ubsan
+#endif
+
#endif // CAN_SANITIZE_UB
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42329.130740.patch
Type: text/x-patch
Size: 1719 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180120/8279d003/attachment.bin>
More information about the llvm-commits
mailing list