llvm-project/compiler-rt/lib
Jay Foad 55f65a3554 [msan] Fix infinite recursion when _Unwind_Backtrace calls memcpy
Summary:
On PPC64, half the msan tests fail with an infinite recursion through
GetStackTrace like this:

#0 __msan::GetStackTrace
#1 __msan_memcpy
#2 ?? () from /lib64/libgcc_s.so.1
#3 ?? () from /lib64/libgcc_s.so.1
#4 _Unwind_Backtrace
#5 __sanitizer::BufferedStackTrace::SlowUnwindStack
#6 __sanitizer::BufferedStackTrace::Unwind
#7 __msan::GetStackTrace
#8 __interceptor_calloc
#9 _dl_allocate_tls
#10 pthread_create@@GLIBC_2.17
#11 __interceptor_pthread_create
#12 main

The problem is that we call _Unwind_Backtrace to get a stack trace; but
_Unwind_Backtrace calls memcpy, which we intercept and try to get
another stack trace.

This patch fixes it in __msan_memcpy by skipping the stack trace if
IsInSymbolizer(). This works because GetStackTrace already creates a
SymbolizerScope to "block reports from our interceptors during
_Unwind_Backtrace".

Reviewers: samsonov, wschmidt, eugenis

Reviewed By: eugenis

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D10762

llvm-svn: 240878
2015-06-27 08:39:12 +00:00
..
BlocksRuntime Move tests for BlocksRuntime and builtins to corresponding directories under test/ 2014-02-14 09:47:31 +00:00
asan [ASan] Clean up obsolete stats. 2015-06-26 19:18:02 +00:00
builtins Fix incorrect truncation at the overflow boundary 2015-06-23 20:24:53 +00:00
dfsan [dfsan] ignore more __sanitizer callbacks 2015-05-23 01:56:39 +00:00
interception CMake: Stop using LLVM's custom parse_arguments. NFC 2015-06-19 03:39:24 +00:00
lsan CMake: Stop using LLVM's custom parse_arguments. NFC 2015-06-19 03:39:24 +00:00
msan [msan] Fix infinite recursion when _Unwind_Backtrace calls memcpy 2015-06-27 08:39:12 +00:00
profile CMake: Stop using LLVM's custom parse_arguments. NFC 2015-06-19 03:39:24 +00:00
safestack SafeStack: Add another missing header to try to fix FreeBSD build. 2015-06-24 18:16:05 +00:00
sanitizer_common [asan] Disable glibc-specific code chunk on Android. 2015-06-26 23:39:23 +00:00
tsan tsan: fix handling of dup2 2015-06-25 20:32:04 +00:00
ubsan [CMake] Fix PR23539: Don't reference C++ ABI symbols prior to Mac OS 10.9. 2015-06-25 00:57:42 +00:00
CMakeLists.txt Protection against stack-based memory corruption errors using SafeStack: compiler-rt runtime support library 2015-06-15 21:08:47 +00:00
Makefile.mk Remove support for building sanitizers from Makefile/autoconf build on Linux. 2015-02-18 22:26:49 +00:00