hanchenye-llvm-project/compiler-rt
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
..
cmake Enable memory sanitizer for PPC64 2015-06-25 06:22:31 +00:00
include Add dfsan_weak_hook_memcmp 2015-05-07 00:04:39 +00:00
lib [msan] Fix infinite recursion when _Unwind_Backtrace calls memcpy 2015-06-27 08:39:12 +00:00
make [darwin] fix libcompiler_rt.dylib build 2015-05-20 22:37:46 +00:00
test [asan] Disable 3 tests on Android. 2015-06-26 23:44:43 +00:00
unittests Use the newer python syntax for exceptions 2014-12-13 02:46:56 +00:00
www
.arcconfig Update arc config to new domain. 2014-04-07 10:22:41 +00:00
.gitignore Add vim swap files to .gitignore 2014-03-20 19:44:33 +00:00
CMakeLists.txt [Sanitizer] Set minimum supported Mac OS X version to 10.9, if it wasn't specified explicitly. 2015-06-25 20:43:35 +00:00
CODE_OWNERS.TXT
CREDITS.TXT Add Guan-Hong Liu. 2014-06-16 08:38:19 +00:00
LICENSE.TXT Update copyright year to 2015. 2015-03-12 19:53:06 +00:00
Makefile
README.txt Moved the builtins documentation to lib/builtins/ 2014-05-28 23:09:45 +00:00

README.txt

Compiler-RT
================================

This directory and its subdirectories contain source code for the compiler
support routines.

Compiler-RT is open source software. You may freely distribute it under the
terms of the license agreement found in LICENSE.txt.

================================