From 50bef914a60f5667d619a48ce1bcf105e69efedc Mon Sep 17 00:00:00 2001 From: Evgeniy Stepanov Date: Tue, 18 Feb 2014 11:14:30 +0000 Subject: [PATCH] [asan] Override default sigaltstack setting on Android. Android libc always sets altstack on non-main threads, but it is too small for our unwinder. With use_sigaltstack=1, override this setting with a larger one. llvm-svn: 201557 --- compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cc b/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cc index 97a732f7fed3..58f343d164a2 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cc @@ -100,7 +100,8 @@ void SetAlternateSignalStack() { stack_t altstack, oldstack; CHECK_EQ(0, sigaltstack(0, &oldstack)); // If the alternate stack is already in place, do nothing. - if ((oldstack.ss_flags & SS_DISABLE) == 0) return; + // Android always sets an alternate stack, but it's too small for us. + if (!SANITIZER_ANDROID && !(oldstack.ss_flags & SS_DISABLE)) return; // TODO(glider): the mapped stack should have the MAP_STACK flag in the // future. It is not required by man 2 sigaltstack now (they're using // malloc()).